XRootD
Loading...
Searching...
No Matches
XrdPosix.cc File Reference
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/uio.h>
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdPosix/XrdPosixLinkage.hh"
#include "XrdPosix/XrdPosixXrootd.hh"
#include "XrdPosix/XrdPosixXrootdPath.hh"
+ Include dependency graph for XrdPosix.cc:

Go to the source code of this file.

Macros

#define ISMODE(x)
 

Functions

static void fseteof (FILE *fp)
 
static void fseterr (FILE *fp)
 
int XrdPosix_Access (const char *path, int amode)
 
int XrdPosix_Acl (const char *path, int cmd, int nentries, void *aclbufp)
 
int XrdPosix_Chdir (const char *path)
 
int XrdPosix_Close (int fildes)
 
int XrdPosix_Closedir (DIR *dirp)
 
int XrdPosix_Creat (const char *path, mode_t mode)
 
int XrdPosix_Fclose (FILE *stream)
 
int XrdPosix_Fcntl (int fd, int cmd,...)
 
int XrdPosix_Fdatasync (int fildes)
 
int XrdPosix_Fflush (FILE *stream)
 
FILE * XrdPosix_Fopen (const char *path, const char *mode)
 
size_t XrdPosix_Fread (void *ptr, size_t size, size_t nitems, FILE *stream)
 
int XrdPosix_Fseek (FILE *stream, long offset, int whence)
 
int XrdPosix_Fseeko (FILE *stream, long long offset, int whence)
 
int XrdPosix_Fstat (int fildes, struct stat *buf)
 
int XrdPosix_Fsync (int fildes)
 
long XrdPosix_Ftell (FILE *stream)
 
long long XrdPosix_Ftello (FILE *stream)
 
int XrdPosix_Ftruncate (int fildes, long long offset)
 
size_t XrdPosix_Fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream)
 
int XrdPosix_isMyPath (const char *path)
 
long long XrdPosix_Lseek (int fildes, long long offset, int whence)
 
int XrdPosix_Lstat (const char *path, struct stat *buf)
 
int XrdPosix_Mkdir (const char *path, mode_t mode)
 
int XrdPosix_Open (const char *path, int oflag,...)
 
DIR * XrdPosix_Opendir (const char *path)
 
long XrdPosix_Pathconf (const char *path, int name)
 
long long XrdPosix_Pread (int fildes, void *buf, unsigned long long nbyte, long long offset)
 
long long XrdPosix_Pwrite (int fildes, const void *buf, unsigned long long nbyte, long long offset)
 
long long XrdPosix_Read (int fildes, void *buf, unsigned long long nbyte)
 
struct dirent * XrdPosix_Readdir (DIR *dirp)
 
struct dirent64 * XrdPosix_Readdir64 (DIR *dirp)
 
int XrdPosix_Readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
 
int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
 
long long XrdPosix_Readv (int fildes, const struct iovec *iov, int iovcnt)
 
int XrdPosix_Rename (const char *oldpath, const char *newpath)
 
void XrdPosix_Rewinddir (DIR *dirp)
 
int XrdPosix_Rmdir (const char *path)
 
void XrdPosix_Seekdir (DIR *dirp, long loc)
 
int XrdPosix_Stat (const char *path, struct stat *buf)
 
int XrdPosix_Statfs (const char *path, struct statfs *buf)
 
int XrdPosix_Statvfs (const char *path, struct statvfs *buf)
 
long XrdPosix_Telldir (DIR *dirp)
 
int XrdPosix_Truncate (const char *path, long long offset)
 
int XrdPosix_Unlink (const char *path)
 
char * XrdPosix_URL (const char *path, char *buff, int blen)
 
long long XrdPosix_Write (int fildes, const void *buf, unsigned long long nbyte)
 
long long XrdPosix_Writev (int fildes, const struct iovec *iov, int iovcnt)
 

Variables

XrdPosixXrootd Xroot
 
XrdPosixXrootPath XrootPath
 
XrdPosixLinkage Xunix
 

Macro Definition Documentation

◆ ISMODE

#define ISMODE ( x)
Value:
!strcmp(mode, x)

Definition at line 302 of file XrdPosix.cc.

Referenced by XrdPosix_Fopen().

Function Documentation

◆ fseteof()

static void fseteof ( FILE * fp)
inlinestatic

Definition at line 87 of file XrdPosix.cc.

88{
89 /* Most systems provide FILE as a struct and the necessary bitmask in
90 <stdio.h>, because they need it for implementing getc() and putc() as
91 fast macros. */
92#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
93 /* GNU libc, BeOS, Haiku, Linux libc5 */
94 fp->_flags |= _IO_EOF_SEEN;
95#elif defined __sferror || defined __APPLE__ || defined __DragonFly__ || defined __ANDROID__
96 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
97 fp->_flags |= __SEOF;
98#elif defined _IOEOF
99 /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
100 fp->_flag |= _IOEOF;
101#elif defined __UCLIBC__ /* uClibc */
102 fp->__modeflags |= __FLAG_EOF;
103#else
104 (void) fseek(fp, 0L, SEEK_END);
105#endif
106}
#define fseek(a, b, c)
Definition XrdPosix.hh:53

References fseek.

Referenced by XrdPosix_Fread().

+ Here is the caller graph for this function:

◆ fseterr()

static void fseterr ( FILE * fp)
inlinestatic

Definition at line 64 of file XrdPosix.cc.

65{
66 /* Most systems provide FILE as a struct and the necessary bitmask in
67 <stdio.h>, because they need it for implementing getc() and putc() as
68 fast macros. This function is based on gnulib's fseterr.c */
69#if defined _IO_ERR_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
70 /* GNU libc, BeOS, Haiku, Linux libc5 */
71 fp->_flags |= _IO_ERR_SEEN;
72#elif defined __sferror || defined __APPLE__ || defined __DragonFly__ || defined __FreeBSD__ || defined __ANDROID__
73 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
74 fp->_flags |= __SERR;
75#elif defined _IOERR
76 /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */
77 fp->_flag |= _IOERR;
78#elif defined __UCLIBC__ /* uClibc */
79 fp->__modeflags |= __FLAG_ERROR;
80#elif defined MUSL /* musl libc */
81 __fseterr(fp);
82#else
83 #error "Unsupported platform! Please report it as a bug."
84#endif
85}

Referenced by XrdPosix_Fread(), and XrdPosix_Fwrite().

+ Here is the caller graph for this function:

◆ XrdPosix_Access()

int XrdPosix_Access ( const char * path,
int amode )

Definition at line 114 of file XrdPosix.cc.

115{
116 char *myPath, buff[2048];
117
118// Make sure a path was passed
119//
120 if (!path) {errno = EFAULT; return -1;}
121
122// Return the results of a mkdir of a Unix file system
123//
124 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
125 return Xunix.Access( path, amode);
126
127// Return the results of our version of access()
128//
129 return Xroot.Access(myPath, amode);
130}
XrdPosixXrootd Xroot
Definition XrdPosix.cc:50
XrdPosixXrootPath XrootPath
Definition XrdPosix.cc:52
XrdPosixLinkage Xunix
Retv_Access(* Access)(Args_Access)
char * URL(const char *path, char *buff, int blen)
static int Access(const char *path, int amode)
Access() conforms to POSIX.1-2001 access()

References XrdPosixLinkage::Access, XrdPosixXrootd::Access(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by access().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Acl()

int XrdPosix_Acl ( const char * path,
int cmd,
int nentries,
void * aclbufp )

Definition at line 141 of file XrdPosix.cc.

142{
143 return (XrootPath.URL(path, 0, 0)
144 ? Xunix.Acl("/tmp", cmd,nentries,aclbufp)
145 : Xunix.Acl(path, cmd,nentries,aclbufp));
146}
Retv_Acl(* Acl)(Args_Acl)

References XrdPosixLinkage::Acl, XrdPosixXrootPath::URL(), XrootPath, and Xunix.

Referenced by acl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Chdir()

int XrdPosix_Chdir ( const char * path)

Definition at line 155 of file XrdPosix.cc.

156{
157 int rc;
158
159// Set the working directory if the actual chdir succeeded
160//
161 if (!(rc = Xunix.Chdir(path))) XrootPath.CWD(path);
162 return rc;
163}
Retv_Chdir(* Chdir)(Args_Chdir)
void CWD(const char *path)

References XrdPosixLinkage::Chdir, XrdPosixXrootPath::CWD(), XrootPath, and Xunix.

Referenced by chdir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Close()

int XrdPosix_Close ( int fildes)

Definition at line 172 of file XrdPosix.cc.

173{
174
175// Return result of the close
176//
177 return (Xroot.myFD(fildes) ? Xroot.Close(fildes) : Xunix.Close(fildes));
178}
Retv_Close(* Close)(Args_Close)
static int Close(int fildes)
Close() conforms to POSIX.1-2001 close()
static bool myFD(int fd)

References XrdPosixLinkage::Close, XrdPosixXrootd::Close(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by close().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Closedir()

int XrdPosix_Closedir ( DIR * dirp)

Definition at line 187 of file XrdPosix.cc.

188{
189
190 return (Xroot.isXrootdDir(dirp) ? Xroot.Closedir(dirp)
191 : Xunix.Closedir(dirp));
192}
Retv_Closedir(* Closedir)(Args_Closedir)
static int Closedir(DIR *dirp)
Closedir() conforms to POSIX.1-2001 closedir()
static bool isXrootdDir(DIR *dirp)

References XrdPosixLinkage::Closedir, XrdPosixXrootd::Closedir(), XrdPosixXrootd::isXrootdDir(), Xroot, and Xunix.

Referenced by closedir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Creat()

int XrdPosix_Creat ( const char * path,
mode_t mode )

Definition at line 201 of file XrdPosix.cc.

202{
203 extern int XrdPosix_Open(const char *path, int oflag, ...);
204
205 return XrdPosix_Open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
206}
int XrdPosix_Open(const char *path, int oflag,...)
Definition XrdPosix.cc:640

References XrdPosix_Open().

Referenced by creat64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fclose()

int XrdPosix_Fclose ( FILE * stream)

Definition at line 215 of file XrdPosix.cc.

216{
217 int nullfd = fileno(stream);
218
219// Close the associated file
220//
221 if (Xroot.myFD(nullfd)) Xroot.Close(nullfd);
222
223// Now close the stream
224//
225 return Xunix.Fclose(stream);
226}
Retv_Fclose(* Fclose)(Args_Fclose)

References XrdPosixXrootd::Close(), XrdPosixLinkage::Fclose, XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by fclose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fcntl()

int XrdPosix_Fcntl ( int fd,
int cmd,
... )

Definition at line 235 of file XrdPosix.cc.

236{
237 va_list ap;
238 void *theArg;
239
240 if (Xroot.myFD(fd)) return 0;
241 va_start(ap, cmd);
242 theArg = va_arg(ap, void *);
243 va_end(ap);
244 return Xunix.Fcntl64(fd, cmd, theArg);
245}
Retv_Fcntl64(* Fcntl64)(Args_Fcntl64)

References XrdPosixLinkage::Fcntl64, XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by fcntl64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fdatasync()

int XrdPosix_Fdatasync ( int fildes)

Definition at line 254 of file XrdPosix.cc.

255{
256
257// Return the result of the sync
258//
259 return (Xroot.myFD(fildes) ? Xroot.Fsync(fildes)
260 : Xunix.Fsync(fildes));
261}
Retv_Fsync(* Fsync)(Args_Fsync)
static int Fsync(int fildes)
Fsync() conforms to POSIX.1-2001 fsync()

References XrdPosixLinkage::Fsync, XrdPosixXrootd::Fsync(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by fdatasync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fflush()

int XrdPosix_Fflush ( FILE * stream)

Definition at line 286 of file XrdPosix.cc.

287{
288
289// Return the result of the fseek
290//
291 if (!stream || !Xroot.myFD(fileno(stream)))
292 return Xunix.Fflush(stream);
293
294 return Xroot.Fsync(fileno(stream));
295}
Retv_Fflush(* Fflush)(Args_Fflush)

References XrdPosixLinkage::Fflush, XrdPosixXrootd::Fsync(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by fflush().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fopen()

FILE * XrdPosix_Fopen ( const char * path,
const char * mode )

Definition at line 306 of file XrdPosix.cc.

307{
308 char *myPath, buff[2048];
309 int erc, fd, omode;
310 FILE *stream;
311
312// Transfer to unix if this is not our path
313//
314 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
315 return Xunix.Fopen64(path, mode);
316
317// Translate the mode flags
318//
319 if (ISMODE("r") || ISMODE("rb")) omode = O_RDONLY;
320 else if (ISMODE("w") || ISMODE("wb")) omode = O_WRONLY
321 | O_CREAT | O_TRUNC;
322 else if (ISMODE("a") || ISMODE("ab")) omode = O_APPEND;
323 else if (ISMODE("r+") || ISMODE("rb+") || ISMODE("r+b")) omode = O_RDWR;
324 else if (ISMODE("w+") || ISMODE("wb+") || ISMODE("w+b")) omode = O_RDWR
325 | O_CREAT | O_TRUNC;
326 else if (ISMODE("a+") || ISMODE("ab+") || ISMODE("a+b")) omode = O_APPEND;
327 else {errno = EINVAL; return 0;}
328
329// Now open the file
330//
331 if ((fd = Xroot.Open(myPath, omode | XrdPosixXrootd::isStream , 0)) < 0)
332 return 0;
333
334// First obtain a free stream
335//
336 if (!(stream = fdopen(fd, mode)))
337 {erc = errno; Xroot.Close(fd); errno = erc;}
338
339// All done
340//
341 return stream;
342}
#define ISMODE(x)
Definition XrdPosix.cc:302
Retv_Fopen64(* Fopen64)(Args_Fopen64)
static const int isStream
static int Open(const char *path, int oflag, mode_t mode=0, XrdPosixCallBack *cbP=0)

References XrdPosixXrootd::Close(), XrdPosixLinkage::Fopen64, ISMODE, XrdPosixXrootd::isStream, XrdPosixXrootd::Open(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by fopen64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fread()

size_t XrdPosix_Fread ( void * ptr,
size_t size,
size_t nitems,
FILE * stream )

Definition at line 351 of file XrdPosix.cc.

352{
353 ssize_t bytes;
354 size_t rc = 0;
355 int fd = fileno(stream);
356
357 if (!Xroot.myFD(fd)) return Xunix.Fread(ptr, size, nitems, stream);
358
359 bytes = Xroot.Read(fd, ptr, size*nitems);
360
361// Get the right return code. Note that we cannot emulate the flags in sunx86
362//
363 if (bytes > 0 && size) rc = bytes/size;
364 else if (bytes < 0) fseterr(stream);
365 else fseteof(stream);
366
367 return rc;
368}
static void fseterr(FILE *fp)
Definition XrdPosix.cc:64
static void fseteof(FILE *fp)
Definition XrdPosix.cc:87
Retv_Fread(* Fread)(Args_Fread)
static ssize_t Read(int fildes, void *buf, size_t nbyte)
Read() conforms to POSIX.1-2001 read()

References XrdPosixLinkage::Fread, fseteof(), fseterr(), XrdPosixXrootd::myFD(), XrdPosixXrootd::Read(), Xroot, and Xunix.

Referenced by fread().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fseek()

int XrdPosix_Fseek ( FILE * stream,
long offset,
int whence )

Definition at line 377 of file XrdPosix.cc.

378{
379
380// Return the result of the fseek
381//
382 if (!Xroot.myFD(fileno(stream)))
383 return Xunix.Fseek( stream, offset, whence);
384
385 return (Xroot.Lseek(fileno(stream), offset, whence) < 0 ? -1 : 0);
386}
Retv_Fseek(* Fseek)(Args_Fseek)
static off_t Lseek(int fildes, off_t offset, int whence)
Lseek() conforms to POSIX.1-2001 lseek()

References XrdPosixLinkage::Fseek, XrdPosixXrootd::Lseek(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by fseek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fseeko()

int XrdPosix_Fseeko ( FILE * stream,
long long offset,
int whence )

Definition at line 395 of file XrdPosix.cc.

396{
397
398// Return the result of the fseek
399//
400 if (!Xroot.myFD(fileno(stream)))
401 return Xunix.Fseeko64(stream, offset, whence);
402
403 return (Xroot.Lseek(fileno(stream), offset, whence) < 0 ? -1 : 0);
404}
Retv_Fseeko64(* Fseeko64)(Args_Fseeko64)

References XrdPosixLinkage::Fseeko64, XrdPosixXrootd::Lseek(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by fseeko(), and fseeko64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fstat()

int XrdPosix_Fstat ( int fildes,
struct stat * buf )

Definition at line 413 of file XrdPosix.cc.

414{
415
416// Return result of the close
417//
418 return (Xroot.myFD(fildes)
419 ? Xroot.Fstat(fildes, buf)
420#if defined(__linux__) and defined(_STAT_VER)
421 : Xunix.Fstat64(_STAT_VER, fildes, (struct stat64 *)buf));
422#else
423 : Xunix.Fstat64( fildes, (struct stat64 *)buf));
424#endif
425}
int stat64(const char *path, struct stat64 *buf)
Retv_Fstat64(* Fstat64)(Args_Fstat64)
static int Fstat(int fildes, struct stat *buf)
Fstat() conforms to POSIX.1-2001 fstat()

References XrdPosixXrootd::Fstat(), XrdPosixLinkage::Fstat64, XrdPosixXrootd::myFD(), stat64(), Xroot, and Xunix.

Referenced by fstat(), and fstat64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fsync()

int XrdPosix_Fsync ( int fildes)

Definition at line 447 of file XrdPosix.cc.

448{
449
450// Return the result of the sync
451//
452 return (Xroot.myFD(fildes) ? Xroot.Fsync(fildes)
453 : Xunix.Fsync(fildes));
454}

References XrdPosixLinkage::Fsync, XrdPosixXrootd::Fsync(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by fsync().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Ftell()

long XrdPosix_Ftell ( FILE * stream)

Definition at line 463 of file XrdPosix.cc.

464{
465
466// Return the result of the tell
467//
468 if (!Xroot.myFD(fileno(stream))) return Xunix.Ftell(stream);
469
470 return static_cast<long>(Xroot.Lseek(fileno(stream), 0, SEEK_CUR));
471}
Retv_Ftell(* Ftell)(Args_Ftell)

References XrdPosixLinkage::Ftell, XrdPosixXrootd::Lseek(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by ftell().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Ftello()

long long XrdPosix_Ftello ( FILE * stream)

Definition at line 480 of file XrdPosix.cc.

481{
482
483// Return the result of the tell
484//
485 if (!Xroot.myFD(fileno(stream))) return Xunix.Ftello64(stream);
486
487 return Xroot.Lseek(fileno(stream), 0, SEEK_CUR);
488}
Retv_Ftello64(* Ftello64)(Args_Ftello64)

References XrdPosixLinkage::Ftello64, XrdPosixXrootd::Lseek(), XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by ftello(), and ftello64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Ftruncate()

int XrdPosix_Ftruncate ( int fildes,
long long offset )

Definition at line 497 of file XrdPosix.cc.

498{
499
500// Return the result of the ftruncate
501//
502 return (Xroot.myFD(fildes) ? Xroot.Ftruncate (fildes, offset)
503 : Xunix.Ftruncate64(fildes, offset));
504}
Retv_Ftruncate64(* Ftruncate64)(Args_Ftruncate64)
static int Ftruncate(int fildes, off_t offset)
Ftruncate() conforms to POSIX.1-2001 ftruncate()

References XrdPosixXrootd::Ftruncate(), XrdPosixLinkage::Ftruncate64, XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by ftruncate(), and ftruncate64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Fwrite()

size_t XrdPosix_Fwrite ( const void * ptr,
size_t size,
size_t nitems,
FILE * stream )

Definition at line 513 of file XrdPosix.cc.

514{
515 size_t bytes, rc = 0;
516 int fd = fileno(stream);
517
518 if (!Xroot.myFD(fd)) return Xunix.Fwrite(ptr, size, nitems, stream);
519
520 bytes = Xroot.Write(fd, ptr, size*nitems);
521
522// Get the right return code.
523//
524 if (bytes > 0 && size) rc = bytes/size;
525 else fseterr(stream);
526
527 return rc;
528}
Retv_Fwrite(* Fwrite)(Args_Fwrite)
static ssize_t Write(int fildes, const void *buf, size_t nbyte)
Write() conforms to POSIX.1-2001 write()

References fseterr(), XrdPosixLinkage::Fwrite, XrdPosixXrootd::myFD(), XrdPosixXrootd::Write(), Xroot, and Xunix.

Referenced by fwrite().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_isMyPath()

int XrdPosix_isMyPath ( const char * path)

Definition at line 1083 of file XrdPosix.cc.

1084{
1085 return (0 != XrootPath.URL(path, 0, 0));
1086}

References XrdPosixXrootPath::URL(), and XrootPath.

Referenced by lstat(), and stat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Lseek()

long long XrdPosix_Lseek ( int fildes,
long long offset,
int whence )

Definition at line 573 of file XrdPosix.cc.

574{
575
576// Return the operation of the seek
577//
578 return (Xroot.myFD(fildes) ? Xroot.Lseek (fildes, offset, whence)
579 : Xunix.Lseek64(fildes, offset, whence));
580}
Retv_Lseek64(* Lseek64)(Args_Lseek64)

References XrdPosixXrootd::Lseek(), XrdPosixLinkage::Lseek64, XrdPosixXrootd::myFD(), Xroot, and Xunix.

Referenced by llseek(), lseek(), and lseek64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Lstat()

int XrdPosix_Lstat ( const char * path,
struct stat * buf )

Definition at line 589 of file XrdPosix.cc.

590{
591 char *myPath, buff[2048];
592
593// Make sure a path was passed
594//
595 if (!path) {errno = EFAULT; return -1;}
596
597// Return the results of an open of a Unix file
598//
599 return (!(myPath = XrootPath.URL(path, buff, sizeof(buff)))
600#if defined(__linux__) and defined(_STAT_VER)
601 ? Xunix.Lstat64(_STAT_VER, path, (struct stat64 *)buf)
602#else
603 ? Xunix.Lstat64( path, (struct stat64 *)buf)
604#endif
605 : Xroot.Stat(myPath, buf));
606}
Retv_Lstat64(* Lstat64)(Args_Lstat64)
static int Stat(const char *path, struct stat *buf)
Stat() conforms to POSIX.1-2001 stat()

References XrdPosixLinkage::Lstat64, XrdPosixXrootd::Stat(), stat64(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by lstat(), and lstat64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Mkdir()

int XrdPosix_Mkdir ( const char * path,
mode_t mode )

Definition at line 615 of file XrdPosix.cc.

616{
617 char *myPath, buff[2048];
618
619// Make sure a path was passed
620//
621 if (!path) {errno = EFAULT; return -1;}
622
623// Return the results of a mkdir of a Unix file system
624//
625 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
626 return Xunix.Mkdir(path, mode);
627
628// Return the results of an mkdir of an xrootd file system
629//
630 return Xroot.Mkdir(myPath, mode);
631}
Retv_Mkdir(* Mkdir)(Args_Mkdir)
static int Mkdir(const char *path, mode_t mode)
Mkdir() conforms to POSIX.1-2001 mkdir()

References XrdPosixLinkage::Mkdir, XrdPosixXrootd::Mkdir(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by mkdir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Open()

int XrdPosix_Open ( const char * path,
int oflag,
... )

Definition at line 640 of file XrdPosix.cc.

641{
642 char *myPath, buff[2048];
643 va_list ap;
644 int mode;
645
646// Make sure a path was passed
647//
648 if (!path) {errno = EFAULT; return -1;}
649
650// Return the results of an open of a Unix file
651//
652 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
653 {if (!(oflag & O_CREAT)) return Xunix.Open64(path, oflag);
654 va_start(ap, oflag);
655 mode = va_arg(ap, int);
656 va_end(ap);
657 return Xunix.Open64(path, oflag, (mode_t)mode);
658 }
659
660// Return the results of an open of an xrootd file
661//
662 if (!(oflag & O_CREAT)) return Xroot.Open(myPath, oflag);
663 va_start(ap, oflag);
664 mode = va_arg(ap, int);
665 va_end(ap);
666 return Xroot.Open(myPath, oflag, (mode_t)mode);
667}
Retv_Open64(* Open64)(Args_Open64)

References XrdPosixXrootd::Open(), XrdPosixLinkage::Open64, XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by creat(), open(), open64(), and XrdPosix_Creat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Opendir()

DIR * XrdPosix_Opendir ( const char * path)

Definition at line 676 of file XrdPosix.cc.

677{
678 char *myPath, buff[2048];
679
680// Make sure a path was passed
681//
682 if (!path) {errno = EFAULT; return 0;}
683
684// Unix opendir
685//
686 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
687 return Xunix.Opendir(path);
688
689// Xrootd opendir
690//
691 return Xroot.Opendir(myPath);
692}
Retv_Opendir(* Opendir)(Args_Opendir)
static DIR * Opendir(const char *path)
Opendir() conforms to POSIX.1-2001 opendir()

References XrdPosixLinkage::Opendir, XrdPosixXrootd::Opendir(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by opendir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Pathconf()

long XrdPosix_Pathconf ( const char * path,
int name )

Definition at line 703 of file XrdPosix.cc.

704{
705 return (XrootPath.URL(path, 0, 0) ? Xunix.Pathconf("/tmp", name)
706 : Xunix.Pathconf(path, name));
707}
Retv_Pathconf(* Pathconf)(Args_Pathconf)

References XrdPosixLinkage::Pathconf, XrdPosixXrootPath::URL(), XrootPath, and Xunix.

Referenced by pathconf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Pread()

long long XrdPosix_Pread ( int fildes,
void * buf,
unsigned long long nbyte,
long long offset )

Definition at line 716 of file XrdPosix.cc.

718{
719
720// Return the results of the read
721//
722 return (Xroot.myFD(fildes) ? Xroot.Pread (fildes, buf, nbyte, offset)
723 : Xunix.Pread64(fildes, buf, nbyte, offset));
724}
Retv_Pread64(* Pread64)(Args_Pread64)
static ssize_t Pread(int fildes, void *buf, size_t nbyte, off_t offset)
Pread() conforms to POSIX.1-2001 pread()

References XrdPosixXrootd::myFD(), XrdPosixXrootd::Pread(), XrdPosixLinkage::Pread64, Xroot, and Xunix.

Referenced by pread(), and pread64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Pwrite()

long long XrdPosix_Pwrite ( int fildes,
const void * buf,
unsigned long long nbyte,
long long offset )

Definition at line 733 of file XrdPosix.cc.

735{
736
737// Return the results of the write
738//
739 return (Xroot.myFD(fildes) ? Xroot.Pwrite (fildes, buf, nbyte, offset)
740 : Xunix.Pwrite64(fildes, buf, nbyte, offset));
741}
Retv_Pwrite64(* Pwrite64)(Args_Pwrite64)
static ssize_t Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset)
Pwrite() conforms to POSIX.1-2001 pwrite()

References XrdPosixXrootd::myFD(), XrdPosixXrootd::Pwrite(), XrdPosixLinkage::Pwrite64, Xroot, and Xunix.

Referenced by pwrite(), and pwrite64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Read()

long long XrdPosix_Read ( int fildes,
void * buf,
unsigned long long nbyte )

Definition at line 750 of file XrdPosix.cc.

751{
752
753// Return the results of the read
754//
755 return (Xroot.myFD(fildes) ? Xroot.Read(fildes, buf, nbyte)
756 : Xunix.Read(fildes, buf, nbyte));
757}
Retv_Read(* Read)(Args_Read)

References XrdPosixXrootd::myFD(), XrdPosixLinkage::Read, XrdPosixXrootd::Read(), Xroot, and Xunix.

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Readdir()

struct dirent * XrdPosix_Readdir ( DIR * dirp)

Definition at line 784 of file XrdPosix.cc.

785{
786
787// Return result of readdir
788//
789 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir(dirp)
790 : Xunix.Readdir(dirp));
791}
Retv_Readdir(* Readdir)(Args_Readdir)
static struct dirent * Readdir(DIR *dirp)

References XrdPosixXrootd::isXrootdDir(), XrdPosixLinkage::Readdir, XrdPosixXrootd::Readdir(), Xroot, and Xunix.

+ Here is the call graph for this function:

◆ XrdPosix_Readdir64()

struct dirent64 * XrdPosix_Readdir64 ( DIR * dirp)

Definition at line 793 of file XrdPosix.cc.

794{
795
796// Return result of readdir
797//
798 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64(dirp)
799 : Xunix.Readdir64(dirp));
800}
Retv_Readdir64(* Readdir64)(Args_Readdir64)
static struct dirent64 * Readdir64(DIR *dirp)

References XrdPosixXrootd::isXrootdDir(), XrdPosixLinkage::Readdir64, XrdPosixXrootd::Readdir64(), Xroot, and Xunix.

Referenced by readdir(), and readdir64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Readdir64_r()

int XrdPosix_Readdir64_r ( DIR * dirp,
struct dirent64 * entry,
struct dirent64 ** result )

Definition at line 818 of file XrdPosix.cc.

819{
820
821// Return result of readdir
822//
823 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64_r(dirp,entry,result)
824 : Xunix.Readdir64_r(dirp,entry,result));
825}
Retv_Readdir64_r(* Readdir64_r)(Args_Readdir64_r)
static int Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)

References XrdPosixXrootd::isXrootdDir(), XrdPosixLinkage::Readdir64_r, XrdPosixXrootd::Readdir64_r(), Xroot, and Xunix.

Referenced by readdir64_r(), and readdir_r().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Readdir_r()

int XrdPosix_Readdir_r ( DIR * dirp,
struct dirent * entry,
struct dirent ** result )

Definition at line 809 of file XrdPosix.cc.

810{
811
812// Return result of readdir
813//
814 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir_r(dirp,entry,result)
815 : Xunix.Readdir_r(dirp,entry,result));
816}
Retv_Readdir_r(* Readdir_r)(Args_Readdir_r)
static int Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)

References XrdPosixXrootd::isXrootdDir(), XrdPosixLinkage::Readdir_r, XrdPosixXrootd::Readdir_r(), Xroot, and Xunix.

Referenced by readdir_r().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Readv()

long long XrdPosix_Readv ( int fildes,
const struct iovec * iov,
int iovcnt )

Definition at line 766 of file XrdPosix.cc.

767{
768
769// Return results of the readv
770//
771 return (Xroot.myFD(fildes) ? Xroot.Readv(fildes, iov, iovcnt)
772 : Xunix.Readv(fildes, iov, iovcnt));
773}
Retv_Readv(* Readv)(Args_Readv)
static ssize_t Readv(int fildes, const struct iovec *iov, int iovcnt)
Readv() conforms to POSIX.1-2001 readv()

References XrdPosixXrootd::myFD(), XrdPosixLinkage::Readv, XrdPosixXrootd::Readv(), Xroot, and Xunix.

Referenced by readv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Rename()

int XrdPosix_Rename ( const char * oldpath,
const char * newpath )

Definition at line 834 of file XrdPosix.cc.

835{
836 char *oldPath, buffold[2048], *newPath, buffnew[2048];
837
838// Make sure a path was passed
839//
840 if (!oldpath || !newpath) {errno = EFAULT; return -1;}
841
842// Return the results of a mkdir of a Unix file system
843//
844 if (!(oldPath = XrootPath.URL(oldpath, buffold, sizeof(buffold)))
845 || !(newPath = XrootPath.URL(newpath, buffnew, sizeof(buffnew))))
846 return Xunix.Rename(oldpath, newpath);
847
848// Return the results of an mkdir of an xrootd file system
849//
850 return Xroot.Rename(oldPath, newPath);
851}
Retv_Rename(* Rename)(Args_Rename)
static int Rename(const char *oldpath, const char *newpath)
Rename() conforms to POSIX.1-2001 rename()

References XrdPosixLinkage::Rename, XrdPosixXrootd::Rename(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by rename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Rewinddir()

void XrdPosix_Rewinddir ( DIR * dirp)

Definition at line 860 of file XrdPosix.cc.

861{
862
863// Return result of rewind
864//
865 return (Xroot.isXrootdDir(dirp) ? Xroot.Rewinddir(dirp)
866 : Xunix.Rewinddir(dirp));
867}
Retv_Rewinddir(* Rewinddir)(Args_Rewinddir)
static void Rewinddir(DIR *dirp)
Rewinddir() conforms to POSIX.1-2001 rewinddir()

References XrdPosixXrootd::isXrootdDir(), XrdPosixLinkage::Rewinddir, XrdPosixXrootd::Rewinddir(), Xroot, and Xunix.

+ Here is the call graph for this function:

◆ XrdPosix_Rmdir()

int XrdPosix_Rmdir ( const char * path)

Definition at line 876 of file XrdPosix.cc.

877{
878 char *myPath, buff[2048];
879
880// Make sure a path was passed
881//
882 if (!path) {errno = EFAULT; return -1;}
883
884// Return the results of a mkdir of a Unix file system
885//
886 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
887 return Xunix.Rmdir(path);
888
889// Return the results of an mkdir of an xrootd file system
890//
891 return Xroot.Rmdir(myPath);
892}
Retv_Rmdir(* Rmdir)(Args_Rmdir)
static int Rmdir(const char *path)
Rmdir() conforms to POSIX.1-2001 rmdir()

References XrdPosixLinkage::Rmdir, XrdPosixXrootd::Rmdir(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by rmdir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Seekdir()

void XrdPosix_Seekdir ( DIR * dirp,
long loc )

Definition at line 901 of file XrdPosix.cc.

902{
903
904// Call seekdir
905//
906 (Xroot.isXrootdDir(dirp) ? Xroot.Seekdir(dirp, loc)
907 : Xunix.Seekdir(dirp, loc));
908}
Retv_Seekdir(* Seekdir)(Args_Seekdir)
static void Seekdir(DIR *dirp, long loc)
Seekdir() conforms to POSIX.1-2001 seekdir()

References XrdPosixXrootd::isXrootdDir(), XrdPosixLinkage::Seekdir, XrdPosixXrootd::Seekdir(), Xroot, and Xunix.

Referenced by seekdir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Stat()

int XrdPosix_Stat ( const char * path,
struct stat * buf )

Definition at line 917 of file XrdPosix.cc.

918{
919 char *myPath, buff[2048];
920
921// Make sure a path was passed
922//
923 if (!path) {errno = EFAULT; return -1;}
924
925// Return the results of an open of a Unix file
926//
927 return (!(myPath = XrootPath.URL(path, buff, sizeof(buff)))
928#if defined(__linux__) and defined(_STAT_VER)
929 ? Xunix.Stat64(_STAT_VER, path, (struct stat64 *)buf)
930#else
931 ? Xunix.Stat64( path, (struct stat64 *)buf)
932#endif
933 : Xroot.Stat(myPath, buf));
934}
Retv_Stat64(* Stat64)(Args_Stat64)

References XrdPosixXrootd::Stat(), XrdPosixLinkage::Stat64, stat64(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by stat(), and stat64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Statfs()

int XrdPosix_Statfs ( const char * path,
struct statfs * buf )

Definition at line 943 of file XrdPosix.cc.

944{
945 char *myPath, buff[2048];
946
947// Make sure a path was passed
948//
949 if (!path) {errno = EFAULT; return -1;}
950
951// Return the results of an open of a Unix file
952//
953 return ((myPath = XrootPath.URL(path, buff, sizeof(buff)))
954 ? Xroot.Statfs(myPath, buf)
955 : Xunix.Statfs64(path, (struct statfs64 *)buf));
956}
int statfs64(const char *path, struct statfs64 *buf)
Retv_Statfs64(* Statfs64)(Args_Statfs64)
static int Statfs(const char *path, struct statfs *buf)

References XrdPosixXrootd::Statfs(), XrdPosixLinkage::Statfs64, statfs64(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by statfs(), and statfs64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Statvfs()

int XrdPosix_Statvfs ( const char * path,
struct statvfs * buf )

Definition at line 965 of file XrdPosix.cc.

966{
967 char *myPath, buff[2048];
968
969// Make sure a path was passed
970//
971 if (!path) {errno = EFAULT; return -1;}
972
973// Return the results of an open of a Unix file
974//
975 return ((myPath = XrootPath.URL(path, buff, sizeof(buff)))
976 ? Xroot.Statvfs(myPath, buf)
977 : Xunix.Statvfs64(path, (struct statvfs64 *)buf));
978}
int statvfs64(const char *path, struct statvfs64 *buf)
Retv_Statvfs64(* Statvfs64)(Args_Statvfs64)
static int Statvfs(const char *path, struct statvfs *buf)
Statvfs() conforms to POSIX.1-2001 statvfs()

References XrdPosixXrootd::Statvfs(), XrdPosixLinkage::Statvfs64, statvfs64(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by statvfs(), and statvfs64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Telldir()

long XrdPosix_Telldir ( DIR * dirp)

Definition at line 987 of file XrdPosix.cc.

988{
989
990// Return result of telldir
991//
992 return (Xroot.isXrootdDir(dirp) ? Xroot.Telldir(dirp)
993 : Xunix.Telldir(dirp));
994}
Retv_Telldir(* Telldir)(Args_Telldir)
static long Telldir(DIR *dirp)
Telldir() conforms to POSIX.1-2001 telldir()

References XrdPosixXrootd::isXrootdDir(), XrdPosixLinkage::Telldir, XrdPosixXrootd::Telldir(), Xroot, and Xunix.

Referenced by telldir().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Truncate()

int XrdPosix_Truncate ( const char * path,
long long offset )

Definition at line 1003 of file XrdPosix.cc.

1004{
1005 char *myPath, buff[2048];
1006
1007// Make sure a path was passed
1008//
1009 if (!path) {errno = EFAULT; return -1;}
1010
1011// Return the results of a truncate of a Unix file system
1012//
1013 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
1014 return Xunix.Truncate64(path, offset);
1015
1016// Return the results of an truncate of an xrootd file system
1017//
1018 return Xroot.Truncate(myPath, offset);
1019}
Retv_Truncate64(* Truncate64)(Args_Truncate64)
static int Truncate(const char *path, off_t offset)
Telldir() conforms to POSIX.1-2001 telldir()

References XrdPosixXrootd::Truncate(), XrdPosixLinkage::Truncate64, XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by truncate(), and truncate64().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Unlink()

int XrdPosix_Unlink ( const char * path)

Definition at line 1028 of file XrdPosix.cc.

1029{
1030 char *myPath, buff[2048];
1031
1032// Make sure a path was passed
1033//
1034 if (!path) {errno = EFAULT; return -1;}
1035
1036// Return the result of a unlink of a Unix file
1037//
1038 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
1039 return Xunix.Unlink(path);
1040
1041// Return the results of an unlink of an xrootd file
1042//
1043 return Xroot.Unlink(myPath);
1044}
Retv_Unlink(* Unlink)(Args_Unlink)
static int Unlink(const char *path)
Unlink() conforms to POSIX.1-2001 unlink()

References XrdPosixLinkage::Unlink, XrdPosixXrootd::Unlink(), XrdPosixXrootPath::URL(), Xroot, XrootPath, and Xunix.

Referenced by unlink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_URL()

char * XrdPosix_URL ( const char * path,
char * buff,
int blen )

Definition at line 1092 of file XrdPosix.cc.

1093{
1094 return XrootPath.URL(path, buff, blen);
1095}

References XrdPosixXrootPath::URL(), and XrootPath.

+ Here is the call graph for this function:

◆ XrdPosix_Write()

long long XrdPosix_Write ( int fildes,
const void * buf,
unsigned long long nbyte )

Definition at line 1053 of file XrdPosix.cc.

1054{
1055
1056// Return the results of the write
1057//
1058 return (Xroot.myFD(fildes) ? Xroot.Write(fildes, buf, nbyte)
1059 : Xunix.Write(fildes, buf, nbyte));
1060}
Retv_Write(* Write)(Args_Write)

References XrdPosixXrootd::myFD(), XrdPosixLinkage::Write, XrdPosixXrootd::Write(), Xroot, and Xunix.

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XrdPosix_Writev()

long long XrdPosix_Writev ( int fildes,
const struct iovec * iov,
int iovcnt )

Definition at line 1069 of file XrdPosix.cc.

1070{
1071
1072// Return results of the writev
1073//
1074 return (Xroot.myFD(fildes) ? Xroot.Writev(fildes, iov, iovcnt)
1075 : Xunix.Writev(fildes, iov, iovcnt));
1076}
Retv_Writev(* Writev)(Args_Writev)
static ssize_t Writev(int fildes, const struct iovec *iov, int iovcnt)
Writev() conforms to POSIX.1-2001 writev()

References XrdPosixXrootd::myFD(), XrdPosixLinkage::Writev, XrdPosixXrootd::Writev(), Xroot, and Xunix.

Referenced by writev().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ Xroot

◆ XrootPath

◆ Xunix