Filter some Cygwin returned EINVAL errors due to implementation limitations. With these changes tests run fine under Cygwin64.

This commit is contained in:
Ion Gaztañaga
2024-08-25 19:17:01 +02:00
parent 4b82af3c28
commit 9c991cc4c3
5 changed files with 25 additions and 6 deletions

View File

@@ -6772,6 +6772,8 @@ thank them:
* Deprecated `<boost/interprocess/containers/*.hpp>` headers. They were the original source of [*Boost.Container] in 2011, but no longer maintained.
As a long transition, Boost.Interprocess has maintained those headers for compatibility. They will be removed in a future Boost release.
* Some workarounds for Cygwin were added. Regression tests now work on Cygwin64.
* Fixed bugs:
* [@https://github.com/boostorg/interprocess/issues/210 GitHub #210 (['"Bug in boost::interprocess::ipcdetail::sync_handles::obtain_mutex"])].
* [@https://github.com/boostorg/interprocess/issues/192 GitHub #192 (['"managed_windows_shared_memory crash on destruction"])].

View File

@@ -25,6 +25,8 @@ project : requirements
<target-os>hpux,<toolset>gcc:<linkflags>"-Wl,+as,mpas"
<target-os>windows,<toolset>clang:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
<target-os>linux:<linkflags>"-lrt"
#cygwin with -std=c++XX does not include POSIX
<target-os>cygwin:<define>XOPEN_SOURCE=600
<library>/boost/multi_index//boost_multi_index
<library>/boost/unordered//boost_unordered
;

View File

@@ -807,10 +807,19 @@ inline bool mapped_region::advise(advice_types advice)
default:
return false;
}
int ret = -1;
switch(mode){
#if defined(POSIX_MADV_NORMAL)
case mode_padv:
return 0 == posix_madvise(this->priv_map_address(), this->priv_map_size(), unix_advice);
{
ret = posix_madvise(this->priv_map_address(), this->priv_map_size(), unix_advice);
#ifdef __CYGWIN__
//Cygwin returns EINVAL in some valid use cases due to DiscardVirtualMemory limitations
if (ret == EINVAL)
ret = 0;
#endif
return 0 == ret;
}
#endif
#if defined(MADV_NORMAL)
case mode_madv:
@@ -822,7 +831,6 @@ inline bool mapped_region::advise(advice_types advice)
#endif
default:
return false;
}
}

View File

@@ -115,9 +115,13 @@ inline bool semaphore_open
inline void semaphore_close(sem_t *handle)
{
int ret = sem_close(handle);
if(ret != 0){
BOOST_ASSERT(0);
}
#ifdef __CYGWIN__
//Cygwin returns EINVAL in some valid use cases
if (ret == -1 && errno == EINVAL)
ret = 0;
#endif
BOOST_ASSERT(ret == 0);
(void)ret;
}
inline bool semaphore_unlink(const char *semname)

View File

@@ -18,13 +18,15 @@
project : requirements
<library>/boost/interprocess//boost_interprocess
<library>/boost/date_time//boost_date_time
<library>/boost/chrono//boost_chrono
<toolset>acc:<linkflags>-lrt
<toolset>acc-pa_risc:<linkflags>-lrt
<toolset>gcc,<target-os>windows:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
<target-os>hpux,<toolset>gcc:<linkflags>"-Wl,+as,mpas"
<target-os>windows,<toolset>clang:<linkflags>"-lole32 -loleaut32 -lpsapi -ladvapi32"
<target-os>linux:<linkflags>"-lrt"
<library>/boost/chrono//boost_chrono
#cygwin with -std=c++XX does not include POSIX
<target-os>cygwin:<define>_XOPEN_SOURCE=600
;
rule test_all
@@ -40,3 +42,4 @@ rule test_all
}
test-suite interprocess_test : [ test_all r ] : <threading>multi ;
;