3 //=============================================================================
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Jesper S. M|ller<stophph@diku.dk>
9 * @author and a cast of thousands...
13 //=============================================================================
15 #ifndef ACE_OS_NS_ERRNO_H
16 # define ACE_OS_NS_ERRNO_H
18 # include /**/ "ace/pre.h"
20 # include "ace/config-lite.h"
22 # if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # endif /* ACE_LACKS_PRAGMA_ONCE */
26 #include "ace/os_include/os_errno.h"
27 #include /**/ "ace/ACE_export.h"
29 #if defined (ACE_EXPORT_MACRO)
30 # undef ACE_EXPORT_MACRO
32 #define ACE_EXPORT_MACRO ACE_Export
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
38 ACE_NAMESPACE_INLINE_FUNCTION
39 int last_error (void);
41 ACE_NAMESPACE_INLINE_FUNCTION
42 void last_error (int error
);
44 ACE_NAMESPACE_INLINE_FUNCTION
45 int set_errno_to_last_error (void);
47 ACE_NAMESPACE_INLINE_FUNCTION
48 int set_errno_to_wsa_last_error (void);
51 int mqx_error_to_errno(int mqx_error
);
54 } /* namespace ACE_OS */
56 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
60 * Some versions of CE don't support @c errno and some versions'
61 * implementations are busted. So we implement our own.
62 * Our implementation takes up one Tls key, however, it does not
63 * allocate memory from the heap so there's no problem with cleaning
64 * up the errno when a thread exit.
66 class ACE_Export ACE_CE_Errno
72 static ACE_CE_Errno
*instance ();
74 operator int (void) const;
78 static ACE_CE_Errno
*instance_
;
79 static DWORD errno_key_
;
82 # define errno (* (ACE_CE_Errno::instance ()))
83 #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
85 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
86 # define ACE_ERRNO_TYPE ACE_CE_Errno
87 # define ACE_ERRNO_GET ACE_CE_Errno::instance ()->operator int()
89 # if !defined (ACE_ERRNO_TYPE)
90 # define ACE_ERRNO_TYPE int
91 # endif /* !ACE_ERRNO_TYPE */
92 # define ACE_ERRNO_GET errno
93 #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
95 ACE_END_VERSIONED_NAMESPACE_DECL
97 # if defined (ACE_HAS_INLINED_OSCALLS)
98 # if defined (ACE_INLINE)
100 # endif /* ACE_INLINE */
101 # define ACE_INLINE inline
102 # include "ace/OS_NS_errno.inl"
103 # endif /* ACE_HAS_INLINED_OSCALLS */
105 # include /**/ "ace/post.h"
106 #endif /* ACE_OS_NS_ERRNO_H */