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)
 
off_t XrdPosix_Lseek (int fildes, off_t 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)
 
ssize_t XrdPosix_Pread (int fildes, void *buf, size_t nbyte, off_t offset)
 
ssize_t XrdPosix_Pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
 
ssize_t XrdPosix_Read (int fildes, void *buf, size_t 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)
 
ssize_t 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, off_t offset)
 
int XrdPosix_Unlink (const char *path)
 
char * XrdPosix_URL (const char *path, char *buff, int blen)
 
ssize_t XrdPosix_Write (int fildes, const void *buf, size_t nbyte)
 
ssize_t 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 301 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:58

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

References Xroot, XrootPath, and Xunix.

Referenced by access().

+ 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}

References XrootPath, and Xunix.

Referenced by acl().

+ 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}

References XrootPath, and Xunix.

Referenced by chdir().

+ 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}

References Xroot, and Xunix.

Referenced by close().

+ 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}

References Xroot, and Xunix.

Referenced by closedir().

+ 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:639

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}

References Xroot, and Xunix.

Referenced by fclose().

+ 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}

References Xroot, and Xunix.

Referenced by fcntl64().

+ 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}

References Xroot, and Xunix.

Referenced by fdatasync().

+ Here is the caller graph for this function:

◆ XrdPosix_Fflush()

int XrdPosix_Fflush ( FILE * stream)

Definition at line 285 of file XrdPosix.cc.

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

References Xroot, and Xunix.

Referenced by fflush().

+ Here is the caller graph for this function:

◆ XrdPosix_Fopen()

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

Definition at line 305 of file XrdPosix.cc.

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

References ISMODE, XrdPosixXrootd::isStream, Xroot, XrootPath, and Xunix.

Referenced by fopen64().

+ 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 352 of file XrdPosix.cc.

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

References fseteof(), fseterr(), 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 378 of file XrdPosix.cc.

379{
380
381// Return the result of the fseek
382//
383 if (!Xroot.myFD(fileno(stream)))
384 return Xunix.Fseek( stream, offset, whence);
385
386 return (Xroot.Lseek(fileno(stream), offset, whence) < 0 ? -1 : 0);
387}

References Xroot, and Xunix.

Referenced by fseek().

+ Here is the caller graph for this function:

◆ XrdPosix_Fseeko()

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

Definition at line 396 of file XrdPosix.cc.

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

References Xroot, and Xunix.

Referenced by fseeko64().

+ Here is the caller graph for this function:

◆ XrdPosix_Fstat()

int XrdPosix_Fstat ( int fildes,
struct stat * buf )

Definition at line 414 of file XrdPosix.cc.

415{
416
417// Return result of the close
418//
419 return (Xroot.myFD(fildes)
420 ? Xroot.Fstat(fildes, buf)
421#if defined(__linux__) and defined(_STAT_VER)
422 : Xunix.Fstat64(_STAT_VER, fildes, (struct stat64 *)buf));
423#else
424 : Xunix.Fstat64( fildes, (struct stat64 *)buf));
425#endif
426}
int stat64(const char *path, struct stat64 *buf)

References stat, stat64(), Xroot, and Xunix.

Referenced by 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 448 of file XrdPosix.cc.

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

References Xroot, and Xunix.

Referenced by fsync().

+ Here is the caller graph for this function:

◆ XrdPosix_Ftell()

long XrdPosix_Ftell ( FILE * stream)

Definition at line 464 of file XrdPosix.cc.

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

References Xroot, and Xunix.

Referenced by ftell().

+ Here is the caller graph for this function:

◆ XrdPosix_Ftello()

long long XrdPosix_Ftello ( FILE * stream)

Definition at line 481 of file XrdPosix.cc.

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

References Xroot, and Xunix.

Referenced by ftello64().

+ Here is the caller graph for this function:

◆ XrdPosix_Ftruncate()

int XrdPosix_Ftruncate ( int fildes,
long long offset )

Definition at line 498 of file XrdPosix.cc.

499{
500
501// Return the result of the ftruncate
502//
503 return (Xroot.myFD(fildes) ? Xroot.Ftruncate (fildes, offset)
504 : Xunix.Ftruncate64(fildes, offset));
505}

References Xroot, and Xunix.

Referenced by ftruncate64().

+ 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 514 of file XrdPosix.cc.

515{
516 size_t bytes, rc = 0;
517 int fd = fileno(stream);
518
519 if (!Xroot.myFD(fd)) return Xunix.Fwrite(ptr, size, nitems, stream);
520
521 bytes = Xroot.Write(fd, ptr, size*nitems);
522
523// Get the right return code.
524//
525 if (bytes > 0 && size) rc = bytes/size;
526 else fseterr(stream);
527
528 return rc;
529}

References fseterr(), 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 1080 of file XrdPosix.cc.

1081{
1082 return (0 != XrootPath.URL(path, 0, 0));
1083}

References XrootPath.

◆ XrdPosix_Lseek()

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

Definition at line 572 of file XrdPosix.cc.

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

References Xroot, and Xunix.

Referenced by llseek(), and lseek64().

+ Here is the caller graph for this function:

◆ XrdPosix_Lstat()

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

Definition at line 588 of file XrdPosix.cc.

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

References stat, stat64(), Xroot, XrootPath, and Xunix.

Referenced by 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 614 of file XrdPosix.cc.

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

References Xroot, XrootPath, and Xunix.

Referenced by mkdir().

+ Here is the caller graph for this function:

◆ XrdPosix_Open()

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

Definition at line 639 of file XrdPosix.cc.

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

References Xroot, XrootPath, and Xunix.

Referenced by open64(), and XrdPosix_Creat().

+ Here is the caller graph for this function:

◆ XrdPosix_Opendir()

DIR * XrdPosix_Opendir ( const char * path)

Definition at line 675 of file XrdPosix.cc.

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

References Xroot, XrootPath, and Xunix.

Referenced by opendir().

+ Here is the caller graph for this function:

◆ XrdPosix_Pathconf()

long XrdPosix_Pathconf ( const char * path,
int name )

Definition at line 702 of file XrdPosix.cc.

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

References XrootPath, and Xunix.

Referenced by pathconf().

+ Here is the caller graph for this function:

◆ XrdPosix_Pread()

ssize_t XrdPosix_Pread ( int fildes,
void * buf,
size_t nbyte,
off_t offset )

Definition at line 715 of file XrdPosix.cc.

716{
717
718// Return the results of the read
719//
720 return (Xroot.myFD(fildes) ? Xroot.Pread (fildes, buf, nbyte, offset)
721 : Xunix.Pread64(fildes, buf, nbyte, offset));
722}

References Xroot, and Xunix.

Referenced by pread64().

+ Here is the caller graph for this function:

◆ XrdPosix_Pwrite()

ssize_t XrdPosix_Pwrite ( int fildes,
const void * buf,
size_t nbyte,
off_t offset )

Definition at line 731 of file XrdPosix.cc.

732{
733
734// Return the results of the write
735//
736 return (Xroot.myFD(fildes) ? Xroot.Pwrite (fildes, buf, nbyte, offset)
737 : Xunix.Pwrite64(fildes, buf, nbyte, offset));
738}

References Xroot, and Xunix.

Referenced by pwrite64().

+ Here is the caller graph for this function:

◆ XrdPosix_Read()

ssize_t XrdPosix_Read ( int fildes,
void * buf,
size_t nbyte )

Definition at line 747 of file XrdPosix.cc.

748{
749
750// Return the results of the read
751//
752 return (Xroot.myFD(fildes) ? Xroot.Read(fildes, buf, nbyte)
753 : Xunix.Read(fildes, buf, nbyte));
754}

References Xroot, and Xunix.

Referenced by read().

+ Here is the caller graph for this function:

◆ XrdPosix_Readdir()

struct dirent * XrdPosix_Readdir ( DIR * dirp)

Definition at line 781 of file XrdPosix.cc.

782{
783
784// Return result of readdir
785//
786 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir(dirp)
787 : Xunix.Readdir(dirp));
788}

References Xroot, and Xunix.

◆ XrdPosix_Readdir64()

struct dirent64 * XrdPosix_Readdir64 ( DIR * dirp)

Definition at line 790 of file XrdPosix.cc.

791{
792
793// Return result of readdir
794//
795 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64(dirp)
796 : Xunix.Readdir64(dirp));
797}

References Xroot, and Xunix.

Referenced by readdir64().

+ 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 815 of file XrdPosix.cc.

816{
817
818// Return result of readdir
819//
820 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64_r(dirp,entry,result)
821 : Xunix.Readdir64_r(dirp,entry,result));
822}

References Xroot, and Xunix.

Referenced by readdir64_r().

+ 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 806 of file XrdPosix.cc.

807{
808
809// Return result of readdir
810//
811 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir_r(dirp,entry,result)
812 : Xunix.Readdir_r(dirp,entry,result));
813}

References Xroot, and Xunix.

◆ XrdPosix_Readv()

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

Definition at line 763 of file XrdPosix.cc.

764{
765
766// Return results of the readv
767//
768 return (Xroot.myFD(fildes) ? Xroot.Readv(fildes, iov, iovcnt)
769 : Xunix.Readv(fildes, iov, iovcnt));
770}

References Xroot, and Xunix.

Referenced by readv().

+ Here is the caller graph for this function:

◆ XrdPosix_Rename()

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

Definition at line 831 of file XrdPosix.cc.

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

References Xroot, XrootPath, and Xunix.

Referenced by rename().

+ Here is the caller graph for this function:

◆ XrdPosix_Rewinddir()

void XrdPosix_Rewinddir ( DIR * dirp)

Definition at line 857 of file XrdPosix.cc.

858{
859
860// Return result of rewind
861//
862 return (Xroot.isXrootdDir(dirp) ? Xroot.Rewinddir(dirp)
863 : Xunix.Rewinddir(dirp));
864}

References Xroot, and Xunix.

Referenced by rewinddir().

+ Here is the caller graph for this function:

◆ XrdPosix_Rmdir()

int XrdPosix_Rmdir ( const char * path)

Definition at line 873 of file XrdPosix.cc.

874{
875 char *myPath, buff[2048];
876
877// Make sure a path was passed
878//
879 if (!path) {errno = EFAULT; return -1;}
880
881// Return the results of a mkdir of a Unix file system
882//
883 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
884 return Xunix.Rmdir(path);
885
886// Return the results of an mkdir of an xrootd file system
887//
888 return Xroot.Rmdir(myPath);
889}

References Xroot, XrootPath, and Xunix.

Referenced by rmdir().

+ Here is the caller graph for this function:

◆ XrdPosix_Seekdir()

void XrdPosix_Seekdir ( DIR * dirp,
long loc )

Definition at line 898 of file XrdPosix.cc.

899{
900
901// Call seekdir
902//
903 (Xroot.isXrootdDir(dirp) ? Xroot.Seekdir(dirp, loc)
904 : Xunix.Seekdir(dirp, loc));
905}

References Xroot, and Xunix.

Referenced by seekdir().

+ Here is the caller graph for this function:

◆ XrdPosix_Stat()

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

Definition at line 914 of file XrdPosix.cc.

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

References stat, stat64(), Xroot, XrootPath, and Xunix.

Referenced by 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 940 of file XrdPosix.cc.

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

References statfs, statfs64(), Xroot, XrootPath, and Xunix.

Referenced by 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 962 of file XrdPosix.cc.

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

References statvfs, statvfs64(), Xroot, XrootPath, and Xunix.

Referenced by 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 984 of file XrdPosix.cc.

985{
986
987// Return result of telldir
988//
989 return (Xroot.isXrootdDir(dirp) ? Xroot.Telldir(dirp)
990 : Xunix.Telldir(dirp));
991}

References Xroot, and Xunix.

Referenced by telldir().

+ Here is the caller graph for this function:

◆ XrdPosix_Truncate()

int XrdPosix_Truncate ( const char * path,
off_t offset )

Definition at line 1000 of file XrdPosix.cc.

1001{
1002 char *myPath, buff[2048];
1003
1004// Make sure a path was passed
1005//
1006 if (!path) {errno = EFAULT; return -1;}
1007
1008// Return the results of a truncate of a Unix file system
1009//
1010 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
1011 return Xunix.Truncate64(path, offset);
1012
1013// Return the results of an truncate of an xrootd file system
1014//
1015 return Xroot.Truncate(myPath, offset);
1016}

References Xroot, XrootPath, and Xunix.

Referenced by truncate64().

+ Here is the caller graph for this function:

◆ XrdPosix_Unlink()

int XrdPosix_Unlink ( const char * path)

Definition at line 1025 of file XrdPosix.cc.

1026{
1027 char *myPath, buff[2048];
1028
1029// Make sure a path was passed
1030//
1031 if (!path) {errno = EFAULT; return -1;}
1032
1033// Return the result of a unlink of a Unix file
1034//
1035 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
1036 return Xunix.Unlink(path);
1037
1038// Return the results of an unlink of an xrootd file
1039//
1040 return Xroot.Unlink(myPath);
1041}

References Xroot, XrootPath, and Xunix.

Referenced by unlink().

+ Here is the caller graph for this function:

◆ XrdPosix_URL()

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

Definition at line 1089 of file XrdPosix.cc.

1090{
1091 return XrootPath.URL(path, buff, blen);
1092}

References XrootPath.

◆ XrdPosix_Write()

ssize_t XrdPosix_Write ( int fildes,
const void * buf,
size_t nbyte )

Definition at line 1050 of file XrdPosix.cc.

1051{
1052
1053// Return the results of the write
1054//
1055 return (Xroot.myFD(fildes) ? Xroot.Write(fildes, buf, nbyte)
1056 : Xunix.Write(fildes, buf, nbyte));
1057}

References Xroot, and Xunix.

Referenced by write().

+ Here is the caller graph for this function:

◆ XrdPosix_Writev()

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

Definition at line 1066 of file XrdPosix.cc.

1067{
1068
1069// Return results of the writev
1070//
1071 return (Xroot.myFD(fildes) ? Xroot.Writev(fildes, iov, iovcnt)
1072 : Xunix.Writev(fildes, iov, iovcnt));
1073}

References Xroot, and Xunix.

Referenced by writev().

+ Here is the caller graph for this function:

Variable Documentation

◆ Xroot

◆ XrootPath

◆ Xunix

XrdPosixLinkage Xunix
extern

Definition at line 57 of file XrdPosixLinkage.cc.

Referenced by access(), acl(), chdir(), close(), closedir(), creat64(), fclose(), fcntl64(), fdatasync(), fflush(), fopen64(), fread(), fseek(), fseeko64(), fstat64(), fsync(), ftell(), ftello64(), ftruncate64(), fwrite(), llseek(), lseek64(), lstat64(), mkdir(), open64(), opendir(), pathconf(), pread64(), pwrite64(), read(), readdir64(), readdir64_r(), readv(), rename(), rewinddir(), rmdir(), seekdir(), stat64(), statfs64(), statvfs64(), telldir(), truncate64(), unlink(), write(), writev(), Xrd_U_Access(), Xrd_U_Acl(), Xrd_U_Chdir(), Xrd_U_Close(), Xrd_U_Closedir(), Xrd_U_Fclose(), Xrd_U_Fcntl(), Xrd_U_Fcntl64(), Xrd_U_Fdatasync(), Xrd_U_Fflush(), Xrd_U_Fgetxattr(), Xrd_U_Fopen(), Xrd_U_Fopen64(), Xrd_U_Fread(), Xrd_U_Fseek(), Xrd_U_Fseeko(), Xrd_U_Fseeko64(), Xrd_U_Fstat(), Xrd_U_Fstat64(), Xrd_U_Fsync(), Xrd_U_Ftell(), Xrd_U_Ftello(), Xrd_U_Ftello64(), Xrd_U_Ftruncate(), Xrd_U_Ftruncate64(), Xrd_U_Fwrite(), Xrd_U_Getxattr(), Xrd_U_Lgetxattr(), Xrd_U_Lseek(), Xrd_U_Lseek64(), Xrd_U_Lstat(), Xrd_U_Lstat64(), Xrd_U_Mkdir(), Xrd_U_Open(), Xrd_U_Open64(), Xrd_U_Opendir(), Xrd_U_Pathconf(), Xrd_U_Pread(), Xrd_U_Pread64(), Xrd_U_Pwrite(), Xrd_U_Pwrite64(), Xrd_U_Read(), Xrd_U_Readdir(), Xrd_U_Readdir64(), Xrd_U_Readdir64_r(), Xrd_U_Readdir_r(), Xrd_U_Readv(), Xrd_U_Rename(), Xrd_U_Rewinddir(), Xrd_U_Rmdir(), Xrd_U_Seekdir(), Xrd_U_Stat(), Xrd_U_Stat64(), Xrd_U_Statfs(), Xrd_U_Statfs64(), Xrd_U_Statvfs(), Xrd_U_Statvfs64(), Xrd_U_Telldir(), Xrd_U_Truncate(), Xrd_U_Truncate64(), Xrd_U_Unlink(), Xrd_U_Write(), Xrd_U_Writev(), XrdPosix_Access(), XrdPosix_Acl(), XrdPosix_Chdir(), XrdPosix_Close(), XrdPosix_Closedir(), XrdPosix_Fclose(), XrdPosix_Fcntl(), XrdPosix_Fdatasync(), XrdPosix_Fflush(), XrdPosix_Fopen(), XrdPosix_Fread(), XrdPosix_Fseek(), XrdPosix_Fseeko(), XrdPosix_Fstat(), XrdPosix_Fsync(), XrdPosix_Ftell(), XrdPosix_Ftello(), XrdPosix_Ftruncate(), XrdPosix_Fwrite(), XrdPosix_Lseek(), XrdPosix_Lstat(), XrdPosix_Mkdir(), XrdPosix_Open(), XrdPosix_Opendir(), XrdPosix_Pathconf(), XrdPosix_Pread(), XrdPosix_Pwrite(), XrdPosix_Read(), XrdPosix_Readdir(), XrdPosix_Readdir64(), XrdPosix_Readdir64_r(), XrdPosix_Readdir_r(), XrdPosix_Readv(), XrdPosix_Rename(), XrdPosix_Rewinddir(), XrdPosix_Rmdir(), XrdPosix_Seekdir(), XrdPosix_Stat(), XrdPosix_Statfs(), XrdPosix_Statvfs(), XrdPosix_Telldir(), XrdPosix_Truncate(), XrdPosix_Unlink(), XrdPosix_Write(), and XrdPosix_Writev().