OS_NS_errno.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   OS_NS_errno.h
00006  *
00007  *  OS_NS_errno.h,v 1.7 2005/11/24 09:48:54 ossama Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  *  @author Jesper S. M|ller<stophph@diku.dk>
00011  *  @author and a cast of thousands...
00012  *
00013  *  Originally in OS.h.
00014  */
00015 //=============================================================================
00016 
00017 #ifndef ACE_OS_NS_ERRNO_H
00018 # define ACE_OS_NS_ERRNO_H
00019 
00020 # include /**/ "ace/pre.h"
00021 
00022 # include "ace/config-lite.h"
00023 
00024 # if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 #  pragma once
00026 # endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #include "ace/os_include/os_errno.h"
00029 #include "ace/ACE_export.h"
00030 
00031 #if defined (ACE_EXPORT_MACRO)
00032 #  undef ACE_EXPORT_MACRO
00033 #endif
00034 #define ACE_EXPORT_MACRO ACE_Export
00035 
00036 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00037 
00038 namespace ACE_OS {
00039 
00040   ACE_NAMESPACE_INLINE_FUNCTION
00041   int last_error (void);
00042 
00043   ACE_NAMESPACE_INLINE_FUNCTION
00044   void last_error (int);
00045 
00046   ACE_NAMESPACE_INLINE_FUNCTION
00047   int set_errno_to_last_error (void);
00048 
00049   ACE_NAMESPACE_INLINE_FUNCTION
00050   int set_errno_to_wsa_last_error (void);
00051 
00052 } /* namespace ACE_OS */
00053 
00054 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
00055 /**
00056  * @class ACE_CE_Errno
00057  *
00058  * Some versions of CE don't support <errno> and some versions'
00059  * implementations are busted.  So we implement our own.
00060  * Our implementation takes up one Tls key, however, it does not
00061  * allocate memory fromt the heap so there's no problem with cleanin
00062  * up the errno when a thread exit.
00063  */
00064 class ACE_Export ACE_CE_Errno
00065 {
00066 public:
00067   ACE_CE_Errno () {}
00068   static void init ();
00069   static void fini ();
00070   static ACE_CE_Errno *instance ();
00071 
00072   operator int (void) const;
00073   int operator= (int);
00074 
00075 private:
00076   static ACE_CE_Errno *instance_;
00077   static DWORD errno_key_;
00078 };
00079 
00080 # define errno (* (ACE_CE_Errno::instance ()))
00081 #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
00082 
00083 #if defined (ACE_HAS_WINCE_BROKEN_ERRNO)
00084 #  define ACE_ERRNO_TYPE ACE_CE_Errno
00085 #else
00086 #  define ACE_ERRNO_TYPE int
00087 #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
00088 
00089 ACE_END_VERSIONED_NAMESPACE_DECL
00090 
00091 # if defined (ACE_HAS_INLINED_OSCALLS)
00092 #   if defined (ACE_INLINE)
00093 #     undef ACE_INLINE
00094 #   endif /* ACE_INLINE */
00095 #   define ACE_INLINE inline
00096 #   include "ace/OS_NS_errno.inl"
00097 # endif /* ACE_HAS_INLINED_OSCALLS */
00098 
00099 # include /**/ "ace/post.h"
00100 #endif /* ACE_OS_NS_ERRNO_H */

Generated on Thu Nov 9 09:41:57 2006 for ACE by doxygen 1.3.6