3 //=============================================================================
7 * $Id: OS_NS_errno.h 81286 2008-04-09 07:27:30Z johnnyw $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
10 * @author Jesper S. M|ller<stophph@diku.dk>
11 * @author and a cast of thousands...
15 //=============================================================================
17 #ifndef ACE_OS_NS_ERRNO_H
18 # define ACE_OS_NS_ERRNO_H
20 # include /**/ "ace/pre.h"
22 # include "ace/config-lite.h"
24 # if !defined (ACE_LACKS_PRAGMA_ONCE)
26 # endif /* ACE_LACKS_PRAGMA_ONCE */
28 #include "ace/os_include/os_errno.h"
29 #include /**/ "ace/ACE_export.h"
31 #if defined (ACE_EXPORT_MACRO)
32 # undef ACE_EXPORT_MACRO
34 #define ACE_EXPORT_MACRO ACE_Export
36 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
40 ACE_NAMESPACE_INLINE_FUNCTION
41 int last_error (void);
43 ACE_NAMESPACE_INLINE_FUNCTION
44 void last_error (int error
);
46 ACE_NAMESPACE_INLINE_FUNCTION
47 int set_errno_to_last_error (void);
49 ACE_NAMESPACE_INLINE_FUNCTION
50 int set_errno_to_wsa_last_error (void);
52 } /* namespace ACE_OS */
54 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
58 * Some versions of CE don't support @c errno and some versions'
59 * implementations are busted. So we implement our own.
60 * Our implementation takes up one Tls key, however, it does not
61 * allocate memory fromt the heap so there's no problem with cleanin
62 * up the errno when a thread exit.
64 class ACE_Export ACE_CE_Errno
70 static ACE_CE_Errno
*instance ();
72 operator int (void) const;
76 static ACE_CE_Errno
*instance_
;
77 static DWORD errno_key_
;
80 # define errno (* (ACE_CE_Errno::instance ()))
81 #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
83 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
84 # define ACE_ERRNO_TYPE ACE_CE_Errno
86 # define ACE_ERRNO_TYPE int
87 #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
89 ACE_END_VERSIONED_NAMESPACE_DECL
91 # if defined (ACE_HAS_INLINED_OSCALLS)
92 # if defined (ACE_INLINE)
94 # endif /* ACE_INLINE */
95 # define ACE_INLINE inline
96 # include "ace/OS_NS_errno.inl"
97 # endif /* ACE_HAS_INLINED_OSCALLS */
99 # include /**/ "ace/post.h"
100 #endif /* ACE_OS_NS_ERRNO_H */