00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ACE_OS_ERRNO_H
00014 #define ACE_OS_ERRNO_H
00015 #include "ace/pre.h"
00016
00017 #include "ace/OS_Export.h"
00018
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif
00022
00023 #if defined (ACE_HAS_H_ERRNO)
00024 void herror (const char *str);
00025 #endif
00026
00027 #if !defined (ACE_HAS_WINCE)
00028 # include <errno.h>
00029 #endif
00030
00031 #if !defined (ACE_WIN32) && !defined (ACE_PSOS) && defined (ACE_LACKS_T_ERRNO)
00032 extern int t_errno;
00033 #endif
00034
00035 #if !defined (ENOSYS)
00036 # define ENOSYS EFAULT
00037 #endif
00038
00039 #if !defined (ENOTSUP)
00040 # define ENOTSUP ENOSYS
00041 #endif
00042
00043 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class ACE_OS_Export ACE_CE_Errno
00054 {
00055 public:
00056 ACE_CE_Errno () {}
00057 static void init ();
00058 static void fini ();
00059 static ACE_CE_Errno *instance ();
00060
00061 operator int (void) const;
00062 int operator= (int);
00063
00064 private:
00065 static ACE_CE_Errno *instance_;
00066 static DWORD errno_key_;
00067 };
00068
00069 # define errno (* (ACE_CE_Errno::instance ()))
00070 #endif
00071
00072 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
00073 # define ACE_ERRNO_TYPE ACE_CE_Errno
00074 #else
00075 # define ACE_ERRNO_TYPE int
00076 #endif
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 class ACE_OS_Export ACE_Errno_Guard
00098 {
00099 public:
00100
00101
00102 ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref,
00103 int error);
00104
00105
00106
00107 ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref);
00108
00109
00110 ~ACE_Errno_Guard (void);
00111
00112 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
00113
00114 int operator= (const ACE_ERRNO_TYPE &errno_ref);
00115 #endif
00116
00117
00118 int operator= (int error);
00119
00120
00121 int operator== (int error);
00122
00123
00124 int operator!= (int error);
00125
00126 private:
00127 #if defined (ACE_MT_SAFE)
00128 ACE_ERRNO_TYPE *errno_ptr_;
00129 #endif
00130 int error_;
00131 };
00132
00133 #if defined (ACE_HAS_INLINED_OSCALLS)
00134 # if defined (ACE_INLINE)
00135 # undef ACE_INLINE
00136 # endif
00137 # define ACE_INLINE inline
00138 # include "ace/OS_Errno.inl"
00139 #endif
00140
00141 #include "ace/post.h"
00142 #endif