XRootD
Loading...
Searching...
No Matches
XrdPosixExtern.hh File Reference
#include "XrdSys/XrdSysStatx.hh"
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include "XrdPosix/XrdPosixOsDep.hh"
+ Include dependency graph for XrdPosixExtern.hh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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, off_t offset, int whence)
 
int XrdPosix_Fstat (int fildes, struct stat *buf)
 
int XrdPosix_Fstatat (int dirfd, const char *path, struct stat *buf, int flags)
 
int XrdPosix_Fsync (int fildes)
 
long XrdPosix_Ftell (FILE *stream)
 
off_t XrdPosix_Ftello (FILE *stream)
 
int XrdPosix_Ftruncate (int fildes, off_t 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,...)
 
int XrdPosix_Openat (int dirfd, const char *path, int flag,...)
 
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 *oname, const char *nname)
 
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)
 

Function Documentation

◆ XrdPosix_Access()

int XrdPosix_Access ( const char * path,
int amode )
extern

Definition at line 165 of file XrdPosix.cc.

166{
167 char *myPath, buff[2048];
168 char unref[2049];
169
170 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
171 if (res > 0) {
172 // Return the results of a mkdir of a Unix file system
173 //
174 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
175 return Xunix.Access( path, amode);
176
177 // Return the results of our version of access()
178 //
179 return Xroot.Access(myPath, amode);
180 } else {
181 return res;
182 }
183}
XrdPosixXrootd Xroot
Definition XrdPosix.cc:53
static ssize_t XrdResolveLink(const char *path, char *resolved, size_t rsize)
Definition XrdPosix.cc:114
XrdPosixXrootPath XrootPath
Definition XrdPosix.cc:55
XrdPosixLinkage Xunix

References XrdResolveLink(), 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 )
extern

Definition at line 194 of file XrdPosix.cc.

195{
196 char unref[2049];
197
198 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
199 if (res < 0) return res;
200 return (XrootPath.URL(unref, 0, 0)
201 ? Xunix.Acl("/tmp", cmd,nentries,aclbufp)
202 : Xunix.Acl(path, cmd,nentries,aclbufp));
203}

References XrdResolveLink(), 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)
extern

Definition at line 212 of file XrdPosix.cc.

213{
214 int rc;
215 char unref[2049];
216
217 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
218 if (res < 0) return res;
219
220 // Set the working directory if the actual chdir succeeded
221 //
222 if (!(rc = Xunix.Chdir(path))) XrootPath.CWD(unref);
223 return rc;
224}

References XrdResolveLink(), 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)
extern

Definition at line 233 of file XrdPosix.cc.

234{
235
236// Return result of the close
237//
238 return (Xroot.myFD(fildes) ? Xroot.Close(fildes) : Xunix.Close(fildes));
239}

References Xroot, and Xunix.

Referenced by close().

+ Here is the caller graph for this function:

◆ XrdPosix_Closedir()

int XrdPosix_Closedir ( DIR * dirp)
extern

Definition at line 248 of file XrdPosix.cc.

249{
250
251 return (Xroot.isXrootdDir(dirp) ? Xroot.Closedir(dirp)
252 : Xunix.Closedir(dirp));
253}

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 )
extern

Definition at line 262 of file XrdPosix.cc.

263{
264 extern int XrdPosix_Open(const char *path, int oflag, ...);
265
266 return XrdPosix_Open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
267}
int XrdPosix_Open(const char *path, int oflag,...)
Definition XrdPosix.cc:760

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)
extern

Definition at line 276 of file XrdPosix.cc.

277{
278 int nullfd = fileno(stream);
279
280// Close the associated file
281//
282 if (Xroot.myFD(nullfd)) Xroot.Close(nullfd);
283
284// Now close the stream
285//
286 return Xunix.Fclose(stream);
287}

References Xroot, and Xunix.

Referenced by fclose().

+ Here is the caller graph for this function:

◆ XrdPosix_Fcntl()

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

Definition at line 296 of file XrdPosix.cc.

297{
298 va_list ap;
299 void *theArg;
300
301 if (Xroot.myFD(fd)) return 0;
302 va_start(ap, cmd);
303 theArg = va_arg(ap, void *);
304 va_end(ap);
305 return Xunix.Fcntl64(fd, cmd, theArg);
306}

References Xroot, and Xunix.

Referenced by fcntl64().

+ Here is the caller graph for this function:

◆ XrdPosix_Fdatasync()

int XrdPosix_Fdatasync ( int fildes)
extern

Definition at line 315 of file XrdPosix.cc.

316{
317
318// Return the result of the sync
319//
320 return (Xroot.myFD(fildes) ? Xroot.Fsync(fildes)
321 : Xunix.Fsync(fildes));
322}

References Xroot, and Xunix.

Referenced by fdatasync().

+ Here is the caller graph for this function:

◆ XrdPosix_Fflush()

int XrdPosix_Fflush ( FILE * stream)
extern

Definition at line 346 of file XrdPosix.cc.

347{
348
349// Return the result of the fseek
350//
351 if (!stream || !Xroot.myFD(fileno(stream)))
352 return Xunix.Fflush(stream);
353
354 return Xroot.Fsync(fileno(stream));
355}

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 )
extern

Definition at line 366 of file XrdPosix.cc.

367{
368 char *myPath, buff[2048];
369 int erc, fd, omode;
370 FILE *stream;
371
372 char unref[2049];
373
374 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
375 if (res < 0) return 0;
376
377// Transfer to unix if this is not our path
378//
379 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
380 return Xunix.Fopen64(path, mode);
381
382// Translate the mode flags
383//
384 if (ISMODE("r") || ISMODE("rb")) omode = O_RDONLY;
385 else if (ISMODE("w") || ISMODE("wb")) omode = O_WRONLY
386 | O_CREAT | O_TRUNC;
387 else if (ISMODE("a") || ISMODE("ab")) omode = O_WRONLY
388 | O_CREAT | O_APPEND;
389 else if (ISMODE("r+") || ISMODE("rb+") || ISMODE("r+b")) omode = O_RDWR;
390 else if (ISMODE("w+") || ISMODE("wb+") || ISMODE("w+b")) omode = O_RDWR
391 | O_CREAT | O_TRUNC;
392 else if (ISMODE("a+") || ISMODE("ab+") || ISMODE("a+b")) omode = O_RDWR
393 | O_CREAT | O_APPEND;
394 else {errno = EINVAL; return 0;}
395
396// Now open the file
397//
398 if ((fd = Xroot.Open(myPath, omode | XrdPosixXrootd::isStream , 0)) < 0)
399 return 0;
400
401// First obtain a free stream
402//
403 if (!(stream = fdopen(fd, mode)))
404 {erc = errno; Xroot.Close(fd); errno = erc;}
405
406// All done
407//
408 return stream;
409}
#define ISMODE(x)
Definition XrdPosix.cc:362
static const int isStream

References ISMODE, XrdPosixXrootd::isStream, XrdResolveLink(), 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 )
extern

Definition at line 418 of file XrdPosix.cc.

419{
420 ssize_t bytes;
421 size_t rc = 0;
422 int fd = fileno(stream);
423
424 if (!Xroot.myFD(fd)) return Xunix.Fread(ptr, size, nitems, stream);
425
426 bytes = Xroot.Read(fd, ptr, size*nitems);
427
428// Get the right return code. Note that we cannot emulate the flags in sunx86
429//
430 if (bytes > 0 && size) rc = bytes/size;
431 else if (bytes < 0) fseterr(stream);
432 else fseteof(stream);
433
434 return rc;
435}
static void fseterr(FILE *fp)
Definition XrdPosix.cc:67
static void fseteof(FILE *fp)
Definition XrdPosix.cc:90

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 )
extern

Definition at line 444 of file XrdPosix.cc.

445{
446
447// Return the result of the fseek
448//
449 if (!Xroot.myFD(fileno(stream)))
450 return Xunix.Fseek( stream, offset, whence);
451
452 return (Xroot.Lseek(fileno(stream), offset, whence) < 0 ? -1 : 0);
453}

References Xroot, and Xunix.

Referenced by fseek().

+ Here is the caller graph for this function:

◆ XrdPosix_Fseeko()

int XrdPosix_Fseeko ( FILE * stream,
off_t offset,
int whence )
extern

References dirfd, and stat.

◆ XrdPosix_Fstat()

int XrdPosix_Fstat ( int fildes,
struct stat * buf )
extern

Definition at line 480 of file XrdPosix.cc.

481 {
482 if (Xroot.myFD(fildes)){
483 return(Xroot.Fstat(fildes, buf));
484 } else {
485#ifdef SYS_fstat
486 return syscall(SYS_fstat, fildes, buf);
487#else
488 errno = ENOSYS;
489 return -1;
490#endif
491 }
492 }

References stat, and Xroot.

Referenced by fstat64().

+ Here is the caller graph for this function:

◆ XrdPosix_Fstatat()

int XrdPosix_Fstatat ( int dirfd,
const char * path,
struct stat * buf,
int flags )
extern

Definition at line 514 of file XrdPosix.cc.

515{
516 if (path && *path) {
517 char buff[2048];
518 char unref[2049];
519
520 if (!(flags & AT_SYMLINK_NOFOLLOW)) {
521 // We need to follow until path is no longer a link
522 ssize_t res = XrdResolveLink(path, unref, sizeof(unref));
523 if (res < 0) return res;
524 // links are pointing to file unref now which is not a link
525 } else {
526 strncpy(unref, path, 2048);
527 }
528 if (char *myPath = XrootPath.URL(unref, buff, sizeof(buff))) {
529 int ret = Xroot.Stat(myPath, (struct stat *)buf);
530 return (ret);
531 } else {
532 // not a root file
533#ifdef SYS_newfstatat
534 return syscall(SYS_newfstatat, dirfd, path, buf, flags);
535#else
536#ifdef SYS_fstatat
537 return syscall(SYS_fstatat, dirfd, path, buf, flags);
538#else
539 errno = ENOSYS;
540 return -1;
541#endif
542#endif
543 }
544 } else {
545 errno = EFAULT;
546 }
547 return -1;
548}
#define stat(a, b)
Definition XrdPosix.hh:105
#define dirfd(x)

References dirfd, stat, XrdResolveLink(), Xroot, and XrootPath.

Referenced by fstatat64().

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

◆ XrdPosix_Fsync()

int XrdPosix_Fsync ( int fildes)
extern

Definition at line 557 of file XrdPosix.cc.

558{
559
560// Return the result of the sync
561//
562 return (Xroot.myFD(fildes) ? Xroot.Fsync(fildes)
563 : Xunix.Fsync(fildes));
564}

References Xroot, and Xunix.

Referenced by fsync().

+ Here is the caller graph for this function:

◆ XrdPosix_Ftell()

long XrdPosix_Ftell ( FILE * stream)
extern

Definition at line 573 of file XrdPosix.cc.

574{
575
576// Return the result of the tell
577//
578 if (!Xroot.myFD(fileno(stream))) return Xunix.Ftell(stream);
579
580 return static_cast<long>(Xroot.Lseek(fileno(stream), 0, SEEK_CUR));
581}

References Xroot, and Xunix.

Referenced by ftell().

+ Here is the caller graph for this function:

◆ XrdPosix_Ftello()

off_t XrdPosix_Ftello ( FILE * stream)
extern

Definition at line 590 of file XrdPosix.cc.

591{
592
593// Return the result of the tell
594//
595 if (!Xroot.myFD(fileno(stream))) return Xunix.Ftello64(stream);
596
597 return Xroot.Lseek(fileno(stream), 0, SEEK_CUR);
598}

References Xroot, and Xunix.

Referenced by ftello64().

+ Here is the caller graph for this function:

◆ XrdPosix_Ftruncate()

int XrdPosix_Ftruncate ( int fildes,
off_t offset )
extern

References dirfd, stat, statfs, and statvfs.

◆ XrdPosix_Fwrite()

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

Definition at line 623 of file XrdPosix.cc.

624{
625 size_t bytes, rc = 0;
626 int fd = fileno(stream);
627
628 if (!Xroot.myFD(fd)) return Xunix.Fwrite(ptr, size, nitems, stream);
629
630 bytes = Xroot.Write(fd, ptr, size*nitems);
631
632// Get the right return code.
633//
634 if (bytes > 0 && size) rc = bytes/size;
635 else fseterr(stream);
636
637 return rc;
638}

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)
extern

Definition at line 1287 of file XrdPosix.cc.

1288{
1289 return (0 != XrootPath.URL(path, 0, 0));
1290}

References XrootPath.

◆ XrdPosix_Lseek()

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

Definition at line 689 of file XrdPosix.cc.

690{
691
692// Return the operation of the seek
693//
694 return (Xroot.myFD(fildes) ? Xroot.Lseek (fildes, offset, whence)
695 : Xunix.Lseek64(fildes, offset, whence));
696}

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 )
extern

Definition at line 705 of file XrdPosix.cc.

706{
707 char *myPath, buff[2048];
708
709// Make sure a path was passed
710//
711 if (!path) {errno = EFAULT; return -1;}
712
713// Return the results of an open of a Unix file
714//
715 myPath = XrootPath.URL(path, buff, sizeof(buff));
716 if (myPath){
717 return Xroot.Stat(myPath, buf);
718 } else {
719#ifdef SYS_lstat
720 return syscall(SYS_lstat, path, buf);
721#else
722 errno = ENOSYS;
723 return -1;
724#endif
725 }
726}

References stat, Xroot, and XrootPath.

Referenced by lstat64().

+ Here is the caller graph for this function:

◆ XrdPosix_Mkdir()

int XrdPosix_Mkdir ( const char * path,
mode_t mode )
extern

Definition at line 735 of file XrdPosix.cc.

736{
737 char *myPath, buff[2048];
738 char unref[2049];
739
740 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
741 if (res < 0) return res;
742
743// Return the results of a mkdir of a Unix file system
744//
745 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
746 return Xunix.Mkdir(path, mode);
747
748// Return the results of an mkdir of an xrootd file system
749//
750 return Xroot.Mkdir(myPath, mode);
751}

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

Definition at line 760 of file XrdPosix.cc.

761{
762 char *myPath, buff[2048];
763 char unref[2049];
764 va_list ap;
765 int mode;
766 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
767 if (res < 0) return res;
768 // Return the results of an open of a Unix file
769 //
770 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
771 {if (!(oflag & O_CREAT)) return Xunix.Open64(unref, oflag);
772 va_start(ap, oflag);
773 mode = va_arg(ap, int);
774 va_end(ap);
775 return Xunix.Open64(unref, oflag, (mode_t)mode);
776 }
777
778 // Return the results of an open of an xrootd file
779 //
780 if (!(oflag & O_CREAT)) return Xroot.Open(myPath, oflag);
781 va_start(ap, oflag);
782 mode = va_arg(ap, int);
783 va_end(ap);
784 return Xroot.Open(myPath, oflag, (mode_t)mode);
785}

References XrdResolveLink(), Xroot, XrootPath, and Xunix.

Referenced by open64(), and XrdPosix_Creat().

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

◆ XrdPosix_Openat()

int XrdPosix_Openat ( int dirfd,
const char * path,
int flag,
... )
extern

Definition at line 794 of file XrdPosix.cc.

795{
796 char *myPath, buff[2048];
797 char unref[2049];
798 va_list ap;
799 int mode;
800 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
801 if (res < 0) return res;
802
803 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff)))){
804 mode_t mode = 0;
805 if (flag & (O_CREAT)) {
806 va_start(ap, flag);
807 mode = va_arg(ap, int);
808 va_end(ap);
809 }
810#ifdef SYS_openat
811 return (syscall(SYS_openat, dirfd, path, flag, (mode_t)mode));
812#else
813 errno = ENOSYS;
814 return -1;
815#endif
816 } else {
817 // Return the results of an open of an xrootd file
818 //
819 if (!(flag & O_CREAT)) return Xroot.Open(myPath, flag);
820 va_start(ap, flag);
821 mode = va_arg(ap, int);
822 va_end(ap);
823 return Xroot.Open(myPath, flag, (mode_t)mode);
824 }
825}

References dirfd, XrdResolveLink(), Xroot, and XrootPath.

Referenced by openat().

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

◆ XrdPosix_Opendir()

DIR * XrdPosix_Opendir ( const char * path)
extern

Definition at line 834 of file XrdPosix.cc.

835{
836 char *myPath, buff[2048];
837 char unref[2049];
838
839 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
840 if (res < 0) return NULL;
841
842// Unix opendir
843//
844 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
845 return Xunix.Opendir(path);
846
847// Xrootd opendir
848//
849 return Xroot.Opendir(myPath);
850}

References XrdResolveLink(), 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 )
extern

Definition at line 861 of file XrdPosix.cc.

862{
863 char unref[2049];
864
865 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
866 if (res < 0) return res;
867
868 return (XrootPath.URL(unref, 0, 0) ? Xunix.Pathconf("/tmp", name)
869 : Xunix.Pathconf(unref, name));
870}

References XrdResolveLink(), XrootPath, and Xunix.

Referenced by pathconf().

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

◆ XrdPosix_Pread()

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

Definition at line 879 of file XrdPosix.cc.

880{
881
882// Return the results of the read
883//
884 return (Xroot.myFD(fildes) ? Xroot.Pread (fildes, buf, nbyte, offset)
885 : Xunix.Pread64(fildes, buf, nbyte, offset));
886}

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 )
extern

Definition at line 895 of file XrdPosix.cc.

896{
897
898// Return the results of the write
899//
900 return (Xroot.myFD(fildes) ? Xroot.Pwrite (fildes, buf, nbyte, offset)
901 : Xunix.Pwrite64(fildes, buf, nbyte, offset));
902}

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 )
extern

Definition at line 911 of file XrdPosix.cc.

912{
913
914// Return the results of the read
915//
916 return (Xroot.myFD(fildes) ? Xroot.Read(fildes, buf, nbyte)
917 : Xunix.Read(fildes, buf, nbyte));
918}

References Xroot, and Xunix.

Referenced by read().

+ Here is the caller graph for this function:

◆ XrdPosix_Readdir()

struct dirent * XrdPosix_Readdir ( DIR * dirp)
extern

Definition at line 945 of file XrdPosix.cc.

946{
947
948// Return result of readdir
949//
950 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir(dirp)
951 : Xunix.Readdir(dirp));
952}

References Xroot, and Xunix.

◆ XrdPosix_Readdir64()

struct dirent64 * XrdPosix_Readdir64 ( DIR * dirp)
extern

Definition at line 954 of file XrdPosix.cc.

955{
956
957// Return result of readdir
958//
959 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64(dirp)
960 : Xunix.Readdir64(dirp));
961}

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 )
extern

Definition at line 979 of file XrdPosix.cc.

980{
981
982// Return result of readdir
983//
984 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64_r(dirp,entry,result)
985 : Xunix.Readdir64_r(dirp,entry,result));
986}

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 )
extern

Definition at line 970 of file XrdPosix.cc.

971{
972
973// Return result of readdir
974//
975 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir_r(dirp,entry,result)
976 : Xunix.Readdir_r(dirp,entry,result));
977}

References Xroot, and Xunix.

◆ XrdPosix_Readv()

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

Definition at line 927 of file XrdPosix.cc.

928{
929
930// Return results of the readv
931//
932 return (Xroot.myFD(fildes) ? Xroot.Readv(fildes, iov, iovcnt)
933 : Xunix.Readv(fildes, iov, iovcnt));
934}

References Xroot, and Xunix.

Referenced by readv().

+ Here is the caller graph for this function:

◆ XrdPosix_Rename()

int XrdPosix_Rename ( const char * oname,
const char * nname )
extern

Definition at line 995 of file XrdPosix.cc.

996{
997 char *oldPath, buffold[2048], *newPath, buffnew[2048];
998
999// Make sure a path was passed
1000//
1001 if (!oldpath || !newpath) {errno = EFAULT; return -1;}
1002
1003// Return the results of a mkdir of a Unix file system
1004//
1005 if (!(oldPath = XrootPath.URL(oldpath, buffold, sizeof(buffold)))
1006 || !(newPath = XrootPath.URL(newpath, buffnew, sizeof(buffnew))))
1007 return Xunix.Rename(oldpath, newpath);
1008
1009// Return the results of an mkdir of an xrootd file system
1010//
1011 return Xroot.Rename(oldPath, newPath);
1012}

References Xroot, XrootPath, and Xunix.

Referenced by rename().

+ Here is the caller graph for this function:

◆ XrdPosix_Rewinddir()

void XrdPosix_Rewinddir ( DIR * dirp)
extern

Definition at line 1021 of file XrdPosix.cc.

1022{
1023
1024// Return result of rewind
1025//
1026 return (Xroot.isXrootdDir(dirp) ? Xroot.Rewinddir(dirp)
1027 : Xunix.Rewinddir(dirp));
1028}

References Xroot, and Xunix.

Referenced by rewinddir().

+ Here is the caller graph for this function:

◆ XrdPosix_Rmdir()

int XrdPosix_Rmdir ( const char * path)
extern

Definition at line 1037 of file XrdPosix.cc.

1038{
1039 char *myPath, buff[2048];
1040
1041// Make sure a path was passed
1042//
1043 if (!path) {errno = EFAULT; return -1;}
1044
1045// Return the results of a mkdir of a Unix file system
1046//
1047 if (!(myPath = XrootPath.URL(path, buff, sizeof(buff))))
1048 return Xunix.Rmdir(path);
1049
1050// Return the results of an mkdir of an xrootd file system
1051//
1052 return Xroot.Rmdir(myPath);
1053}

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 )
extern

Definition at line 1062 of file XrdPosix.cc.

1063{
1064
1065// Call seekdir
1066//
1067 (Xroot.isXrootdDir(dirp) ? Xroot.Seekdir(dirp, loc)
1068 : Xunix.Seekdir(dirp, loc));
1069}

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 )
extern

Definition at line 1078 of file XrdPosix.cc.

1079{
1080 char buff[2048];
1081 char unref[2049];
1082
1083 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
1084 if (res < 0) return res;
1085
1086 // links are pointing to file unref now which is not a link
1087 if (char *myPath = XrootPath.URL(unref, buff, sizeof(buff))) {
1088 int ret = Xroot.Stat(myPath, buf);
1089 return (ret);
1090 } else {
1091 // not a root file
1092#ifdef SYS_stat
1093 return syscall(SYS_stat, path, buf);
1094#else
1095 errno = ENOSYS;
1096 return -1;
1097#endif
1098 }
1099}

References stat, XrdResolveLink(), Xroot, and XrootPath.

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 )
extern

Definition at line 1146 of file XrdPosix.cc.

1147{
1148 char *myPath, buff[2048];
1149
1150 char unref[2049];
1151
1152 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
1153 if (res < 0) return res;
1154
1155// Return the results of an open of a Unix file
1156//
1157 return ((myPath = XrootPath.URL(unref, buff, sizeof(buff)))
1158 ? Xroot.Statfs(myPath, buf)
1159 : Xunix.Statfs64(path, (struct statfs64 *)buf));
1160}
int statfs64(const char *path, struct statfs64 *buf)

References statfs, statfs64(), XrdResolveLink(), 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 )
extern

Definition at line 1169 of file XrdPosix.cc.

1170{
1171 char *myPath, buff[2048];
1172 char unref[2049];
1173
1174 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
1175 if (res < 0) return res;
1176
1177// Return the results of an open of a Unix file
1178//
1179 return ((myPath = XrootPath.URL(unref, buff, sizeof(buff)))
1180 ? Xroot.Statvfs(myPath, buf)
1181 : Xunix.Statvfs64(path, (struct statvfs64 *)buf));
1182}
int statvfs64(const char *path, struct statvfs64 *buf)

References statvfs, statvfs64(), XrdResolveLink(), 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 )
extern

Definition at line 1104 of file XrdPosix.cc.

1106{
1107 if (path && *path) {
1108 char buff[2048];
1109 char unref[2049];
1110
1111 if (!(flags & AT_SYMLINK_NOFOLLOW)) {
1112 // We need to follow until path is no longer a link
1113 ssize_t res = XrdResolveLink(path, unref, sizeof(unref));
1114 if (res < 0) return res;
1115 } else {
1116 strncpy(unref, path, 2048);
1117 }
1118 if (char *myPath = XrootPath.URL(unref, buff, sizeof(buff))) {
1119 struct stat st{};
1120 if (int ret = XrdPosix_Stat(myPath, &st))
1121 return ret;
1122 XrdSysStatxHelpers::Stat2Statx(st, *stx);
1123 return 0;
1124 } else {
1125#ifdef SYS_statx
1126 int ret = syscall(SYS_statx, dirfd, path, flags, mask, stx);
1127 return ret;
1128#else
1129 errno = ENOSYS;
1130 return -1;
1131#endif
1132 }
1133 } else {
1134 errno = EFAULT;
1135 }
1136 return -1;
1137}
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition XrdPosix.cc:1078

References dirfd, stat, XrdPosix_Stat(), XrdResolveLink(), and XrootPath.

+ Here is the call graph for this function:

◆ XrdPosix_Telldir()

long XrdPosix_Telldir ( DIR * dirp)
extern

Definition at line 1191 of file XrdPosix.cc.

1192{
1193
1194// Return result of telldir
1195//
1196 return (Xroot.isXrootdDir(dirp) ? Xroot.Telldir(dirp)
1197 : Xunix.Telldir(dirp));
1198}

References Xroot, and Xunix.

◆ XrdPosix_Truncate()

int XrdPosix_Truncate ( const char * path,
off_t offset )
extern

Definition at line 1207 of file XrdPosix.cc.

1208{
1209 char *myPath, buff[2048];
1210 char unref[2049];
1211
1212 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
1213 if (res < 0) return res;
1214
1215// Return the results of a truncate of a Unix file system
1216//
1217 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
1218 return Xunix.Truncate64(path, offset);
1219
1220// Return the results of an truncate of an xrootd file system
1221//
1222 return Xroot.Truncate(myPath, offset);
1223}

References XrdResolveLink(), Xroot, XrootPath, and Xunix.

+ Here is the call graph for this function:

◆ XrdPosix_Unlink()

int XrdPosix_Unlink ( const char * path)
extern

Definition at line 1232 of file XrdPosix.cc.

1233{
1234 char *myPath, buff[2048];
1235 char unref[2049];
1236
1237 ssize_t res=XrdResolveLink(path, unref, sizeof(unref));
1238 if (res < 0) return res;
1239
1240// Return the result of a unlink of a Unix file
1241//
1242 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
1243 return Xunix.Unlink(path);
1244
1245// Return the results of an unlink of an xrootd file
1246//
1247 return Xroot.Unlink(myPath);
1248}

References XrdResolveLink(), Xroot, XrootPath, and Xunix.

+ Here is the call graph for this function:

◆ XrdPosix_URL()

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

Definition at line 1296 of file XrdPosix.cc.

1297{
1298 return XrootPath.URL(path, buff, blen);
1299}

References XrootPath.

◆ XrdPosix_Write()

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

Definition at line 1257 of file XrdPosix.cc.

1258{
1259
1260// Return the results of the write
1261//
1262 return (Xroot.myFD(fildes) ? Xroot.Write(fildes, buf, nbyte)
1263 : Xunix.Write(fildes, buf, nbyte));
1264}

References Xroot, and Xunix.

◆ XrdPosix_Writev()

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

Definition at line 1273 of file XrdPosix.cc.

1274{
1275
1276// Return results of the writev
1277//
1278 return (Xroot.myFD(fildes) ? Xroot.Writev(fildes, iov, iovcnt)
1279 : Xunix.Writev(fildes, iov, iovcnt));
1280}

References Xroot, and Xunix.