2 #include "ace/config-all.h" /* Need ACE_TRACE */
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
9 // ACE_OS_TRACE ("ACE_OS::last_error");
11 #if defined (ACE_WIN32)
12 // ACE_OS::last_error() prefers errnor since started out as a way to
13 // avoid directly accessing errno in ACE code - particularly the ACE
14 // C++ socket wrapper facades. On Windows, some things that would
15 // use errno on UNIX require ::GetLastError(), so this method tries
16 // to shield the rest of ACE from having to know about this.
17 int const lerror = ::GetLastError ();
18 int const lerrno = errno;
19 return lerrno == 0 ? lerror : lerrno;
22 #endif /* ACE_WIN32 */
26 ACE_OS::last_error (int error)
28 ACE_OS_TRACE ("ACE_OS::last_error");
29 #if defined (ACE_WIN32)
30 ::SetLastError (error);
31 #endif /* ACE_WIN32 */
36 ACE_OS::set_errno_to_last_error ()
38 # if defined (ACE_WIN32)
39 return errno = ::GetLastError ();
42 # endif /* defined(ACE_WIN32) */
46 ACE_OS::set_errno_to_wsa_last_error ()
48 # if defined (ACE_WIN32)
49 return errno = ::WSAGetLastError ();
52 # endif /* defined(ACE_WIN32) */
55 ACE_END_VERSIONED_NAMESPACE_DECL