1 #ifndef __XRDSYS_PLATFORM_H__ 2 #define __XRDSYS_PLATFORM_H__ 40 #include <sys/types.h> 41 #include <sys/param.h> 43 #define MAXNAMELEN NAME_MAX 47 #include <AvailabilityMacros.h> 48 #include <sys/types.h> 49 #include <sys/param.h> 50 #include <libkern/OSByteOrder.h> 51 #define fdatasync(x) fsync(x) 52 #define MAXNAMELEN NAME_MAX 54 # define dirent64 dirent 57 #define off64_t int64_t 59 #if (!defined(MAC_OS_X_VERSION_10_5) || \ 60 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5) 67 #if defined(__FreeBSD__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) 68 #include <sys/types.h> 69 #include <sys/param.h> 70 #if defined(__FreeBSD__) 71 #include <sys/endian.h> 75 #define MAXNAMELEN NAME_MAX 79 #include <sys/types.h> 80 #include <sys/param.h> 87 #define MAXNAMELEN 255 88 #define MAXPATHLEN 4096 89 #define MAXHOSTNAMELEN 64 93 #define MAXNAMELEN 256 94 #define MAXPATHLEN 1024 99 #if defined(__solaris__) && defined(__SunOS_5_10) 100 #define posix_memalign(memp, algn, sz) \ 101 ((*memp = memalign(algn, sz)) ? 0 : ENOMEM) 102 #define __USE_LEGACY_PROTOTYPES__ 1 105 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__)) 109 #define STATFS statfs 110 #define STATFS_BUFF struct statfs 114 #define FLOCK_t struct flock 116 typedef off_t offset_t;
118 #define GTZ_NULL (struct timezone *)0 122 #define STATFS statvfs 123 #define STATFS_BUFF struct statvfs 127 #define SHMDT_t char * 129 #define FLOCK_t flock_t 131 #define GTZ_NULL (void *)0 137 #define SHMDT_t const void * 152 #define O_LARGEFILE 0 153 #define SHMDT_t void * 155 #define EDEADLOCK EDEADLK 160 #define O_LARGEFILE 0 161 typedef off_t off64_t;
164 #if defined(__APPLE__) 165 #define bswap_16 OSSwapInt16 166 #define bswap_32 OSSwapInt32 167 #define bswap_64 OSSwapInt64 170 #if defined(__FreeBSD__) 171 #define bswap_16 bswap16 172 #define bswap_32 bswap32 173 #define bswap_64 bswap64 176 static inline uint16_t
bswap(uint16_t x) {
return bswap_16(x); }
177 static inline uint32_t
bswap(uint32_t x) {
return bswap_32(x); }
178 static inline uint64_t
bswap(uint64_t x) {
return bswap_64(x); }
183 #if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || \ 184 defined(__IEEE_BIG_ENDIAN) || \ 185 (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) 186 #define Xrd_Big_Endian 188 #define htonll(_x_) _x_ 191 #define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long)) 194 #define ntohll(_x_) _x_ 197 #define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long)) 200 #elif defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) || \ 201 defined(__IEEE_LITTLE_ENDIAN) || \ 202 (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) 203 #if !defined(__GNUC__) || defined(__APPLE__) 205 #if !defined(__sun) || (defined(__sun) && (!defined(_LP64) || defined(__SunOS_5_10))) 206 extern "C" unsigned long long Swap_n2hll(
unsigned long long x);
208 #define htonll(_x_) Swap_n2hll(_x_) 211 #define ntohll(_x_) Swap_n2hll(_x_) 218 #define htonll(_x_) __bswap_64(_x_) 221 #define ntohll(_x_) __bswap_64(_x_) 227 #define h2nll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\ 231 #define n2hll(_x_, _y_) memcpy((void *)&_y_,(const void *)&_x_,sizeof(long long));\ 237 #error Unable to determine target architecture endianness! 243 {
extern size_t strlcpy(
char *dst,
const char *src,
size_t size);}
249 #if defined(__solaris__) && !defined(__linux__) 250 # if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90 254 #if defined(__linux__) 255 # include <features.h> 256 # if __GNU_LIBRARY__ == 6 265 #if defined(_AIX) || \ 266 (defined(XR__SUNGCC3) && !defined(__arch64__)) 267 # define SOCKLEN_t size_t 268 #elif !defined(SOCKLEN_t) 269 # define SOCKLEN_t socklen_t 273 #define PTR2INT(x) static_cast<int>((long long)x) 275 #define PTR2INT(x) int(x) 279 #include "XrdSys/XrdWin32.hh" 280 #define Netdata_t void * 281 #define Sokdata_t char * 282 #define IOV_INIT(data,dlen) dlen,data 283 #define MAKEDIR(path,mode) mkdir(path) 284 #define CHMOD(path, mode) {} 285 #define net_errno WSAGetLastError() 288 #define Netdata_t char * 289 #define Sokdata_t void * 290 #define IOV_INIT(data,dlen) data,dlen 291 #define MAKEDIR(path,mode) mkdir(path,mode) 292 #define CHMOD(path, mode) chmod(path,mode) 293 #define net_errno errno 298 #define XRDABS(x) (x < 0 ? -x : x) 300 #ifndef LT_MODULE_EXT 301 #define LT_MODULE_EXT ".so" 304 #endif // __XRDSYS_PLATFORM_H__