From 1889dc494311306284e3862bf980a2fc55d95215 Mon Sep 17 00:00:00 2001 From: Michael Mathers Date: Wed, 8 Feb 2017 21:56:33 +1030 Subject: [PATCH 01/11] Added a test for the return value and errno combination expected when a wait on a condition variable times out. Added an additional case to the ACE_FAIL_RETURN macro to mutate ERROR_TIMEOUT into ETIME. Added an additional check at the end of the implementation of ACE_Condition::wait(ACE_Time_Value*) to mutate WIN32 errors into errno (as expected). --- ACE/ace/OS_NS_Thread.cpp | 8 ++++ ACE/ace/OS_NS_macros.h | 1 + ACE/tests/Native_Condition_Variable_Test.cpp | 47 ++++++++++++++++++++ ACE/tests/run_test.lst | 1 + ACE/tests/tests.mpc | 9 ++++ 5 files changed, 66 insertions(+) create mode 100644 ACE/tests/Native_Condition_Variable_Test.cpp diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index 8490507938b36..a27c739d36a67 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -1623,7 +1623,15 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, ACE_OSCALL (ACE_ADAPT_RETVAL (::SleepConditionVariableCS (cv, external_mutex, msec_timeout), result), int, -1, result); + + // Make sure we mutate errno if required + if (result == -1) + { + ACE_FAIL_RETURN(result); + } + return result; + #else // Prevent race conditions on the count. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) diff --git a/ACE/ace/OS_NS_macros.h b/ACE/ace/OS_NS_macros.h index 647f3143e8177..7f1085f2100c1 100644 --- a/ACE/ace/OS_NS_macros.h +++ b/ACE/ace/OS_NS_macros.h @@ -62,6 +62,7 @@ case ERROR_FILE_EXISTS: errno = EEXIST; break; \ case ERROR_SHARING_VIOLATION: errno = EACCES; break; \ case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; \ + case ERROR_TIMEOUT: errno = ETIME; break; \ } \ return RESULT; } while (0) diff --git a/ACE/tests/Native_Condition_Variable_Test.cpp b/ACE/tests/Native_Condition_Variable_Test.cpp new file mode 100644 index 0000000000000..057d09e2dd363 --- /dev/null +++ b/ACE/tests/Native_Condition_Variable_Test.cpp @@ -0,0 +1,47 @@ + +//============================================================================= +/** + * @file Native_Condition_Variable_Test.cpp + * + * This program tests the support of Native Condition Variables on + * Microsoft Windows. It checks that errno is correctly mutated to + * ensure return and errno values are consistent across implementations + * using ACE_Condition. + * + * @author Michael Mathers + */ +//============================================================================= + + +#include "test_config.h" +#include "ace/Condition_T.h" +#include "ace/Guard_T.h" + + +int +run_main(int, ACE_TCHAR *[]) +{ + ACE_START_TEST(ACE_TEXT("Native_Condition_Variable_Test")); + + ACE_SYNCH_MUTEX mutex; + ACE_Condition cond(mutex); + ACE_Time_Value timeout(1, 0); + bool condition = false; // Condition we are waiting on - will never changed (never intentionally signalled) + int result = 0; + + // Place the wait within a loop such that we don't just pass on account of a spurious wakeup + while (!condition && !(result == -1)) + { + ACE_Guard guard(mutex); + result = cond.wait(&timeout); + } + + // We should've timed out waiting for the condition variable to be signalled + // Expected behavior is to return -1 and have errno set to ETIME + // Note that native Windows condition variable will set errno to ERROR_TIMEOUT instead (mutation required) + ACE_TEST_ASSERT(result == -1); + ACE_TEST_ASSERT(ACE_OS::last_error() == ETIME); + + ACE_END_TEST; + return 0; +} diff --git a/ACE/tests/run_test.lst b/ACE/tests/run_test.lst index f508ed75cfe18..a2062faef3ca9 100644 --- a/ACE/tests/run_test.lst +++ b/ACE/tests/run_test.lst @@ -170,6 +170,7 @@ Monotonic_Task_Test: !ACE_FOR_TAO Multicast_Test: !ST !NO_MCAST !nsk !LynxOS !LabVIEW_RT Multihomed_INET_Addr_Test: !ACE_FOR_TAO Naming_Test: !NO_OTHER !LynxOS !VxWorks !nsk !ACE_FOR_TAO !PHARLAP +Native_Condition_Variable_Test Network_Adapters_Test: !ACE_FOR_TAO New_Fail_Test: ALL !DISABLED NonBlocking_Conn_Test diff --git a/ACE/tests/tests.mpc b/ACE/tests/tests.mpc index d2fa14dd936a0..5064feae8dd58 100644 --- a/ACE/tests/tests.mpc +++ b/ACE/tests/tests.mpc @@ -2236,3 +2236,12 @@ project(Missing_Svc_Conf_Test) : acetest { Missing_Svc_Conf_Test.cpp } } + + +project(Native_Condition_Variable_Test) : acetest { + exename = * + Source_Files { + Native_Condition_Variable_Test.cpp + } +} + From 5ac57a2f0113624845b31a45bf74e86ecd0f1b72 Mon Sep 17 00:00:00 2001 From: Michael Mathers Date: Thu, 9 Feb 2017 01:17:16 +1030 Subject: [PATCH 02/11] Fuzz test doesn't like ACE_Guard so replaced it with the ACE_GUARD_REACTION macro. --- ACE/tests/Native_Condition_Variable_Test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/tests/Native_Condition_Variable_Test.cpp b/ACE/tests/Native_Condition_Variable_Test.cpp index 057d09e2dd363..c64d4d2194f64 100644 --- a/ACE/tests/Native_Condition_Variable_Test.cpp +++ b/ACE/tests/Native_Condition_Variable_Test.cpp @@ -32,7 +32,7 @@ run_main(int, ACE_TCHAR *[]) // Place the wait within a loop such that we don't just pass on account of a spurious wakeup while (!condition && !(result == -1)) { - ACE_Guard guard(mutex); + ACE_GUARD_REACTION(ACE_SYNCH_MUTEX, guard, mutex, break); // Failure to acquire the mutex will leave result = 0 (will fail the assertion) result = cond.wait(&timeout); } From 4c52de01cfe92a8d1236f5dcba4009d4c78a318e Mon Sep 17 00:00:00 2001 From: Michael Mathers Date: Thu, 9 Feb 2017 23:02:48 +1030 Subject: [PATCH 03/11] Renamed the test to Condition_Variable_Timeout_Test to reflect the more general nature of the test and better indicate what is being tested. --- ...est.cpp => Condition_Variable_Timeout_Test.cpp} | 14 ++++++++------ ACE/tests/run_test.lst | 2 +- ACE/tests/tests.mpc | 6 ++---- 3 files changed, 11 insertions(+), 11 deletions(-) rename ACE/tests/{Native_Condition_Variable_Test.cpp => Condition_Variable_Timeout_Test.cpp} (71%) diff --git a/ACE/tests/Native_Condition_Variable_Test.cpp b/ACE/tests/Condition_Variable_Timeout_Test.cpp similarity index 71% rename from ACE/tests/Native_Condition_Variable_Test.cpp rename to ACE/tests/Condition_Variable_Timeout_Test.cpp index c64d4d2194f64..a84b8c8a9bcc3 100644 --- a/ACE/tests/Native_Condition_Variable_Test.cpp +++ b/ACE/tests/Condition_Variable_Timeout_Test.cpp @@ -1,12 +1,14 @@ //============================================================================= /** - * @file Native_Condition_Variable_Test.cpp + * @file Condition_Variable_Timeout_Test.cpp * - * This program tests the support of Native Condition Variables on - * Microsoft Windows. It checks that errno is correctly mutated to - * ensure return and errno values are consistent across implementations - * using ACE_Condition. + * This program tests the return value and setting of errno when a wait on + * a condition variable times out. This was originally noteworthy in the + * case of support for using native condition variables on Microsoft + * Windows. The test checks that errno is correctly mutated to ensure + * return and errno values are consistent across implementations when using + * ACE_Condition. * * @author Michael Mathers */ @@ -21,7 +23,7 @@ int run_main(int, ACE_TCHAR *[]) { - ACE_START_TEST(ACE_TEXT("Native_Condition_Variable_Test")); + ACE_START_TEST(ACE_TEXT("Condition_Variable_Timeout_Test")); ACE_SYNCH_MUTEX mutex; ACE_Condition cond(mutex); diff --git a/ACE/tests/run_test.lst b/ACE/tests/run_test.lst index a2062faef3ca9..2f8a24af57974 100644 --- a/ACE/tests/run_test.lst +++ b/ACE/tests/run_test.lst @@ -110,6 +110,7 @@ Compiler_Features_33_Test Compiler_Features_34_Test Compiler_Features_35_Test Compiler_Features_36_Test +Condition_Variable_Timeout_Test Config_Test: !LynxOS !VxWorks !ACE_FOR_TAO Conn_Test: !ACE_FOR_TAO DLL_Test: !STATIC Linux @@ -170,7 +171,6 @@ Monotonic_Task_Test: !ACE_FOR_TAO Multicast_Test: !ST !NO_MCAST !nsk !LynxOS !LabVIEW_RT Multihomed_INET_Addr_Test: !ACE_FOR_TAO Naming_Test: !NO_OTHER !LynxOS !VxWorks !nsk !ACE_FOR_TAO !PHARLAP -Native_Condition_Variable_Test Network_Adapters_Test: !ACE_FOR_TAO New_Fail_Test: ALL !DISABLED NonBlocking_Conn_Test diff --git a/ACE/tests/tests.mpc b/ACE/tests/tests.mpc index 5064feae8dd58..27f5b4c355b4a 100644 --- a/ACE/tests/tests.mpc +++ b/ACE/tests/tests.mpc @@ -2237,11 +2237,9 @@ project(Missing_Svc_Conf_Test) : acetest { } } - -project(Native_Condition_Variable_Test) : acetest { +project(Condition_Variable_Timeout_Test) : acetest { exename = * Source_Files { - Native_Condition_Variable_Test.cpp + Condition_Variable_Timeout_Test.cpp } } - From 090575a681e7671e275628bff6f4c30c6695a6a3 Mon Sep 17 00:00:00 2001 From: Michael Mathers Date: Fri, 10 Feb 2017 09:55:41 +1030 Subject: [PATCH 04/11] * Introduced adaptation to method for non-POSIX error codes. ACE_FAIL_RETURN now uses this method. Allows for a new macro ACE_FAIL_RETVAL which will mutate the last error and provide a value without requiring to return from a function. * Updated Win32 configuration to include native condition variables by default for Windows Vista / Windows Server 2008 and newer. --- ACE/ace/OS_NS_Thread.cpp | 8 ---- ACE/ace/OS_NS_errno.cpp | 72 ++++++++++++++++++++++++++++++++++ ACE/ace/OS_NS_errno.h | 6 ++- ACE/ace/OS_NS_errno.inl | 13 +++--- ACE/ace/OS_NS_macros.h | 41 +++++++------------ ACE/ace/config-win32-msvc-10.h | 14 +++---- 6 files changed, 105 insertions(+), 49 deletions(-) diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp index a27c739d36a67..8490507938b36 100644 --- a/ACE/ace/OS_NS_Thread.cpp +++ b/ACE/ace/OS_NS_Thread.cpp @@ -1623,15 +1623,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, ACE_OSCALL (ACE_ADAPT_RETVAL (::SleepConditionVariableCS (cv, external_mutex, msec_timeout), result), int, -1, result); - - // Make sure we mutate errno if required - if (result == -1) - { - ACE_FAIL_RETURN(result); - } - return result; - #else // Prevent race conditions on the count. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) diff --git a/ACE/ace/OS_NS_errno.cpp b/ACE/ace/OS_NS_errno.cpp index f84975d40af2a..48d906310b1c5 100644 --- a/ACE/ace/OS_NS_errno.cpp +++ b/ACE/ace/OS_NS_errno.cpp @@ -5,3 +5,75 @@ # include "ace/OS_NS_errno.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ + +// Perform a mapping of Win32 error numbers into POSIX errnos. +// NOTE: Keep this out-of-line as list may grow in future +int +ACE_OS::adapt_last_error(int error) +{ + ACE_OS_TRACE("ACE_OS::adapt_last_error"); + +#if defined(ACE_WIN32) + // Perform a mapping of Win32 error numbers into POSIX errnos. + switch (error) + { + case ERROR_NOT_ENOUGH_MEMORY: error = ENOMEM ; break; + case ERROR_FILE_EXISTS: error = EEXIST ; break; + case ERROR_SHARING_VIOLATION: error = EACCES ; break; + case ERROR_PATH_NOT_FOUND: error = ENOENT ; break; + case ERROR_ACCESS_DENIED: error = EPERM ; break; + case ERROR_SEM_TIMEOUT: error = ETIME ; break; + case ERROR_TIMEOUT: error = ETIME ; break; +// +// Reverse WSAGetLastError mappings that are not handled by +// the direct mappings in +// +#if defined(_CRT_NO_POSIX_ERROR_CODES) // see + case WSAEWOULDBLOCK: error = EWOULDBLOCK ; break; + case WSAEINPROGRESS: error = EINPROGRESS ; break; + case WSAEALREADY: error = EALREADY ; break; + case WSAENOTSOCK: error = ENOTSOCK ; break; + case WSAEDESTADDRREQ: error = EDESTADDRREQ ; break; + case WSAEMSGSIZE: error = EMSGSIZE ; break; + case WSAEPROTOTYPE: error = EPROTOTYPE ; break; + case WSAENOPROTOOPT: error = ENOPROTOOPT ; break; + case WSAEPROTONOSUPPORT: error = EPROTONOSUPPORT ; break; + case WSAESOCKTNOSUPPORT: error = ESOCKTNOSUPPORT ; break; + case WSAEOPNOTSUPP: error = EOPNOTSUPP ; break; + case WSAEPFNOSUPPORT: error = EPFNOSUPPORT ; break; + case WSAEAFNOSUPPORT: error = EAFNOSUPPORT ; break; + case WSAEADDRINUSE: error = EADDRINUSE ; break; + case WSAEADDRNOTAVAIL: error = EADDRNOTAVAIL ; break; + case WSAENETDOWN: error = ENETDOWN ; break; + case WSAENETUNREACH: error = ENETUNREACH ; break; + case WSAENETRESET: error = ENETRESET ; break; + case WSAECONNABORTED: error = ECONNABORTED ; break; + case WSAECONNRESET: error = ECONNRESET ; break; + case WSAENOBUFS: error = ENOBUFS ; break; + case WSAEISCONN: error = EISCONN ; break; + case WSAENOTCONN: error = ENOTCONN ; break; + case WSAESHUTDOWN: error = ESHUTDOWN ; break; + case WSAETOOMANYREFS: error = ETOOMANYREFS ; break; + case WSAETIMEDOUT: error = ETIMEDOUT ; break; + case WSAECONNREFUSED: error = ECONNREFUSED ; break; + case WSAELOOP: error = ELOOP ; break; + case WSAEHOSTDOWN: error = EHOSTDOWN ; break; + case WSAEHOSTUNREACH: error = EHOSTUNREACH ; break; + case WSAEPROCLIM: error = EPROCLIM ; break; + case WSAEUSERS: error = EUSERS ; break; + case WSAEDQUOT: error = EDQUOT ; break; + case WSAESTALE: error = ESTALE ; break; + case WSAEREMOTE: error = EREMOTE ; break; +#endif /* defined(_CRT_NO_POSIX_ERROR_CODES) */ +/* ENAMETOOLONG and ENOTEMPTY are defined by the 'standard' library. */ +#if defined(ENAMETOOLONG) + case WSAENAMETOOLONG: error = ENAMETOOLONG ; break; +#endif +#if defined(ENOTEMPTY) + case WSAENOTEMPTY: error = ENOTEMPTY ; break; +#endif + } +#endif /* defined(ACE_WIN32) */ + + return ACE_OS::last_error(error); +} diff --git a/ACE/ace/OS_NS_errno.h b/ACE/ace/OS_NS_errno.h index 75701f9840373..2c5965bcf4cb8 100644 --- a/ACE/ace/OS_NS_errno.h +++ b/ACE/ace/OS_NS_errno.h @@ -39,7 +39,7 @@ namespace ACE_OS { int last_error (void); ACE_NAMESPACE_INLINE_FUNCTION - void last_error (int error); + int last_error (int error); ACE_NAMESPACE_INLINE_FUNCTION int set_errno_to_last_error (void); @@ -47,6 +47,10 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int set_errno_to_wsa_last_error (void); + // Perform a mapping of Win32 error numbers into POSIX errnos. + ACE_EXPORT_MACRO + int adapt_last_error (int error); + } /* namespace ACE_OS */ #if defined (ACE_HAS_WINCE_BROKEN_ERRNO) diff --git a/ACE/ace/OS_NS_errno.inl b/ACE/ace/OS_NS_errno.inl index cad5d49789b5c..3619e1135437b 100644 --- a/ACE/ace/OS_NS_errno.inl +++ b/ACE/ace/OS_NS_errno.inl @@ -14,22 +14,22 @@ ACE_OS::last_error (void) // C++ socket wrapper facades. On Windows, some things that would // use errno on UNIX require ::GetLastError(), so this method tries // to shield the rest of ACE from having to know about this. - int const lerror = ::GetLastError (); - int const lerrno = errno; - return lerrno == 0 ? lerror : lerrno; + int const lerror = ::GetLastError (); + int const lerrno = errno; + return lerrno == 0 ? lerror : lerrno; #else - return errno; + return errno; #endif /* ACE_WIN32 */ } -ACE_INLINE void +ACE_INLINE int ACE_OS::last_error (int error) { ACE_OS_TRACE ("ACE_OS::last_error"); #if defined (ACE_WIN32) ::SetLastError (error); #endif /* ACE_WIN32 */ - errno = error; + return int(errno = error); } ACE_INLINE int @@ -52,6 +52,7 @@ ACE_OS::set_errno_to_wsa_last_error (void) # endif /* defined(ACE_WIN32) */ } + #if defined (ACE_HAS_WINCE_BROKEN_ERRNO) ACE_INLINE ACE_CE_Errno * diff --git a/ACE/ace/OS_NS_macros.h b/ACE/ace/OS_NS_macros.h index 7f1085f2100c1..2e7bf5abb4dbb 100644 --- a/ACE/ace/OS_NS_macros.h +++ b/ACE/ace/OS_NS_macros.h @@ -26,47 +26,34 @@ #if defined (ACE_WIN32) # define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) \ do { TYPE ace_result_ = (TYPE) OP; \ - if (ace_result_ == FAILVALUE) { int ___ = ::WSAGetLastError (); errno = ___; return (TYPE) FAILVALUE; } else return ace_result_; \ + if (ace_result_ == FAILVALUE) { ACE_OS::adapt_last_error(ACE_OS::set_errno_to_wsa_last_error()); return (TYPE) FAILVALUE; } else return ace_result_; \ } while (0) # define ACE_SOCKCALL(OP,TYPE,FAILVALUE,RESULT) \ do { RESULT = (TYPE) OP; \ - if (RESULT == FAILVALUE) { int ___ = ::WSAGetLastError (); errno = ___; RESULT = FAILVALUE; } \ + if (RESULT == FAILVALUE) { ACE_OS::adapt_last_error(ACE_OS::set_errno_to_wsa_last_error()); RESULT = FAILVALUE; } \ } while (0) #else # define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE) # define ACE_SOCKCALL(OP,TYPE,FAILVALUE,RESULT) ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT) #endif /* ACE_WIN32 */ -#if !defined (ACE_WIN32) +#define ACE_FAIL_RETVAL(RESULT) (ACE_OS::adapt_last_error(ACE_OS::set_errno_to_last_error()),(RESULT)) +#define ACE_FAIL_RETURN(RESULT) return ACE_FAIL_RETVAL(RESULT) + +#if defined (ACE_WIN32) +// Adapt the Win32 System Calls (which return BOOLEAN values of TRUE +// and FALSE) into int values expected by the ACE_OSCALL macros. +# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) == FALSE ? ACE_FAIL_RETVAL(-1) : 0) // Adapt the weird threading and synchronization routines (which // return errno rather than -1) so that they return -1 and set errno. // This is more consistent with the rest of ACE_OS and enables us to // use the ACE_OSCALL* macros. -# if defined (ACE_VXWORKS) -# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != OK ? (errno = RESULT, -1) : 0) -# else -# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != 0 ? (errno = RESULT, -1) : 0) -# endif /* ACE_VXWORKS */ - -#else /* ACE_WIN32 */ - -// Adapt the Win32 System Calls (which return BOOLEAN values of TRUE -// and FALSE) into int values expected by the ACE_OSCALL macros. -# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) == FALSE ? -1 : 0) - -// Perform a mapping of Win32 error numbers into POSIX errnos. -# define ACE_FAIL_RETURN(RESULT) do { \ - switch (ACE_OS::set_errno_to_last_error ()) { \ - case ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM; break; \ - case ERROR_FILE_EXISTS: errno = EEXIST; break; \ - case ERROR_SHARING_VIOLATION: errno = EACCES; break; \ - case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; \ - case ERROR_TIMEOUT: errno = ETIME; break; \ - } \ - return RESULT; } while (0) - -#endif /* !ACE_WIN32 */ +#elif defined (ACE_VXWORKS) +# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != OK ? ACE_FAIL_RETVAL(-1) : 0) +#else +# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != 0 ? ACE_FAIL_RETVAL(-1) : 0) +#endif /* ACE_WIN32 */ // Helper functions to split large intergers into smaller high-order // and low-order parts, and reconstitute them again. These are diff --git a/ACE/ace/config-win32-msvc-10.h b/ACE/ace/config-win32-msvc-10.h index 62dcdae8dd336..a84b87fc1df97 100644 --- a/ACE/ace/config-win32-msvc-10.h +++ b/ACE/ace/config-win32-msvc-10.h @@ -134,13 +134,13 @@ // explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. # define ACE_NEEDS_FUNC_DEFINITIONS -// Windows Vista and Windows Server 2008 and newer do have native condition -// variables, but this is commented out because the support in ACE hasn't -// been completed -// #if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) -// # define ACE_HAS_WTHREADS_CONDITION_VARIABLE -// # undef ACE_LACKS_COND_T -// #endif +// Windows Vista and Windows Server 2008 (same value 0x0600) and newer do +// have native condition variables. Originally this was commented out +// because the support in ACE wasn't completed (incl. up to ACE 6.4.2) +#if defined (_WIN32_WINNT) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) +# define ACE_HAS_WTHREADS_CONDITION_VARIABLE 1 +# undef ACE_LACKS_COND_T +#endif #include /**/ "ace/post.h" #endif /* ACE_CONFIG_WIN32_MSVC_10_H */ From b6a7b0a384083b455f2fd858cbba9c0caa2e4cd5 Mon Sep 17 00:00:00 2001 From: Michael Mathers Date: Fri, 10 Feb 2017 10:04:37 +1030 Subject: [PATCH 05/11] Reverted a change to adapting last error codes on VxWorks --- ACE/ace/OS_NS_macros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ACE/ace/OS_NS_macros.h b/ACE/ace/OS_NS_macros.h index 2e7bf5abb4dbb..7bbe39818c8be 100644 --- a/ACE/ace/OS_NS_macros.h +++ b/ACE/ace/OS_NS_macros.h @@ -50,9 +50,9 @@ // This is more consistent with the rest of ACE_OS and enables us to // use the ACE_OSCALL* macros. #elif defined (ACE_VXWORKS) -# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != OK ? ACE_FAIL_RETVAL(-1) : 0) +# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != OK ? (ACE_OS::last_error(RESULT), -1) : 0) #else -# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != 0 ? ACE_FAIL_RETVAL(-1) : 0) +# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != 0 ? (ACE_OS::last_error(RESULT), -1) : 0) #endif /* ACE_WIN32 */ // Helper functions to split large intergers into smaller high-order From 4fb88aecfa6bdd642c3eb9b6587f7f6c4f517ce8 Mon Sep 17 00:00:00 2001 From: Michael Mathers Date: Fri, 10 Feb 2017 12:49:26 +1030 Subject: [PATCH 06/11] Removed trailiing white space from OS_NS_errno.cpp --- ACE/ace/OS_NS_errno.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ACE/ace/OS_NS_errno.cpp b/ACE/ace/OS_NS_errno.cpp index 48d906310b1c5..39a8c598a5bca 100644 --- a/ACE/ace/OS_NS_errno.cpp +++ b/ACE/ace/OS_NS_errno.cpp @@ -26,7 +26,7 @@ ACE_OS::adapt_last_error(int error) case ERROR_TIMEOUT: error = ETIME ; break; // // Reverse WSAGetLastError mappings that are not handled by -// the direct mappings in +// the direct mappings in // #if defined(_CRT_NO_POSIX_ERROR_CODES) // see case WSAEWOULDBLOCK: error = EWOULDBLOCK ; break; From 37642758a1006f2e3e4fa38253d14c2f12aec9de Mon Sep 17 00:00:00 2001 From: Michael Mathers Date: Fri, 10 Feb 2017 19:39:41 +1030 Subject: [PATCH 07/11] Included sdkddkver.h from Windows SDK to ensure we perform OS version checks correctly and not automatically default to Windows XP support. --- ACE/ace/config-win32.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ACE/ace/config-win32.h b/ACE/ace/config-win32.h index 3217c2b78945e..7dde7d9b71a28 100644 --- a/ACE/ace/config-win32.h +++ b/ACE/ace/config-win32.h @@ -20,6 +20,11 @@ // NOTE: Please do not add anything besides #include's here. Put other stuff // (definitions, etc.) in the included headers +// To enable proper version checking we should include the Window SDK version header +// This must be included before ace/config-win32-common.h or else we'll default to +// Windows XP +#include + // We need to ensure that for Borland vcl.h can be included before // windows.h. So we will not include config-win32-common.h from here, // but instead let it be included at the appropriate place in From fe74c7e4a8c6f67d98ae2d924ab154c7de01bf0b Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 29 Oct 2018 16:14:39 +0100 Subject: [PATCH 08/11] Layout changes --- ACE/ace/OS_NS_errno.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ACE/ace/OS_NS_errno.inl b/ACE/ace/OS_NS_errno.inl index 3619e1135437b..ca369c8f06f2c 100644 --- a/ACE/ace/OS_NS_errno.inl +++ b/ACE/ace/OS_NS_errno.inl @@ -14,11 +14,11 @@ ACE_OS::last_error (void) // C++ socket wrapper facades. On Windows, some things that would // use errno on UNIX require ::GetLastError(), so this method tries // to shield the rest of ACE from having to know about this. - int const lerror = ::GetLastError (); - int const lerrno = errno; - return lerrno == 0 ? lerror : lerrno; + int const lerror = ::GetLastError (); + int const lerrno = errno; + return lerrno == 0 ? lerror : lerrno; #else - return errno; + return errno; #endif /* ACE_WIN32 */ } From c519b7f80dbc20e18aa4fd837c68222ada0a0966 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 29 Oct 2018 16:15:40 +0100 Subject: [PATCH 09/11] Removed old comments --- ACE/ace/config-win32-msvc-10.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ACE/ace/config-win32-msvc-10.h b/ACE/ace/config-win32-msvc-10.h index a84b87fc1df97..743d288404784 100644 --- a/ACE/ace/config-win32-msvc-10.h +++ b/ACE/ace/config-win32-msvc-10.h @@ -135,8 +135,7 @@ # define ACE_NEEDS_FUNC_DEFINITIONS // Windows Vista and Windows Server 2008 (same value 0x0600) and newer do -// have native condition variables. Originally this was commented out -// because the support in ACE wasn't completed (incl. up to ACE 6.4.2) +// have native condition variables. #if defined (_WIN32_WINNT) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) # define ACE_HAS_WTHREADS_CONDITION_VARIABLE 1 # undef ACE_LACKS_COND_T From dbc67cc88cbea3ee5d49826f6cca37cfdcf8bf20 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 29 Oct 2018 16:16:20 +0100 Subject: [PATCH 10/11] Removed some empty lines --- ACE/tests/Condition_Variable_Timeout_Test.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/ACE/tests/Condition_Variable_Timeout_Test.cpp b/ACE/tests/Condition_Variable_Timeout_Test.cpp index a84b8c8a9bcc3..ebace0f55ba67 100644 --- a/ACE/tests/Condition_Variable_Timeout_Test.cpp +++ b/ACE/tests/Condition_Variable_Timeout_Test.cpp @@ -1,4 +1,3 @@ - //============================================================================= /** * @file Condition_Variable_Timeout_Test.cpp @@ -14,12 +13,10 @@ */ //============================================================================= - #include "test_config.h" #include "ace/Condition_T.h" #include "ace/Guard_T.h" - int run_main(int, ACE_TCHAR *[]) { From 1b37ca2d3c04efaae8ede4606bb92cceb74cf659 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 29 Oct 2018 16:17:37 +0100 Subject: [PATCH 11/11] Removed empty line --- ACE/ace/OS_NS_errno.inl | 1 - 1 file changed, 1 deletion(-) diff --git a/ACE/ace/OS_NS_errno.inl b/ACE/ace/OS_NS_errno.inl index ca369c8f06f2c..ef88385ac010b 100644 --- a/ACE/ace/OS_NS_errno.inl +++ b/ACE/ace/OS_NS_errno.inl @@ -52,7 +52,6 @@ ACE_OS::set_errno_to_wsa_last_error (void) # endif /* defined(ACE_WIN32) */ } - #if defined (ACE_HAS_WINCE_BROKEN_ERRNO) ACE_INLINE ACE_CE_Errno *