diff --git a/docs/PreReleaseNotes.txt b/docs/PreReleaseNotes.txt index f137df6fce3..e7dc96d486a 100644 --- a/docs/PreReleaseNotes.txt +++ b/docs/PreReleaseNotes.txt @@ -10,6 +10,7 @@ Prerelease Notes * **{Server]** Add org and role types to AuthDB authorization. * **[Server]** Handle systemd socket inheritance. * **[Proxy/Posix]** Allow Name2Name to populate cache using the LFN. + * **[Posix]** enable LITE feature in Posix preload library. + **Major bug fixes** diff --git a/src/XrdPosix/XrdPosixPreload.cc b/src/XrdPosix/XrdPosixPreload.cc index 10491f5e828..f37d8166611 100644 --- a/src/XrdPosix/XrdPosixPreload.cc +++ b/src/XrdPosix/XrdPosixPreload.cc @@ -31,6 +31,7 @@ #include #include #include +#include #include "XrdPosix/XrdPosixLinkage.hh" #include "XrdPosix/XrdPosixOsDep.hh" @@ -87,7 +88,7 @@ int chdir(const char *path) { static int Init = Xunix.Init(&Init); - return XrdPosix_Chdir(path); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Chdir(path) : XrdPosix_Chdir(path)); } } @@ -115,7 +116,7 @@ int closedir(DIR *dirp) { static int Init = Xunix.Init(&Init); - return XrdPosix_Closedir(dirp); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Closedir(dirp) : XrdPosix_Closedir(dirp)); } } @@ -452,7 +453,7 @@ int mkdir(const char *path, mode_t mode) { static int Init = Xunix.Init(&Init); - return XrdPosix_Mkdir(path, mode); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Mkdir(path, mode) : XrdPosix_Mkdir(path, mode)); } } @@ -485,7 +486,7 @@ DIR* opendir(const char *path) { static int Init = Xunix.Init(&Init); - return XrdPosix_Opendir(path); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Opendir(path) : XrdPosix_Opendir(path)); } } @@ -571,7 +572,7 @@ struct dirent64* readdir64(DIR *dirp) { static int Init = Xunix.Init(&Init); - return XrdPosix_Readdir64(dirp); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Readdir64(dirp) : XrdPosix_Readdir64(dirp)); } } @@ -585,7 +586,8 @@ int readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result) { static int Init = Xunix.Init(&Init); - return XrdPosix_Readdir64_r(dirp, entry, result); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Readdir64_r(dirp, entry, result) : + XrdPosix_Readdir64_r(dirp, entry, result)); } } @@ -599,7 +601,7 @@ int rename(const char *oldpath, const char *newpath) { static int Init = Xunix.Init(&Init); - return XrdPosix_Rename(oldpath, newpath); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Rename(oldpath, newpath) : XrdPosix_Rename(oldpath, newpath)); } } @@ -614,7 +616,7 @@ void rewinddir(DIR *dirp) { static int Init = Xunix.Init(&Init); - XrdPosix_Rewinddir(dirp); + (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Rewinddir(dirp) : XrdPosix_Rewinddir(dirp)); } } #endif @@ -629,7 +631,7 @@ int rmdir(const char *path) { static int Init = Xunix.Init(&Init); - return XrdPosix_Rmdir(path); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Rmdir(path) : XrdPosix_Rmdir(path)); } } @@ -643,7 +645,7 @@ void seekdir(DIR *dirp, long loc) { static int Init = Xunix.Init(&Init); - XrdPosix_Seekdir(dirp, loc); + (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Seekdir(dirp, loc) : XrdPosix_Seekdir(dirp, loc)); } } @@ -705,7 +707,7 @@ long telldir(DIR *dirp) { static int Init = Xunix.Init(&Init); - return XrdPosix_Telldir(dirp); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Telldir(dirp) : XrdPosix_Telldir(dirp)); } } @@ -733,7 +735,7 @@ int unlink(const char *path) { static int Init = Xunix.Init(&Init); - return XrdPosix_Unlink(path); + return (getenv("XRD_POSIX_PRELOAD_LITE")? Xunix.Unlink(path) : XrdPosix_Unlink(path)); } } diff --git a/src/XrdPosix/XrdPosixPreload32.cc b/src/XrdPosix/XrdPosixPreload32.cc index 4daf2069f2b..cb07ef324e7 100644 --- a/src/XrdPosix/XrdPosixPreload32.cc +++ b/src/XrdPosix/XrdPosixPreload32.cc @@ -49,6 +49,7 @@ #include #include #include +#include #if defined(__APPLE__) || defined(__FreeBSD__) #include @@ -323,6 +324,7 @@ int lstat( const char *path, struct stat *buf) #else struct stat64 buf64; int rc; + if ((rc = XrdPosix_Lstat(path, (struct stat *)&buf64))) return rc; return XrdPosix_CopyStat(buf, buf64); #endif @@ -379,7 +381,12 @@ struct dirent* readdir(DIR *dirp) static int Init = Xunix.Init(&Init); struct dirent64 *dp64; - if (!(dp64 = XrdPosix_Readdir64(dirp))) return 0; + if ( getenv("XRD_POSIX_PRELOAD_LITE") ) + { + if (!(dp64 = Xunix.Readdir64(dirp))) return 0; + } + else + if (!(dp64 = XrdPosix_Readdir64(dirp))) return 0; #if !defined(__APPLE__) && !defined(_LP64) && !defined(__LP64__) if (XrdPosix_CopyDirent((struct dirent *)dp64, dp64)) return 0; @@ -408,8 +415,12 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) struct dirent64 *mydirent; int rc; - if ((rc = XrdPosix_Readdir64_r(dirp, dp64, &mydirent))) - return rc; + if ( getenv("XRD_POSIX_PRELOAD_LITE") ) + { + if ((rc = Xunix.Readdir64_r(dirp, dp64, &mydirent))) return rc; + } + else + if ((rc = XrdPosix_Readdir64_r(dirp, dp64, &mydirent))) return rc; if (!mydirent) {*result = 0; return 0;}