1#ifndef __XRDSYS_PLATFORM_H__
2#define __XRDSYS_PLATFORM_H__
42#define MAXNAMELEN NAME_MAX
46#include <AvailabilityMacros.h>
49#define fdatasync(x) fsync(x)
50#define MAXNAMELEN NAME_MAX
52# define dirent64 dirent
55#define off64_t int64_t
57#if (!defined(MAC_OS_X_VERSION_10_5) || \
58 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
65#if defined(__FreeBSD__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
68#define MAXNAMELEN NAME_MAX
80#define MAXPATHLEN 4096
81#define MAXHOSTNAMELEN 64
86#define MAXPATHLEN 1024
91#if defined(__solaris__) && defined(__SunOS_5_10)
92#define posix_memalign(memp, algn, sz) \
93 ((*memp = memalign(algn, sz)) ? 0 : ENOMEM)
94#define __USE_LEGACY_PROTOTYPES__ 1
97#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
102#define STATFS_BUFF struct statfs
106#define FLOCK_t struct flock
108typedef off_t offset_t;
110#define GTZ_NULL (struct timezone *)0
114#define STATFS statvfs
115#define STATFS_BUFF struct statvfs
119#define SHMDT_t char *
121#define FLOCK_t flock_t
123#define GTZ_NULL (void *)0
129#define SHMDT_t const void *
145#define SHMDT_t void *
147#define EDEADLOCK EDEADLK
153typedef off_t off64_t;
159#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \
160 defined(__IEEE_BIG_ENDIAN) || \
161 (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN)
162#define Xrd_Big_Endian
164#define htonll(_x_) _x_
167#define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long))
170#define ntohll(_x_) _x_
173#define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long))
176#elif defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || \
177 defined(__IEEE_LITTLE_ENDIAN) || \
178 (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)
179#if !defined(__GNUC__) || defined(__APPLE__)
181#if !defined(__sun) || (defined(__sun) && (!defined(_LP64) || defined(__SunOS_5_10)))
182extern "C" unsigned long long Swap_n2hll(
unsigned long long x);
184#define htonll(_x_) Swap_n2hll(_x_)
187#define ntohll(_x_) Swap_n2hll(_x_)
194#define htonll(_x_) __bswap_64(_x_)
197#define ntohll(_x_) __bswap_64(_x_)
203#define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\
207#define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\
213#error Unable to determine target architecture endianness!
219{
extern size_t strlcpy(
char *dst,
const char *src,
size_t size);}
225#if defined(__solaris__) && !defined(__linux__)
226# if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90
230#if defined(__linux__)
231# include <features.h>
232# if __GNU_LIBRARY__ == 6
241#if defined(_AIX) || \
242 (defined(XR__SUNGCC3) && !defined(__arch64__))
243# define SOCKLEN_t size_t
244#elif defined(XR__GLIBC) || \
245 defined(__FreeBSD__) || \
246 (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) || \
247 (defined(XR__SUNGCC3) && defined(__arch64__)) || defined(__APPLE__) || \
248 (defined(__sun) && defined(_SOCKLEN_T))
250# define SOCKLEN_t socklen_t
252#elif !defined(SOCKLEN_t)
253# define SOCKLEN_t int
257#define PTR2INT(x) static_cast<int>((long long)x)
259#define PTR2INT(x) int(x)
263#include "XrdSys/XrdWin32.hh"
264#define Netdata_t void *
265#define Sokdata_t char *
266#define IOV_INIT(data,dlen) dlen,data
267#define MAKEDIR(path,mode) mkdir(path)
268#define CHMOD(path, mode) {}
269#define net_errno WSAGetLastError()
272#define Netdata_t char *
273#define Sokdata_t void *
274#define IOV_INIT(data,dlen) data,dlen
275#define MAKEDIR(path,mode) mkdir(path,mode)
276#define CHMOD(path, mode) chmod(path,mode)
277#define net_errno errno
282#define XRDABS(x) (x < 0 ? -x : x)
285#define LT_MODULE_EXT ".so"