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

153{
154 char *myPath, buff[2048];
155 char unref[2049];
156
157 ssize_t res=XrdResolveLink(path, unref);
158 if (res > 0) {
159 // Return the results of a mkdir of a Unix file system
160 //
161 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
162 return Xunix.Access( path, amode);
163
164 // Return the results of our version of access()
165 //
166 return Xroot.Access(myPath, amode);
167 } else {
168 return res;
169 }
170}
static ssize_t XrdResolveLink(const char *path, char *resolved)
Definition XrdPosix.cc:114
XrdPosixXrootd Xroot
Definition XrdPosix.cc:53
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 181 of file XrdPosix.cc.

182{
183 char unref[2049];
184
185 ssize_t res=XrdResolveLink(path, unref);
186 if (res < 0) return res;
187 return (XrootPath.URL(unref, 0, 0)
188 ? Xunix.Acl("/tmp", cmd,nentries,aclbufp)
189 : Xunix.Acl(path, cmd,nentries,aclbufp));
190}

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

200{
201 int rc;
202 char unref[2049];
203
204 ssize_t res=XrdResolveLink(path, unref);
205 if (res < 0) return res;
206
207 // Set the working directory if the actual chdir succeeded
208 //
209 if (!(rc = Xunix.Chdir(path))) XrootPath.CWD(unref);
210 return rc;
211}

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

221{
222
223// Return result of the close
224//
225 return (Xroot.myFD(fildes) ? Xroot.Close(fildes) : Xunix.Close(fildes));
226}

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

236{
237
238 return (Xroot.isXrootdDir(dirp) ? Xroot.Closedir(dirp)
239 : Xunix.Closedir(dirp));
240}

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

250{
251 extern int XrdPosix_Open(const char *path, int oflag, ...);
252
253 return XrdPosix_Open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
254}
int XrdPosix_Open(const char *path, int oflag,...)
Definition XrdPosix.cc:747

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

264{
265 int nullfd = fileno(stream);
266
267// Close the associated file
268//
269 if (Xroot.myFD(nullfd)) Xroot.Close(nullfd);
270
271// Now close the stream
272//
273 return Xunix.Fclose(stream);
274}

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

284{
285 va_list ap;
286 void *theArg;
287
288 if (Xroot.myFD(fd)) return 0;
289 va_start(ap, cmd);
290 theArg = va_arg(ap, void *);
291 va_end(ap);
292 return Xunix.Fcntl64(fd, cmd, theArg);
293}

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

303{
304
305// Return the result of the sync
306//
307 return (Xroot.myFD(fildes) ? Xroot.Fsync(fildes)
308 : Xunix.Fsync(fildes));
309}

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

334{
335
336// Return the result of the fseek
337//
338 if (!stream || !Xroot.myFD(fileno(stream)))
339 return Xunix.Fflush(stream);
340
341 return Xroot.Fsync(fileno(stream));
342}

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

354{
355 char *myPath, buff[2048];
356 int erc, fd, omode;
357 FILE *stream;
358
359 char unref[2049];
360
361 ssize_t res=XrdResolveLink(path, unref);
362 if (res < 0) return 0;
363
364// Transfer to unix if this is not our path
365//
366 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
367 return Xunix.Fopen64(path, mode);
368
369// Translate the mode flags
370//
371 if (ISMODE("r") || ISMODE("rb")) omode = O_RDONLY;
372 else if (ISMODE("w") || ISMODE("wb")) omode = O_WRONLY
373 | O_CREAT | O_TRUNC;
374 else if (ISMODE("a") || ISMODE("ab")) omode = O_WRONLY
375 | O_CREAT | O_APPEND;
376 else if (ISMODE("r+") || ISMODE("rb+") || ISMODE("r+b")) omode = O_RDWR;
377 else if (ISMODE("w+") || ISMODE("wb+") || ISMODE("w+b")) omode = O_RDWR
378 | O_CREAT | O_TRUNC;
379 else if (ISMODE("a+") || ISMODE("ab+") || ISMODE("a+b")) omode = O_RDWR
380 | O_CREAT | O_APPEND;
381 else {errno = EINVAL; return 0;}
382
383// Now open the file
384//
385 if ((fd = Xroot.Open(myPath, omode | XrdPosixXrootd::isStream , 0)) < 0)
386 return 0;
387
388// First obtain a free stream
389//
390 if (!(stream = fdopen(fd, mode)))
391 {erc = errno; Xroot.Close(fd); errno = erc;}
392
393// All done
394//
395 return stream;
396}
#define ISMODE(x)
Definition XrdPosix.cc:349
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 405 of file XrdPosix.cc.

406{
407 ssize_t bytes;
408 size_t rc = 0;
409 int fd = fileno(stream);
410
411 if (!Xroot.myFD(fd)) return Xunix.Fread(ptr, size, nitems, stream);
412
413 bytes = Xroot.Read(fd, ptr, size*nitems);
414
415// Get the right return code. Note that we cannot emulate the flags in sunx86
416//
417 if (bytes > 0 && size) rc = bytes/size;
418 else if (bytes < 0) fseterr(stream);
419 else fseteof(stream);
420
421 return rc;
422}
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 431 of file XrdPosix.cc.

432{
433
434// Return the result of the fseek
435//
436 if (!Xroot.myFD(fileno(stream)))
437 return Xunix.Fseek( stream, offset, whence);
438
439 return (Xroot.Lseek(fileno(stream), offset, whence) < 0 ? -1 : 0);
440}

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

468 {
469 if (Xroot.myFD(fildes)){
470 return(Xroot.Fstat(fildes, buf));
471 } else {
472#ifdef SYS_fstat
473 return syscall(SYS_fstat, fildes, buf);
474#else
475 errno = ENOSYS;
476 return -1;
477#endif
478 }
479 }

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

502{
503 if (path && *path) {
504 char buff[2048];
505 char unref[2049];
506
507 if (!(flags & AT_SYMLINK_NOFOLLOW)) {
508 // We need to follow until path is no longer a link
509 ssize_t res = XrdResolveLink(path, unref);
510 if (res < 0) return res;
511 // links are pointing to file unref now which is not a link
512 } else {
513 strncpy(unref, path, 2048);
514 }
515 if (char *myPath = XrootPath.URL(unref, buff, sizeof(buff))) {
516 int ret = Xroot.Stat(myPath, (struct stat *)buf);
517 return (ret);
518 } else {
519 // not a root file
520#ifdef SYS_newfstatat
521 return syscall(SYS_newfstatat, dirfd, path, buf, flags);
522#else
523#ifdef SYS_fstatat
524 return syscall(SYS_fstatat, dirfd, path, buf, flags);
525#else
526 errno = ENOSYS;
527 return -1;
528#endif
529#endif
530 }
531 } else {
532 errno = EFAULT;
533 }
534 return -1;
535}
#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 544 of file XrdPosix.cc.

545{
546
547// Return the result of the sync
548//
549 return (Xroot.myFD(fildes) ? Xroot.Fsync(fildes)
550 : Xunix.Fsync(fildes));
551}

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

561{
562
563// Return the result of the tell
564//
565 if (!Xroot.myFD(fileno(stream))) return Xunix.Ftell(stream);
566
567 return static_cast<long>(Xroot.Lseek(fileno(stream), 0, SEEK_CUR));
568}

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

578{
579
580// Return the result of the tell
581//
582 if (!Xroot.myFD(fileno(stream))) return Xunix.Ftello64(stream);
583
584 return Xroot.Lseek(fileno(stream), 0, SEEK_CUR);
585}

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

611{
612 size_t bytes, rc = 0;
613 int fd = fileno(stream);
614
615 if (!Xroot.myFD(fd)) return Xunix.Fwrite(ptr, size, nitems, stream);
616
617 bytes = Xroot.Write(fd, ptr, size*nitems);
618
619// Get the right return code.
620//
621 if (bytes > 0 && size) rc = bytes/size;
622 else fseterr(stream);
623
624 return rc;
625}

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

1275{
1276 return (0 != XrootPath.URL(path, 0, 0));
1277}

References XrootPath.

◆ XrdPosix_Lseek()

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

Definition at line 676 of file XrdPosix.cc.

677{
678
679// Return the operation of the seek
680//
681 return (Xroot.myFD(fildes) ? Xroot.Lseek (fildes, offset, whence)
682 : Xunix.Lseek64(fildes, offset, whence));
683}

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

693{
694 char *myPath, buff[2048];
695
696// Make sure a path was passed
697//
698 if (!path) {errno = EFAULT; return -1;}
699
700// Return the results of an open of a Unix file
701//
702 myPath = XrootPath.URL(path, buff, sizeof(buff));
703 if (myPath){
704 return Xroot.Stat(myPath, buf);
705 } else {
706#ifdef SYS_lstat
707 return syscall(SYS_lstat, path, buf);
708#else
709 errno = ENOSYS;
710 return -1;
711#endif
712 }
713}

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

723{
724 char *myPath, buff[2048];
725 char unref[2049];
726
727 ssize_t res=XrdResolveLink(path, unref);
728 if (res < 0) return res;
729
730// Return the results of a mkdir of a Unix file system
731//
732 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
733 return Xunix.Mkdir(path, mode);
734
735// Return the results of an mkdir of an xrootd file system
736//
737 return Xroot.Mkdir(myPath, mode);
738}

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

748{
749 char *myPath, buff[2048];
750 char unref[2049];
751 va_list ap;
752 int mode;
753 ssize_t res=XrdResolveLink(path, unref);
754 if (res < 0) return res;
755 // Return the results of an open of a Unix file
756 //
757 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
758 {if (!(oflag & O_CREAT)) return Xunix.Open64(unref, oflag);
759 va_start(ap, oflag);
760 mode = va_arg(ap, int);
761 va_end(ap);
762 return Xunix.Open64(unref, oflag, (mode_t)mode);
763 }
764
765 // Return the results of an open of an xrootd file
766 //
767 if (!(oflag & O_CREAT)) return Xroot.Open(myPath, oflag);
768 va_start(ap, oflag);
769 mode = va_arg(ap, int);
770 va_end(ap);
771 return Xroot.Open(myPath, oflag, (mode_t)mode);
772}

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

782{
783 char *myPath, buff[2048];
784 char unref[2049];
785 va_list ap;
786 int mode;
787 ssize_t res=XrdResolveLink(path, unref);
788 if (res < 0) return res;
789
790 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff)))){
791 mode_t mode = 0;
792 if (flag & (O_CREAT)) {
793 va_start(ap, flag);
794 mode = va_arg(ap, int);
795 va_end(ap);
796 }
797#ifdef SYS_openat
798 return (syscall(SYS_openat, dirfd, path, flag, (mode_t)mode));
799#else
800 errno = ENOSYS;
801 return -1;
802#endif
803 } else {
804 // Return the results of an open of an xrootd file
805 //
806 if (!(flag & O_CREAT)) return Xroot.Open(myPath, flag);
807 va_start(ap, flag);
808 mode = va_arg(ap, int);
809 va_end(ap);
810 return Xroot.Open(myPath, flag, (mode_t)mode);
811 }
812}

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

822{
823 char *myPath, buff[2048];
824 char unref[2049];
825
826 ssize_t res=XrdResolveLink(path, unref);
827 if (res < 0) return NULL;
828
829// Unix opendir
830//
831 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
832 return Xunix.Opendir(path);
833
834// Xrootd opendir
835//
836 return Xroot.Opendir(myPath);
837}

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

849{
850 char unref[2049];
851
852 ssize_t res=XrdResolveLink(path, unref);
853 if (res < 0) return res;
854
855 return (XrootPath.URL(unref, 0, 0) ? Xunix.Pathconf("/tmp", name)
856 : Xunix.Pathconf(unref, name));
857}

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

867{
868
869// Return the results of the read
870//
871 return (Xroot.myFD(fildes) ? Xroot.Pread (fildes, buf, nbyte, offset)
872 : Xunix.Pread64(fildes, buf, nbyte, offset));
873}

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

883{
884
885// Return the results of the write
886//
887 return (Xroot.myFD(fildes) ? Xroot.Pwrite (fildes, buf, nbyte, offset)
888 : Xunix.Pwrite64(fildes, buf, nbyte, offset));
889}

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

899{
900
901// Return the results of the read
902//
903 return (Xroot.myFD(fildes) ? Xroot.Read(fildes, buf, nbyte)
904 : Xunix.Read(fildes, buf, nbyte));
905}

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

933{
934
935// Return result of readdir
936//
937 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir(dirp)
938 : Xunix.Readdir(dirp));
939}

References Xroot, and Xunix.

◆ XrdPosix_Readdir64()

struct dirent64 * XrdPosix_Readdir64 ( DIR * dirp)
extern

Definition at line 941 of file XrdPosix.cc.

942{
943
944// Return result of readdir
945//
946 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64(dirp)
947 : Xunix.Readdir64(dirp));
948}

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

967{
968
969// Return result of readdir
970//
971 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir64_r(dirp,entry,result)
972 : Xunix.Readdir64_r(dirp,entry,result));
973}

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

958{
959
960// Return result of readdir
961//
962 return (Xroot.isXrootdDir(dirp) ? Xroot.Readdir_r(dirp,entry,result)
963 : Xunix.Readdir_r(dirp,entry,result));
964}

References Xroot, and Xunix.

◆ XrdPosix_Readv()

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

Definition at line 914 of file XrdPosix.cc.

915{
916
917// Return results of the readv
918//
919 return (Xroot.myFD(fildes) ? Xroot.Readv(fildes, iov, iovcnt)
920 : Xunix.Readv(fildes, iov, iovcnt));
921}

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

983{
984 char *oldPath, buffold[2048], *newPath, buffnew[2048];
985
986// Make sure a path was passed
987//
988 if (!oldpath || !newpath) {errno = EFAULT; return -1;}
989
990// Return the results of a mkdir of a Unix file system
991//
992 if (!(oldPath = XrootPath.URL(oldpath, buffold, sizeof(buffold)))
993 || !(newPath = XrootPath.URL(newpath, buffnew, sizeof(buffnew))))
994 return Xunix.Rename(oldpath, newpath);
995
996// Return the results of an mkdir of an xrootd file system
997//
998 return Xroot.Rename(oldPath, newPath);
999}

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

1009{
1010
1011// Return result of rewind
1012//
1013 return (Xroot.isXrootdDir(dirp) ? Xroot.Rewinddir(dirp)
1014 : Xunix.Rewinddir(dirp));
1015}

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

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

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

1050{
1051
1052// Call seekdir
1053//
1054 (Xroot.isXrootdDir(dirp) ? Xroot.Seekdir(dirp, loc)
1055 : Xunix.Seekdir(dirp, loc));
1056}

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

1066{
1067 char buff[2048];
1068 char unref[2049];
1069
1070 ssize_t res=XrdResolveLink(path, unref);
1071 if (res < 0) return res;
1072
1073 // links are pointing to file unref now which is not a link
1074 if (char *myPath = XrootPath.URL(unref, buff, sizeof(buff))) {
1075 int ret = Xroot.Stat(myPath, buf);
1076 return (ret);
1077 } else {
1078 // not a root file
1079#ifdef SYS_stat
1080 return syscall(SYS_stat, path, buf);
1081#else
1082 errno = ENOSYS;
1083 return -1;
1084#endif
1085 }
1086}

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

1134{
1135 char *myPath, buff[2048];
1136
1137 char unref[2049];
1138
1139 ssize_t res=XrdResolveLink(path, unref);
1140 if (res < 0) return res;
1141
1142// Return the results of an open of a Unix file
1143//
1144 return ((myPath = XrootPath.URL(unref, buff, sizeof(buff)))
1145 ? Xroot.Statfs(myPath, buf)
1146 : Xunix.Statfs64(path, (struct statfs64 *)buf));
1147}
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 1156 of file XrdPosix.cc.

1157{
1158 char *myPath, buff[2048];
1159 char unref[2049];
1160
1161 ssize_t res=XrdResolveLink(path, unref);
1162 if (res < 0) return res;
1163
1164// Return the results of an open of a Unix file
1165//
1166 return ((myPath = XrootPath.URL(unref, buff, sizeof(buff)))
1167 ? Xroot.Statvfs(myPath, buf)
1168 : Xunix.Statvfs64(path, (struct statvfs64 *)buf));
1169}
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 1091 of file XrdPosix.cc.

1093{
1094 if (path && *path) {
1095 char buff[2048];
1096 char unref[2049];
1097
1098 if (!(flags & AT_SYMLINK_NOFOLLOW)) {
1099 // We need to follow until path is no longer a link
1100 ssize_t res = XrdResolveLink(path, unref);
1101 if (res < 0) return res;
1102 } else {
1103 strncpy(unref, path, 2048);
1104 }
1105 if (char *myPath = XrootPath.URL(unref, buff, sizeof(buff))) {
1106 struct stat st{};
1107 if (int ret = XrdPosix_Stat(myPath, &st))
1108 return ret;
1110 return 0;
1111 } else {
1112#ifdef SYS_statx
1113 int ret = syscall(SYS_statx, dirfd, path, flags, mask, stx);
1114 return ret;
1115#else
1116 errno = ENOSYS;
1117 return -1;
1118#endif
1119 }
1120 } else {
1121 errno = EFAULT;
1122 }
1123 return -1;
1124}
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition XrdPosix.cc:1065
static void Stat2Statx(const struct stat &stat, XrdSysStatx &statx)

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

+ Here is the call graph for this function:

◆ XrdPosix_Telldir()

long XrdPosix_Telldir ( DIR * dirp)
extern

Definition at line 1178 of file XrdPosix.cc.

1179{
1180
1181// Return result of telldir
1182//
1183 return (Xroot.isXrootdDir(dirp) ? Xroot.Telldir(dirp)
1184 : Xunix.Telldir(dirp));
1185}

References Xroot, and Xunix.

◆ XrdPosix_Truncate()

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

Definition at line 1194 of file XrdPosix.cc.

1195{
1196 char *myPath, buff[2048];
1197 char unref[2049];
1198
1199 ssize_t res=XrdResolveLink(path, unref);
1200 if (res < 0) return res;
1201
1202// Return the results of a truncate of a Unix file system
1203//
1204 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
1205 return Xunix.Truncate64(path, offset);
1206
1207// Return the results of an truncate of an xrootd file system
1208//
1209 return Xroot.Truncate(myPath, offset);
1210}

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

1220{
1221 char *myPath, buff[2048];
1222 char unref[2049];
1223
1224 ssize_t res=XrdResolveLink(path, unref);
1225 if (res < 0) return res;
1226
1227// Return the result of a unlink of a Unix file
1228//
1229 if (!(myPath = XrootPath.URL(unref, buff, sizeof(buff))))
1230 return Xunix.Unlink(path);
1231
1232// Return the results of an unlink of an xrootd file
1233//
1234 return Xroot.Unlink(myPath);
1235}

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

1284{
1285 return XrootPath.URL(path, buff, blen);
1286}

References XrootPath.

◆ XrdPosix_Write()

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

Definition at line 1244 of file XrdPosix.cc.

1245{
1246
1247// Return the results of the write
1248//
1249 return (Xroot.myFD(fildes) ? Xroot.Write(fildes, buf, nbyte)
1250 : Xunix.Write(fildes, buf, nbyte));
1251}

References Xroot, and Xunix.

◆ XrdPosix_Writev()

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

Definition at line 1260 of file XrdPosix.cc.

1261{
1262
1263// Return results of the writev
1264//
1265 return (Xroot.myFD(fildes) ? Xroot.Writev(fildes, iov, iovcnt)
1266 : Xunix.Writev(fildes, iov, iovcnt));
1267}

References Xroot, and Xunix.