gnuace: use list of generated files from GENERATED_DIRTY for ADDITIONAL_IDL_TARGETS
[ACE_TAO.git] / ACE / ace / OS_NS_errno.h
bloba240a7fa9ffa3047bb18a55ae562b84dab69a1bf
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file OS_NS_errno.h
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...
11 * Originally in OS.h.
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)
23 # 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
31 #endif
32 #define ACE_EXPORT_MACRO ACE_Export
34 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
36 namespace ACE_OS {
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);
50 #ifdef ACE_MQX
51 int mqx_error_to_errno(int mqx_error);
52 #endif
54 } /* namespace ACE_OS */
56 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
57 /**
58 * @class ACE_CE_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
68 public:
69 ACE_CE_Errno () {}
70 static void init ();
71 static void fini ();
72 static ACE_CE_Errno *instance ();
74 operator int (void) const;
75 int operator= (int);
77 private:
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()
88 #else
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)
99 # undef 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 */