From d3d2b5fe404780a6d21ccf26fc94e314813c6e42 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Sat, 3 Mar 2001 00:38:11 +0000 Subject: ChangeLogTag:Fri Mar 02 19:36:22 2001 Steve Huston --- ChangeLog | 16 ++++++++++++++++ ChangeLogs/ChangeLog-02a | 16 ++++++++++++++++ ChangeLogs/ChangeLog-03a | 16 ++++++++++++++++ ace/ACE.i | 2 +- ace/OS.i | 26 ++++++++++++++++++++++---- tests/TSS_Test.cpp | 19 ++++++++++++++++--- 6 files changed, 87 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 223382cab24..f46907593a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Fri Mar 02 19:36:22 2001 Steve Huston + + * ace/OS.i (ACE_OS::send): (only non-Win32), if call fails and + errno is EAGAIN, change it to EWOULDBLOCK. Improve portability for + platforms where EAGAIN and EWOULDBLOCK are different values and + both used, like HP-UX. + Thanks to snowymike@aol.com for reporting this problem. + + * ace/ACE.i (send_i): Call ACE_OS::send, not ACE_OS::write, on HP-UX. + This makes it pick up the EAGAIN->EWOULDBLOCK change. + + * tests/TSS_Test.cpp: Avoid doing ACE_Thread::keyfree on where + ACE_HAS_PTHREADS_DRAFT4 or ACE_HAS_PTHREADS_DRAFT6 (unless + ACE_HAS_TSS_EMULATION is also defined) since ACE_Thread::keyfree + will get ENOTSUP anyway. + Fri Mar 02 17:50:40 2001 Sharath R. Cholleti * ace/QtReactor.cpp: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 223382cab24..f46907593a5 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,19 @@ +Fri Mar 02 19:36:22 2001 Steve Huston + + * ace/OS.i (ACE_OS::send): (only non-Win32), if call fails and + errno is EAGAIN, change it to EWOULDBLOCK. Improve portability for + platforms where EAGAIN and EWOULDBLOCK are different values and + both used, like HP-UX. + Thanks to snowymike@aol.com for reporting this problem. + + * ace/ACE.i (send_i): Call ACE_OS::send, not ACE_OS::write, on HP-UX. + This makes it pick up the EAGAIN->EWOULDBLOCK change. + + * tests/TSS_Test.cpp: Avoid doing ACE_Thread::keyfree on where + ACE_HAS_PTHREADS_DRAFT4 or ACE_HAS_PTHREADS_DRAFT6 (unless + ACE_HAS_TSS_EMULATION is also defined) since ACE_Thread::keyfree + will get ENOTSUP anyway. + Fri Mar 02 17:50:40 2001 Sharath R. Cholleti * ace/QtReactor.cpp: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 223382cab24..f46907593a5 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,19 @@ +Fri Mar 02 19:36:22 2001 Steve Huston + + * ace/OS.i (ACE_OS::send): (only non-Win32), if call fails and + errno is EAGAIN, change it to EWOULDBLOCK. Improve portability for + platforms where EAGAIN and EWOULDBLOCK are different values and + both used, like HP-UX. + Thanks to snowymike@aol.com for reporting this problem. + + * ace/ACE.i (send_i): Call ACE_OS::send, not ACE_OS::write, on HP-UX. + This makes it pick up the EAGAIN->EWOULDBLOCK change. + + * tests/TSS_Test.cpp: Avoid doing ACE_Thread::keyfree on where + ACE_HAS_PTHREADS_DRAFT4 or ACE_HAS_PTHREADS_DRAFT6 (unless + ACE_HAS_TSS_EMULATION is also defined) since ACE_Thread::keyfree + will get ENOTSUP anyway. + Fri Mar 02 17:50:40 2001 Sharath R. Cholleti * ace/QtReactor.cpp: diff --git a/ace/ACE.i b/ace/ACE.i index d885afcaf4f..d58ab35463c 100644 --- a/ace/ACE.i +++ b/ace/ACE.i @@ -210,7 +210,7 @@ ACE::sendv_n (ACE_HANDLE handle, ASYS_INLINE ssize_t ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len) { -#if defined (ACE_WIN32) || defined (ACE_PSOS) +#if defined (ACE_WIN32) || defined (ACE_PSOS) || defined (HPUX) return ACE_OS::send (handle, (const char *) buf, len); #else return ACE_OS::write (handle, (const char *) buf, len); diff --git a/ace/OS.i b/ace/OS.i index 350a5e4b061..e18992fd756 100644 --- a/ace/OS.i +++ b/ace/OS.i @@ -6009,11 +6009,29 @@ ACE_INLINE int ACE_OS::send (ACE_HANDLE handle, const char *buf, int len, int flags) { ACE_OS_TRACE ("ACE_OS::send"); -#if defined (VXWORKS) || defined (HPUX) || defined (ACE_PSOS) - ACE_SOCKCALL_RETURN (::send ((ACE_SOCKET) handle, (char *) buf, len, flags), int, -1); -#else + + // On UNIX, a non-blocking socket with no data to receive, this + // system call will return EWOULDBLOCK or EAGAIN, depending on the + // platform. UNIX 98 allows either errno, and they may be the same + // numeric value. So to make life easier for upper ACE layers as + // well as application programmers, always change EAGAIN to + // EWOULDBLOCK. Rather than hack the ACE_OSCALL_RETURN macro, it's + // handled explicitly here. If the ACE_OSCALL macro ever changes, + // this function needs to be reviewed. On Win32, the regular macros + // can be used, as this is not an issue. +#if defined (ACE_WIN32) ACE_SOCKCALL_RETURN (::send ((ACE_SOCKET) handle, buf, len, flags), int, -1); -#endif /* VXWORKS */ +#else + int ace_result_; +# if defined (VXWORKS) || defined (HPUX) || defined (ACE_PSOS) + ace_result_ = ::send ((ACE_SOCKET) handle, (char *) buf, len, flags); +# else + ace_result_ = ::send ((ACE_SOCKET) handle, buf, len, flags); +# endif /* VXWORKS */ + if (ace_result_ == -1 && errno == EAGAIN) + errno = EWOULDBLOCK; + return ace_result_; +#endif /* defined (ACE_WIN32) */ } ACE_INLINE int diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp index be4be43f1a7..ea14892df29 100644 --- a/tests/TSS_Test.cpp +++ b/tests/TSS_Test.cpp @@ -148,9 +148,15 @@ worker (void *c) delete ip; #endif /* ! ACE_HAS_PTHREADS_DRAFT4 */ + // We don't do keyfree for ACE_HAS_PTHREADS_DRAFT4 (or 6) since it + // is not supported there, and will generate an error anyway. Unless + // ACE_HAS_TSS_EMULATION is turned on, then it should work. +#if !(defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)) \ + || defined (ACE_HAS_TSS_EMULATION) if (ACE_Thread::keyfree (key) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("ACE_Thread::keyfree"))); +#endif /* !(PTHREADS_DRAFT4 or 6) || defined (ACE_HAS_TSS_EMULATION) */ // Cause an error. ACE_OS::read (ACE_INVALID_HANDLE, 0, 0); @@ -218,14 +224,21 @@ worker (void *c) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("ACE_Thread::setspecific"))); -#if !defined (ACE_HAS_PTHREADS_DRAFT4) +# if !defined (ACE_HAS_PTHREADS_DRAFT4) // See comment in cleanup () above. delete ip; -#endif /* ! ACE_HAS_PTHREADS_DRAFT4 */ - +# endif /* ! ACE_HAS_PTHREADS_DRAFT4 */ + + // We don't do keyfree for ACE_HAS_PTHREADS_DRAFT4 (or 6) since it + // is not supported there, and will generate an error anyway. Unless + // ACE_HAS_TSS_EMULATION is turned on, then it should work. +# if !(defined (ACE_HAS_PTHREADS_DRAFT4) || \ + defined (ACE_HAS_PTHREADS_DRAFT6) ) \ + || defined (ACE_HAS_TSS_EMULATION) if (ACE_Thread::keyfree (key) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("ACE_Thread::keyfree"))); +# endif /* !(PTHREADS_DRAFT4 or 6) || defined (ACE_HAS_TSS_EMULATION) */ #endif /* ! __Lynx__ || ACE_HAS_TSS_EMULATION */ } -- cgit v1.2.1