diff options
author | Steve Huston <shuston@riverace.com> | 2001-03-03 00:38:11 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2001-03-03 00:38:11 +0000 |
commit | 8c80baa6721da474fad5e417ce430106b59f8e30 (patch) | |
tree | 535568519f430ea1758002d1fda62db8fd90f1b0 /ace/OS.i | |
parent | 9d41ec8e8ca2a0550e34de2803bc4cd6d7578d9f (diff) | |
download | ATCD-8c80baa6721da474fad5e417ce430106b59f8e30.tar.gz |
ChangeLogTag:Fri Mar 02 19:36:22 2001 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace/OS.i')
-rw-r--r-- | ace/OS.i | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -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 |