Go to the documentation of this file. 1 #ifndef __XRDSYS_PLATFORM_H__
2 #define __XRDSYS_PLATFORM_H__
21 #include <sys/types.h>
22 #include <asm/param.h>
24 #define MAXNAMELEN NAME_MAX
27 #include <AvailabilityMacros.h>
28 #include <sys/types.h>
29 #define fdatasync(x) fsync(x)
30 #define MAXNAMELEN NAME_MAX
32 # define dirent64 dirent
35 #define off64_t int64_t
37 #if (!defined(MAC_OS_X_VERSION_10_5) || \
38 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
45 #include <sys/types.h>
49 #define posix_memalign(memp, algn, sz) \
50 ((*memp = memalign(algn, sz)) ? 0 : ENOMEM)
53 #if defined(__linux__) || defined(__macos__) || defined(__FreeBSD__)
57 #define F_DUP2FD F_DUPFD
60 #define STATFS_BUFF struct statfs
64 #define FLOCK_t struct flock
66 typedef off_t offset_t;
68 #define GTZ_NULL (struct timezone *)0
72 #define STATFS statvfs
73 #define STATFS_BUFF struct statvfs
77 #define SHMDT_t char *
79 #define FLOCK_t flock_t
81 #define GTZ_NULL (void *)0
87 #define SHMDT_t const void *
93 #include <AvailabilityMacros.h>
103 #define O_LARGEFILE 0
104 #define memalign(pgsz,amt) valloc(amt)
105 #define posix_memalign(memp, algn, sz) \
106 ((*memp = memalign(algn, sz)) ? 0 : ENOMEM)
107 #define SHMDT_t void *
109 #define EDEADLOCK EDEADLK
114 #define O_LARGEFILE 0
115 typedef off_t off64_t;
116 #define memalign(pgsz,amt) valloc(amt)
122 #if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \
123 defined(__IEEE_BIG_ENDIAN) || \
124 (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN)
125 #define Xrd_Big_Endian
127 #define htonll(_x_) _x_
130 #define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long))
133 #define ntohll(_x_) _x_
136 #define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long))
139 #elif defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || \
140 defined(__IEEE_LITTLE_ENDIAN) || \
141 (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)
142 #if !defined(__GNUC__) || defined(__macos__)
144 #if !defined(__sun) || (defined(__sun) && (!defined(_LP64) || defined(__SunOS_5_10)))
145 extern "C" unsigned long long Swap_n2hll(
unsigned long long x);
147 #define htonll(_x_) Swap_n2hll(_x_)
150 #define ntohll(_x_) Swap_n2hll(_x_)
157 #define htonll(_x_) __bswap_64(_x_)
160 #define ntohll(_x_) __bswap_64(_x_)
166 #define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\
170 #define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\
176 #error Unable to determine target architecture endianness!
182 {
extern size_t strlcpy(
char *dst,
const char *src,
size_t size);}
188 #if defined(__solaris__) && !defined(__linux__)
189 # if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90
193 #if defined(__linux__)
194 # include <features.h>
195 # if __GNU_LIBRARY__ == 6
201 #if defined(__MACH__) && defined(__i386__)
204 #if defined(_AIX) || \
205 (defined(XR__SUNGCC3) && !defined(__arch64__))
206 # define SOCKLEN_t size_t
207 #elif defined(XR__GLIBC) || \
208 defined(__FreeBSD__) || \
209 (defined(XR__SUNGCC3) && defined(__arch64__)) || defined(__macos__) || \
210 (defined(__sun) && defined(_SOCKLEN_T))
212 # define SOCKLEN_t socklen_t
214 #elif !defined(SOCKLEN_t)
215 # define SOCKLEN_t int
219 #define PTR2INT(x) static_cast<int>((long long)x)
221 #define PTR2INT(x) int(x)
225 #include "XrdSys/XrdWin32.hh"
226 #define Netdata_t void *
227 #define Sokdata_t char *
228 #define IOV_INIT(data,dlen) dlen,data
229 #define MAKEDIR(path,mode) mkdir(path)
230 #define net_errno WSAGetLastError()
233 #define Netdata_t char *
234 #define Sokdata_t void *
235 #define IOV_INIT(data,dlen) data,dlen
236 #define MAKEDIR(path,mode) mkdir(path,mode)
237 #define net_errno errno
241 #define MAXNAMELEN 256
242 #define MAXPATHLEN 1024
244 #include <sys/param.h>
248 #define XRDABS(x) (x < 0 ? -x : x)
250 #ifndef LT_MODULE_EXT
251 #define LT_MODULE_EXT ".so"
254 #endif // __XRDSYS_PLATFORM_H__