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 <sys/syscall.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 "XrdSys/XrdSysStatx.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)
int XrdPosix_Statx (int dirfd, const char *path, int flags, unsigned int mask, XrdSysStatx *stx)
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 303 of file XrdPosix.cc.

Referenced by XrdPosix_Fopen().

Function Documentation

◆ fseteof()

void fseteof ( FILE * fp)
inlinestatic

Definition at line 89 of file XrdPosix.cc.

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

References fseek.

Referenced by XrdPosix_Fread().

Here is the caller graph for this function:

◆ fseterr()

void fseterr ( FILE * fp)
inlinestatic

Definition at line 66 of file XrdPosix.cc.

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

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

117{
118 char *myPath, buff[2048];
119
120// Make sure a path was passed
121//
122 if (!path) {errno = EFAULT; return -1;}
123
124// Return the results of a mkdir of a Unix file system
125//
126 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
127 return Xunix.Access( path, amode);
128
129// Return the results of our version of access()
130//
131 return Xroot.Access(myPath, amode);
132}
XrdPosixXrootd Xroot
Definition XrdPosix.cc:52
XrdPosixXrootPath XrootPath
Definition XrdPosix.cc:54
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 143 of file XrdPosix.cc.

144{
145 return (XrootPath.URL(path, 0, 0)
146 ? Xunix.Acl("/tmp", cmd,nentries,aclbufp)
147 : Xunix.Acl(path, cmd,nentries,aclbufp));
148}

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

158{
159 int rc;
160
161// Set the working directory if the actual chdir succeeded
162//
163 if (!(rc = Xunix.Chdir(path))) XrootPath.CWD(path);
164 return rc;
165}

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

175{
176
177// Return result of the close
178//
179 return (Xroot.myFD(fildes) ? Xroot.Close(fildes) : Xunix.Close(fildes));
180}

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

190{
191
192 return (Xroot.isXrootdDir(dirp) ? Xroot.Closedir(dirp)
193 : Xunix.Closedir(dirp));
194}

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

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

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

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

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

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

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

257{
258
259// Return the result of the sync
260//
261 return (Xroot.myFD(fildes) ? Xroot.Fsync(fildes)
262 : Xunix.Fsync(fildes));
263}

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

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

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

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

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

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

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

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

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

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

417{
418
419// Return result of the close
420//
421 return (Xroot.myFD(fildes)
422 ? Xroot.Fstat(fildes, buf)
423#if defined(__linux__) and defined(_STAT_VER)
424 : Xunix.Fstat64(_STAT_VER, fildes, (struct stat64 *)buf));
425#else
426 : Xunix.Fstat64( fildes, (struct stat64 *)buf));
427#endif
428}
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 450 of file XrdPosix.cc.

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

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

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

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

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

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

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

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

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

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

1109{
1110 return (0 != XrootPath.URL(path, 0, 0));
1111}

References XrootPath.

◆ XrdPosix_Lseek()

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

Definition at line 574 of file XrdPosix.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

References Xroot, and Xunix.

◆ XrdPosix_Readdir64()

struct dirent64 * XrdPosix_Readdir64 ( DIR * dirp)

Definition at line 792 of file XrdPosix.cc.

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

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

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

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

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

References Xroot, and Xunix.

◆ XrdPosix_Readv()

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

Definition at line 765 of file XrdPosix.cc.

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

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

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

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

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

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

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

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

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

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

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

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

Referenced by stat64(), and XrdPosix_Statx().

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

969{
970 char *myPath, buff[2048];
971
972// Make sure a path was passed
973//
974 if (!path) {errno = EFAULT; return -1;}
975
976// Return the results of an open of a Unix file
977//
978 return ((myPath = XrootPath.URL(path, buff, sizeof(buff)))
979 ? Xroot.Statfs(myPath, buf)
980 : Xunix.Statfs64(path, (struct statfs64 *)buf));
981}
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 990 of file XrdPosix.cc.

991{
992 char *myPath, buff[2048];
993
994// Make sure a path was passed
995//
996 if (!path) {errno = EFAULT; return -1;}
997
998// Return the results of an open of a Unix file
999//
1000 return ((myPath = XrootPath.URL(path, buff, sizeof(buff)))
1001 ? Xroot.Statvfs(myPath, buf)
1002 : Xunix.Statvfs64(path, (struct statvfs64 *)buf));
1003}
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_Statx()

int XrdPosix_Statx ( int dirfd,
const char * path,
int flags,
unsigned int mask,
XrdSysStatx * stx )

Definition at line 938 of file XrdPosix.cc.

940{
941 if (path && *path) {
942 char buff[2048];
943 if (char *myPath = XrootPath.URL(path, buff, sizeof(buff))) {
944 struct stat st{};
945
946 if (int ret = XrdPosix_Stat(myPath, &st))
947 return ret;
948
950 return 0;
951 }
952 }
953#ifdef SYS_statx
954 return syscall(SYS_statx, dirfd, path, flags, mask, stx);
955#else
956 errno = ENOSYS;
957 return -1;
958#endif
959}
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition XrdPosix.cc:916
#define stat(a, b)
Definition XrdPosix.hh:101
#define dirfd(x)
static void Stat2Statx(const struct stat &stat, XrdSysStatx &statx)

References dirfd, stat, XrdSysStatxHelpers::Stat2Statx(), XrdPosix_Stat(), and XrootPath.

Here is the call graph for this function:

◆ XrdPosix_Telldir()

long XrdPosix_Telldir ( DIR * dirp)

Definition at line 1012 of file XrdPosix.cc.

1013{
1014
1015// Return result of telldir
1016//
1017 return (Xroot.isXrootdDir(dirp) ? Xroot.Telldir(dirp)
1018 : Xunix.Telldir(dirp));
1019}

References Xroot, and Xunix.

◆ XrdPosix_Truncate()

int XrdPosix_Truncate ( const char * path,
off_t offset )

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 results of a truncate of a Unix file system
1037//
1038 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
1039 return Xunix.Truncate64(path, offset);
1040
1041// Return the results of an truncate of an xrootd file system
1042//
1043 return Xroot.Truncate(myPath, offset);
1044}

References Xroot, XrootPath, and Xunix.

◆ XrdPosix_Unlink()

int XrdPosix_Unlink ( const char * path)

Definition at line 1053 of file XrdPosix.cc.

1054{
1055 char *myPath, buff[2048];
1056
1057// Make sure a path was passed
1058//
1059 if (!path) {errno = EFAULT; return -1;}
1060
1061// Return the result of a unlink of a Unix file
1062//
1063 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
1064 return Xunix.Unlink(path);
1065
1066// Return the results of an unlink of an xrootd file
1067//
1068 return Xroot.Unlink(myPath);
1069}

References Xroot, XrootPath, and Xunix.

◆ XrdPosix_URL()

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

Definition at line 1117 of file XrdPosix.cc.

1118{
1119 return XrootPath.URL(path, buff, blen);
1120}

References XrootPath.

◆ XrdPosix_Write()

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

Definition at line 1078 of file XrdPosix.cc.

1079{
1080
1081// Return the results of the write
1082//
1083 return (Xroot.myFD(fildes) ? Xroot.Write(fildes, buf, nbyte)
1084 : Xunix.Write(fildes, buf, nbyte));
1085}

References Xroot, and Xunix.

◆ XrdPosix_Writev()

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

Definition at line 1094 of file XrdPosix.cc.

1095{
1096
1097// Return results of the writev
1098//
1099 return (Xroot.myFD(fildes) ? Xroot.Writev(fildes, iov, iovcnt)
1100 : Xunix.Writev(fildes, iov, iovcnt));
1101}

References Xroot, and Xunix.

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(), 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().