1 From 5298c732c394d7ac3c24abc7d01a4631f573e692 Mon Sep 17 00:00:00 2001
2 From: Michal Simon <michal.simon@cern.ch>
3 Date: Mon, 2 Nov 2020 09:47:25 +0100
4 Subject: [PATCH] [XrdPosix] Fix _STAT_VER problem on Fedora rawhide.
7 src/XrdPosix/XrdPosix.cc | 10 +++++++---
8 src/XrdPosix/XrdPosixLinkage.hh | 10 +++++-----
9 src/XrdPosix/XrdPosixPreload32.cc | 4 ++--
10 3 files changed, 14 insertions(+), 10 deletions(-)
12 diff --git a/src/XrdPosix/XrdPosix.cc b/src/XrdPosix/XrdPosix.cc
13 index 290f9fe7314..f582eb4617c 100644
14 --- a/src/XrdPosix/XrdPosix.cc
15 +++ b/src/XrdPosix/XrdPosix.cc
16 @@ -375,7 +375,7 @@ int XrdPosix_Fstat(int fildes, struct stat *buf)
18 return (Xroot.myFD(fildes)
19 ? Xroot.Fstat(fildes, buf)
21 +#if defined(__linux__) and defined(_STAT_VER)
22 : Xunix.Fstat64(_STAT_VER, fildes, (struct stat64 *)buf));
24 : Xunix.Fstat64( fildes, (struct stat64 *)buf));
25 @@ -387,7 +387,11 @@ int XrdPosix_FstatV(int ver, int fildes, struct stat *buf)
27 return (Xroot.myFD(fildes)
28 ? Xroot.Fstat(fildes, buf)
30 : Xunix.Fstat64(ver, fildes, (struct stat64 *)buf));
32 + : Xunix.Fstat64( fildes, (struct stat64 *)buf));
37 @@ -559,7 +563,7 @@ int XrdPosix_Lstat(const char *path, struct stat *buf)
38 // Return the results of an open of a Unix file
40 return (!(myPath = XrootPath.URL(path, buff, sizeof(buff)))
42 +#if defined(__linux__) and defined(_STAT_VER)
43 ? Xunix.Lstat64(_STAT_VER, path, (struct stat64 *)buf)
45 ? Xunix.Lstat64( path, (struct stat64 *)buf)
46 @@ -887,7 +891,7 @@ int XrdPosix_Stat(const char *path, struct stat *buf)
47 // Return the results of an open of a Unix file
49 return (!(myPath = XrootPath.URL(path, buff, sizeof(buff)))
51 +#if defined(__linux__) and defined(_STAT_VER)
52 ? Xunix.Stat64(_STAT_VER, path, (struct stat64 *)buf)
54 ? Xunix.Stat64( path, (struct stat64 *)buf)
55 diff --git a/src/XrdPosix/XrdPosixLinkage.hh b/src/XrdPosix/XrdPosixLinkage.hh
56 index f298d098250..241222fa79c 100644
57 --- a/src/XrdPosix/XrdPosixLinkage.hh
58 +++ b/src/XrdPosix/XrdPosixLinkage.hh
60 #define Retv_Fseeko64 int
61 #define Args_Fseeko64 FILE *, off64_t, int
64 +#if defined(__linux__) and defined(_STAT_VER)
65 #define Symb_Fstat UNIX_PFX "__fxstat"
66 #define Retv_Fstat int
67 #define Args_Fstat int, int, struct stat *
69 #define Args_Fstat int, struct stat *
73 +#if defined(__linux__) and defined(_STAT_VER)
74 #define Symb_Fstat64 UNIX_PFX "__fxstat64"
75 #define Retv_Fstat64 int
76 #define Args_Fstat64 int, int, struct stat64 *
78 #define Retv_Lseek64 off64_t
79 #define Args_Lseek64 int, off64_t, int
82 +#if defined(__linux__) and defined(_STAT_VER)
83 #define Symb_Lstat UNIX_PFX "__lxstat"
84 #define Retv_Lstat int
85 #define Args_Lstat int, const char *, struct stat *
87 #define Args_Lstat const char *, struct stat *
91 +#if defined(__linux__) and defined(_STAT_VER)
92 #define Symb_Lstat64 UNIX_PFX "__lxstat64"
93 #define Retv_Lstat64 int
94 #define Args_Lstat64 int, const char *, struct stat64 *
96 #define Args_Stat const char *, struct stat *
100 +#if defined(__linux__) and defined(_STAT_VER)
101 #define Symb_Stat64 UNIX_PFX "__xstat64"
102 #define Retv_Stat64 int
103 #define Args_Stat64 int, const char *, struct stat64 *
104 diff --git a/src/XrdPosix/XrdPosixPreload32.cc b/src/XrdPosix/XrdPosixPreload32.cc
105 index 20364aaad54..fa2343afcef 100644
106 --- a/src/XrdPosix/XrdPosixPreload32.cc
107 +++ b/src/XrdPosix/XrdPosixPreload32.cc
108 @@ -230,7 +230,7 @@ int fstat( int fildes, struct stat *buf)
110 static int Init = Xunix.Init(&Init);
113 +#if defined(__linux__) and defined(_STAT_VER)
114 if (!XrdPosixXrootd::myFD(fildes)) return Xunix.Fstat(ver, fildes, buf);
116 if (!XrdPosixXrootd::myFD(fildes)) return Xunix.Fstat( fildes, buf);
117 @@ -315,7 +315,7 @@ int lstat( const char *path, struct stat *buf)
118 static int Init = Xunix.Init(&Init);
120 if (!XrdPosix_isMyPath(path))
122 +#if defined(__linux__) and defined(_STAT_VER)
123 return Xunix.Lstat(ver, path, buf);
125 return Xunix.Lstat( path, buf);