31 #if defined(__clang__) && defined(_FORTIFY_SOURCE)
32 #undef _FORTIFY_SOURCE
35 #if defined(__APPLE__)
36 #define _DARWIN_USE_64_BIT_INODE 1
39 #include <sys/types.h>
79 namespace {
bool isLite = (getenv(
"XRD_POSIX_PRELOAD_LITE") != 0);}
87 int access(
const char *path,
int amode)
103 int acl(
const char *path,
int cmd,
int nentries,
void *aclbufp)
194 theArg = va_arg(ap,
void *);
204 #if !defined(__APPLE__)
236 FILE *
fopen64(
const char *path,
const char *mode)
250 size_t fread(
void *ptr,
size_t size,
size_t nitems, FILE *stream)
264 int fseek(FILE *stream,
long offset,
int whence)
278 int fseeko64(FILE *stream, off64_t offset,
int whence)
292 #if defined(__linux__) && defined(_STAT_VER) && __GNUC__ && __GNUC__ >= 2
293 int __fxstat64(
int ver,
int fildes,
struct stat64 *buf)
299 #if defined(__linux__) && defined(_STAT_VER) && __GNUC__ && __GNUC__ >= 2
381 size_t fwrite(
const void *ptr,
size_t size,
size_t nitems, FILE *stream)
393 #if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
396 ssize_t
fgetxattr (
int fd,
const char *name,
void *value,
size_t size)
400 return XrdPosix_Fgetxattr(fd, name, value, size);
409 #if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
412 ssize_t
getxattr (
const char *path,
const char *name,
void *value,
size_t size)
416 return XrdPosix_Getxattr(path, name, value, size);
425 #if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
428 ssize_t
lgetxattr (
const char *path,
const char *name,
void *value,
size_t size)
432 return XrdPosix_Lgetxattr(path, name, value, size);
443 off64_t
lseek64(
int fildes, off64_t offset,
int whence)
457 #if defined(__linux__) || defined(__APPLE__)
458 off_t
llseek(
int fildes, off_t offset,
int whence)
460 offset_t
llseek(
int fildes, offset_t offset,
int whence)
475 #if defined __linux__ && defined(_STAT_VER) && __GNUC__ && __GNUC__ >= 2
476 int __lxstat64(
int ver,
const char *path,
struct stat64 *buf)
492 int mkdir(
const char *path, mode_t mode)
506 int open64(
const char *path,
int oflag, ...)
513 mode = va_arg(ap,
int);
532 mode = va_arg(ap,
int);
574 ssize_t
pread64(
int fildes,
void *buf,
size_t nbyte, off_t offset)
588 ssize_t
pwrite64(
int fildes,
const void *buf,
size_t nbyte, off_t offset)
602 ssize_t
read(
int fildes,
void *buf,
size_t nbyte)
616 ssize_t
readv(
int fildes,
const struct iovec *
iov,
int iovcnt)
644 int readdir64_r(DIR *dirp,
struct dirent64 *entry,
struct dirent64 **result)
659 int rename(
const char *oldpath,
const char *newpath)
717 #if defined __linux__ && defined(_STAT_VER) && __GNUC__ && __GNUC__ >= 2
718 int __xstat64(
int ver,
const char *path,
struct stat64 *buf)
733 #if !defined(__solaris__)
765 int statx(
int dirfd,
const char *path,
int flags,
766 unsigned int mask,
struct statx *stx)
794 int truncate64(
const char *path, off_t offset)
808 int unlink(
const char *path)
822 ssize_t
write(
int fildes,
const void *buf,
size_t nbyte)
836 ssize_t
writev(
int fildes,
const struct iovec *
iov,
int iovcnt)
int chdir(const char *path)
int openat(int dirfd, const char *path, int flag,...)
ssize_t pwrite64(int fildes, const void *buf, size_t nbyte, off_t offset)
off64_t lseek64(int fildes, off64_t offset, int whence)
offset_t llseek(int fildes, offset_t offset, int whence)
int fseeko64(FILE *stream, off64_t offset, int whence)
int statvfs64(const char *path, struct statvfs64 *buf)
int acl(const char *path, int cmd, int nentries, void *aclbufp)
off64_t ftello64(FILE *stream)
ssize_t pread64(int fildes, void *buf, size_t nbyte, off_t offset)
size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream)
int rename(const char *oldpath, const char *newpath)
int fcntl64(int fd, int cmd,...)
FILE * fopen64(const char *path, const char *mode)
int mkdir(const char *path, mode_t mode)
int fseek(FILE *stream, long offset, int whence)
int statfs64(const char *path, struct statfs64 *buf)
ssize_t readv(int fildes, const struct iovec *iov, int iovcnt)
void seekdir(DIR *dirp, long loc)
int readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
int fstat64(int fildes, struct stat64 *buf)
struct dirent64 * readdir64(DIR *dirp)
int ftruncate64(int fildes, off_t offset)
long pathconf(const char *path, int name)
int access(const char *path, int amode)
int rmdir(const char *path)
int creat64(const char *path, mode_t mode)
int lstat64(const char *path, struct stat64 *buf)
void rewinddir(DIR *dirp)
int open64(const char *path, int oflag,...)
ssize_t read(int fildes, void *buf, size_t nbyte)
int fstatat64(int dirfd, const char *path, struct stat64 *buf, int flags)
int fdatasync(int fildes)
int stat64(const char *path, struct stat64 *buf)
DIR * opendir(const char *path)
int XrdPosix_Statfs(const char *path, struct statfs *buf)
int XrdPosix_Truncate(const char *path, off_t offset)
ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte)
int XrdPosix_Closedir(DIR *dirp)
int XrdPosix_Fsync(int fildes)
ssize_t XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt)
long long XrdPosix_Ftello(FILE *stream)
int XrdPosix_Open(const char *path, int oflag,...)
void XrdPosix_Rewinddir(DIR *dirp)
ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte, off_t offset)
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
int XrdPosix_Close(int fildes)
int XrdPosix_Openat(int dirfd, const char *path, int flag,...)
void XrdPosix_Seekdir(DIR *dirp, long loc)
int XrdPosix_Rmdir(const char *path)
int XrdPosix_Chdir(const char *path)
FILE * XrdPosix_Fopen(const char *path, const char *mode)
int XrdPosix_Stat(const char *path, struct stat *buf)
int XrdPosix_Rename(const char *oldpath, const char *newpath)
int XrdPosix_Fcntl(int fd, int cmd,...)
int XrdPosix_Fseek(FILE *stream, long offset, int whence)
long XrdPosix_Ftell(FILE *stream)
int XrdPosix_Mkdir(const char *path, mode_t mode)
int XrdPosix_Fflush(FILE *stream)
ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt)
DIR * XrdPosix_Opendir(const char *path)
long XrdPosix_Telldir(DIR *dirp)
int XrdPosix_FstatV(int ver, int fildes, struct stat *buf)
ssize_t XrdPosix_Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset)
int XrdPosix_Lstat(const char *path, struct stat *buf)
int XrdPosix_Fstatat(int dirfd, const char *path, struct stat *buf, int flags)
int XrdPosix_Creat(const char *path, mode_t mode)
int XrdPosix_Statx(int dirfd, const char *path, int flags, unsigned int mask, XrdSysStatx *stx)
int XrdPosix_Statvfs(const char *path, struct statvfs *buf)
int XrdPosix_Acl(const char *path, int cmd, int nentries, void *aclbufp)
int XrdPosix_Fstat(int fildes, struct stat *buf)
off_t XrdPosix_Lseek(int fildes, off_t offset, int whence)
ssize_t XrdPosix_Write(int fildes, const void *buf, size_t nbyte)
size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
int XrdPosix_Fclose(FILE *stream)
int XrdPosix_Fdatasync(int fildes)
int XrdPosix_Ftruncate(int fildes, long long offset)
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
long XrdPosix_Pathconf(const char *path, int name)
int XrdPosix_Unlink(const char *path)
size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream)
int XrdPosix_Fseeko(FILE *stream, long long offset, int whence)
int XrdPosix_Access(const char *path, int amode)
#define getxattr(a, b, c, d)
#define fgetxattr(a, b, c, d)
#define statx(d, p, f, m, b)
#define lgetxattr(a, b, c, d)
Retv_Opendir(* Opendir)(Args_Opendir)
Retv_Mkdir(* Mkdir)(Args_Mkdir)
Retv_Readdir64(* Readdir64)(Args_Readdir64)
Retv_Rename(* Rename)(Args_Rename)
Retv_Rewinddir(* Rewinddir)(Args_Rewinddir)
Retv_Telldir(* Telldir)(Args_Telldir)
Retv_Readdir64_r(* Readdir64_r)(Args_Readdir64_r)
Retv_Seekdir(* Seekdir)(Args_Seekdir)
Retv_Chdir(* Chdir)(Args_Chdir)
Retv_Closedir(* Closedir)(Args_Closedir)
Retv_Rmdir(* Rmdir)(Args_Rmdir)
Retv_Unlink(* Unlink)(Args_Unlink)