00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef ACE_OS_NS_MACROS_H
00018 # define ACE_OS_NS_MACROS_H
00019
00020 # include "ace/pre.h"
00021
00022 # include "ace/config-all.h"
00023
00024 # if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 # endif
00027
00028 #if defined (ACE_WIN32)
00029 # define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) \
00030 do { TYPE ace_result_ = (TYPE) OP; \
00031 if (ace_result_ == FAILVALUE) { int ___ = ::WSAGetLastError (); errno = ___; return (TYPE) FAILVALUE; } else return ace_result_; \
00032 } while (0)
00033 # define ACE_SOCKCALL(OP,TYPE,FAILVALUE,RESULT) \
00034 do { RESULT = (TYPE) OP; \
00035 if (RESULT == FAILVALUE) { int ___ = ::WSAGetLastError (); errno = ___; RESULT = FAILVALUE; } \
00036 } while (0)
00037 #else
00038 # define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE)
00039 # define ACE_SOCKCALL(OP,TYPE,FAILVALUE,RESULT) ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT)
00040 #endif
00041
00042 #if !defined (ACE_WIN32)
00043
00044
00045
00046
00047
00048 # if defined (ACE_VXWORKS)
00049 # define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != OK ? (errno = RESULT, -1) : 0)
00050 # else
00051 # define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != 0 ? (errno = RESULT, -1) : 0)
00052 # endif
00053
00054 #else
00055
00056
00057
00058 # define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) == FALSE ? -1 : 0)
00059
00060
00061 # define ACE_FAIL_RETURN(RESULT) do { \
00062 switch (ACE_OS::set_errno_to_last_error ()) { \
00063 case ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM; break; \
00064 case ERROR_FILE_EXISTS: errno = EEXIST; break; \
00065 case ERROR_SHARING_VIOLATION: errno = EACCES; break; \
00066 case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; \
00067 } \
00068 return RESULT; } while (0)
00069
00070 #endif
00071
00072 # include "ace/post.h"
00073
00074 #endif