summaryrefslogtreecommitdiff
path: root/ace/OS_NS_errno.inl
diff options
context:
space:
mode:
authordhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-11-01 11:15:26 +0000
committerdhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-11-01 11:15:26 +0000
commit746f4ee6169d6cd8d8e5f8d6b3b368d3ac128ac6 (patch)
tree9a2cd7fff6f9e796968703bf3bb2cb7ca5c5bf82 /ace/OS_NS_errno.inl
parenta288d4fc55907205181362fee9979dc5cd9b9d07 (diff)
downloadATCD-746f4ee6169d6cd8d8e5f8d6b3b368d3ac128ac6.tar.gz
ChangeLogTag:Sat Nov 1 05:40:21 UTC 2003 Don Hinton <dhinton@dresystems.com>
Diffstat (limited to 'ace/OS_NS_errno.inl')
-rw-r--r--ace/OS_NS_errno.inl62
1 files changed, 61 insertions, 1 deletions
diff --git a/ace/OS_NS_errno.inl b/ace/OS_NS_errno.inl
index fc532b41367..8e47ce38525 100644
--- a/ace/OS_NS_errno.inl
+++ b/ace/OS_NS_errno.inl
@@ -1,4 +1,64 @@
// -*- C++ -*-
// $Id$
-// This is a placeholder.
+ACE_INLINE int
+ACE_OS::last_error (void)
+{
+ // ACE_OS_TRACE ("ACE_OS::last_error");
+
+#if defined (ACE_WIN32)
+ int lerror = ::GetLastError ();
+ int lerrno = errno;
+ return lerrno == 0 ? lerror : lerrno;
+#else
+ return errno;
+#endif /* ACE_WIN32 */
+}
+
+ACE_INLINE void
+ACE_OS::last_error (int error)
+{
+ ACE_OS_TRACE ("ACE_OS::last_error");
+#if defined (ACE_WIN32)
+ ::SetLastError (error);
+#endif /* ACE_WIN32 */
+ errno = error;
+}
+
+ACE_INLINE int
+ACE_OS::set_errno_to_last_error (void)
+{
+# if defined (ACE_WIN32)
+// Borland C++ Builder 4 has a bug in the RTL that resets the
+// <GetLastError> value to zero when errno is accessed. Thus, we have
+// to use this to set errno to GetLastError. It's bad, but only for
+// WIN32.
+# if defined(__BORLANDC__) && (__BORLANDC__ == 0x540) || defined (__IBMCPP__) && (__IBMCPP__ >= 400)
+ int last_error = ::GetLastError ();
+ return errno = last_error;
+# else /* defined(__BORLANDC__) && (__BORLANDC__ == 0x540) */
+ return errno = ::GetLastError ();
+# endif /* defined(__BORLANDC__) && (__BORLANDC__ == 0x540) */
+#else
+ return errno;
+# endif /* defined(ACE_WIN32) */
+}
+
+ACE_INLINE int
+ACE_OS::set_errno_to_wsa_last_error (void)
+{
+# if defined (ACE_WIN32)
+// Borland C++ Builder 4 has a bug in the RTL that resets the
+// <GetLastError> value to zero when errno is accessed. Thus, we have
+// to use this to set errno to GetLastError. It's bad, but only for
+// WIN32
+# if defined(__BORLANDC__) && (__BORLANDC__ == 0x540) || defined (__IBMCPP__) && (__IBMCPP__ >= 400)
+ int last_error = ::WSAGetLastError ();
+ return errno = last_error;
+# else /* defined(__BORLANDC__) && (__BORLANDC__ == 0x540) */
+ return errno = ::WSAGetLastError ();
+# endif /* defined(__BORLANDC__) && (__BORLANDC__ == 0x540) */
+#else
+ return errno;
+# endif /* defined(ACE_WIN32) */
+}