Go to the documentation of this file. 1 #ifndef __XRDSYS_PLATFORM_H__
2 #define __XRDSYS_PLATFORM_H__
38 #include <sys/types.h>
39 #include <asm/param.h>
41 #define MAXNAMELEN NAME_MAX
44 #include <AvailabilityMacros.h>
45 #include <sys/types.h>
46 #define fdatasync(x) fsync(x)
47 #define MAXNAMELEN NAME_MAX
49 # define dirent64 dirent
52 #define off64_t int64_t
54 #if (!defined(MAC_OS_X_VERSION_10_5) || \
55 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
62 #include <sys/types.h>
66 #define posix_memalign(memp, algn, sz) \
67 ((*memp = memalign(algn, sz)) ? 0 : ENOMEM)
70 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
74 #define F_DUP2FD F_DUPFD
77 #define STATFS_BUFF struct statfs
81 #define FLOCK_t struct flock
83 typedef off_t offset_t;
85 #define GTZ_NULL (struct timezone *)0
89 #define STATFS statvfs
90 #define STATFS_BUFF struct statvfs
94 #define SHMDT_t char *
96 #define FLOCK_t flock_t
98 #define GTZ_NULL (void *)0
104 #define SHMDT_t const void *
110 #include <AvailabilityMacros.h>
120 #define O_LARGEFILE 0
121 #define memalign(pgsz,amt) valloc(amt)
122 #define posix_memalign(memp, algn, sz) \
123 ((*memp = memalign(algn, sz)) ? 0 : ENOMEM)
124 #define SHMDT_t void *
126 #define EDEADLOCK EDEADLK
131 #define O_LARGEFILE 0
132 typedef off_t off64_t;
133 #define memalign(pgsz,amt) valloc(amt)
139 #if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \
140 defined(__IEEE_BIG_ENDIAN) || \
141 (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN)
142 #define Xrd_Big_Endian
144 #define htonll(_x_) _x_
147 #define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long))
150 #define ntohll(_x_) _x_
153 #define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long))
156 #elif defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || \
157 defined(__IEEE_LITTLE_ENDIAN) || \
158 (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)
159 #if !defined(__GNUC__) || defined(__APPLE__)
161 #if !defined(__sun) || (defined(__sun) && (!defined(_LP64) || defined(__SunOS_5_10)))
162 extern "C" unsigned long long Swap_n2hll(
unsigned long long x);
164 #define htonll(_x_) Swap_n2hll(_x_)
167 #define ntohll(_x_) Swap_n2hll(_x_)
174 #define htonll(_x_) __bswap_64(_x_)
177 #define ntohll(_x_) __bswap_64(_x_)
183 #define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\
187 #define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\
193 #error Unable to determine target architecture endianness!
199 {
extern size_t strlcpy(
char *dst,
const char *src,
size_t size);}
205 #if defined(__solaris__) && !defined(__linux__)
206 # if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90
210 #if defined(__linux__)
211 # include <features.h>
212 # if __GNU_LIBRARY__ == 6
218 #if defined(__MACH__) && defined(__i386__)
221 #if defined(_AIX) || \
222 (defined(XR__SUNGCC3) && !defined(__arch64__))
223 # define SOCKLEN_t size_t
224 #elif defined(XR__GLIBC) || \
225 defined(__FreeBSD__) || \
226 (defined(XR__SUNGCC3) && defined(__arch64__)) || defined(__APPLE__) || \
227 (defined(__sun) && defined(_SOCKLEN_T))
229 # define SOCKLEN_t socklen_t
231 #elif !defined(SOCKLEN_t)
232 # define SOCKLEN_t int
236 #define PTR2INT(x) static_cast<int>((long long)x)
238 #define PTR2INT(x) int(x)
242 #include "XrdSys/XrdWin32.hh"
243 #define Netdata_t void *
244 #define Sokdata_t char *
245 #define IOV_INIT(data,dlen) dlen,data
246 #define MAKEDIR(path,mode) mkdir(path)
247 #define net_errno WSAGetLastError()
250 #define Netdata_t char *
251 #define Sokdata_t void *
252 #define IOV_INIT(data,dlen) data,dlen
253 #define MAKEDIR(path,mode) mkdir(path,mode)
254 #define net_errno errno
258 #define MAXNAMELEN 256
259 #define MAXPATHLEN 1024
261 #include <sys/param.h>
265 #define XRDABS(x) (x < 0 ? -x : x)
267 #ifndef LT_MODULE_EXT
268 #define LT_MODULE_EXT ".so"
271 #endif // __XRDSYS_PLATFORM_H__