/usr/include/ace/OS_NS_macros.h is in libace-dev 6.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | // -*- C++ -*-
//=============================================================================
/**
* @file OS_NS_macros.h
*
* $Id: OS_NS_macros.h 80826 2008-03-04 14:51:23Z wotte $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
* @author Jesper S. M|ller<stophph@diku.dk>
* @author and a cast of thousands...
*
* Originally in OS.h.
*/
//=============================================================================
#ifndef ACE_OS_NS_MACROS_H
# define ACE_OS_NS_MACROS_H
# include /**/ "ace/pre.h"
# include "ace/config-all.h"
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined (ACE_WIN32)
# define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) \
do { TYPE ace_result_ = (TYPE) OP; \
if (ace_result_ == FAILVALUE) { int ___ = ::WSAGetLastError (); errno = ___; return (TYPE) FAILVALUE; } else return ace_result_; \
} while (0)
# define ACE_SOCKCALL(OP,TYPE,FAILVALUE,RESULT) \
do { RESULT = (TYPE) OP; \
if (RESULT == FAILVALUE) { int ___ = ::WSAGetLastError (); errno = ___; RESULT = FAILVALUE; } \
} while (0)
#else
# define ACE_SOCKCALL_RETURN(OP,TYPE,FAILVALUE) ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE)
# define ACE_SOCKCALL(OP,TYPE,FAILVALUE,RESULT) ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT)
#endif /* ACE_WIN32 */
#if !defined (ACE_WIN32)
// Adapt the weird threading and synchronization routines (which
// return errno rather than -1) so that they return -1 and set errno.
// This is more consistent with the rest of ACE_OS and enables us to
// use the ACE_OSCALL* macros.
# if defined (ACE_VXWORKS)
# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != OK ? (errno = RESULT, -1) : 0)
# else
# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) != 0 ? (errno = RESULT, -1) : 0)
# endif /* ACE_VXWORKS */
#else /* ACE_WIN32 */
// Adapt the Win32 System Calls (which return BOOLEAN values of TRUE
// and FALSE) into int values expected by the ACE_OSCALL macros.
# define ACE_ADAPT_RETVAL(OP,RESULT) ((RESULT = (OP)) == FALSE ? -1 : 0)
// Perform a mapping of Win32 error numbers into POSIX errnos.
# define ACE_FAIL_RETURN(RESULT) do { \
switch (ACE_OS::set_errno_to_last_error ()) { \
case ERROR_NOT_ENOUGH_MEMORY: errno = ENOMEM; break; \
case ERROR_FILE_EXISTS: errno = EEXIST; break; \
case ERROR_SHARING_VIOLATION: errno = EACCES; break; \
case ERROR_PATH_NOT_FOUND: errno = ENOENT; break; \
} \
return RESULT; } while (0)
#endif /* !ACE_WIN32 */
// Helper functions to split large intergers into smaller high-order
// and low-order parts, and reconstitute them again. These are
// required primarily for supporting _FILE_OFFSET_BITS==64 on windows.
#if defined(ACE_WIN32)
# if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS==64)
# include "ace/Basic_Types.h"
# define ACE_LOW_PART(X) static_cast<DWORD>(X)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
LONG
inline ACE_High_Part (ACE_OFF_T value)
{
LARGE_INTEGER new_value;
new_value.QuadPart = value;
return new_value.HighPart;
}
# define ACE_HIGH_PART(X) ACE_High_Part(X)
LONGLONG
inline ACE_Combine_Parts (LONG high, DWORD low)
{
LARGE_INTEGER value;
value.LowPart = low; // DWORD
value.HighPart = high; // LONG
return value.QuadPart;
}
ACE_END_VERSIONED_NAMESPACE_DECL
# define ACE_COMBINE_PARTS(X,Y) ACE_Combine_Parts(X,Y)
# else /* _FILE_OFFSET_BITS==64 */
# define ACE_LOW_PART(X) X
# define ACE_HIGH_PART(X) 0
# define ACE_COMBINE_PARTS(X,Y) X
# endif /* _FILE_OFFSET_BITS==64 */
#endif /* ACE_WIN32 */
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_MACROS_H */
|