XRootD
Loading...
Searching...
No Matches
XrdPosixPreload32.cc File Reference
#include <cerrno>
#include <dirent.h>
#include <cstdio>
#include <cstdarg>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <cstdlib>
#include <sys/statfs.h>
#include "XrdPosix/XrdPosixExtern.hh"
#include "XrdPosix/XrdPosixLinkage.hh"
#include "XrdPosix/XrdPosixOsDep.hh"
#include "XrdPosix/XrdPosixXrootd.hh"
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysPlatform.hh"
+ Include dependency graph for XrdPosixPreload32.cc:

Go to the source code of this file.

Macros

#define XRDPOSIXPRELOAD32
 

Functions

int creat (const char *path, mode_t mode)
 
int fcntl (int fd, int cmd,...)
 
int fseeko (FILE *stream, off_t offset, int whence)
 
int fstat (int fildes, struct stat *buf)
 
off_t ftello (FILE *stream)
 
int ftruncate (int fildes, off_t offset)
 
off_t lseek (int fildes, off_t offset, int whence)
 
int lstat (const char *path, struct stat *buf)
 
int open (const char *path, int oflag,...)
 
ssize_t pread (int fildes, void *buf, size_t nbyte, off_t offset)
 
ssize_t pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
 
struct dirent * readdir (DIR *dirp)
 
int readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
 
int stat (const char *path, struct stat *buf)
 
int statfs (const char *path, struct statfs *buf)
 
int statvfs (const char *path, struct statvfs *buf)
 
int truncate (const char *path, off_t offset)
 
int XrdPosix_CopyDirent (struct dirent *dent, struct dirent64 *dent64)
 
int XrdPosix_CopyStat (struct stat *buf, struct stat64 &buf64)
 

Variables

XrdPosixLinkage Xunix
 

Macro Definition Documentation

◆ XRDPOSIXPRELOAD32

#define XRDPOSIXPRELOAD32

Definition at line 53 of file XrdPosixPreload32.cc.

Function Documentation

◆ creat()

int creat ( const char * path,
mode_t mode )

Definition at line 175 of file XrdPosixPreload32.cc.

176{
177 static int Init = Xunix.Init(&Init);
178
179 return XrdPosix_Open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
180}
int XrdPosix_Open(const char *path, int oflag,...)
Definition XrdPosix.cc:640
XrdPosixLinkage Xunix

References XrdPosix_Open(), and Xunix.

+ Here is the call graph for this function:

◆ fcntl()

int fcntl ( int fd,
int cmd,
... )

Definition at line 190 of file XrdPosixPreload32.cc.

191{
192 static int Init = Xunix.Init(&Init);
193 va_list ap;
194 void *theArg;
195
196 if (XrdPosixXrootd::myFD(fd)) return 0;
197 va_start(ap, cmd);
198 theArg = va_arg(ap, void *);
199 va_end(ap);
200 return Xunix.Fcntl(fd, cmd, theArg);
201}
static bool myFD(int fd)

References XrdPosixXrootd::myFD(), and Xunix.

Referenced by XrdScheduler::XrdScheduler(), XrdSutFileLocker::XrdSutFileLocker(), XrdSutFileLocker::~XrdSutFileLocker(), XrdTlsSocket::Accept(), XrdSutPFile::Close(), XrdNetConnect::Connect(), XrdOucStream::Exec(), XrdCl::Socket::GetFlags(), XrdTlsSocket::Init(), XrdCl::Socket::Initialize(), XrdPoll::newPoller(), XrdSutPFile::Open(), XrdOucSxeq::Release(), XrdOucSxeq::Release(), XrdOfsCPFile::Reserve(), XrdOucSxeq::Serialize(), XrdOucSxeq::Serialize(), XrdW41Gate::Serialize(), XrdCl::Socket::SetFlags(), and XrdFrcUtils::Unique().

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

◆ fseeko()

int fseeko ( FILE * stream,
off_t offset,
int whence )

Definition at line 227 of file XrdPosixPreload32.cc.

228{
229 static int Init = Xunix.Init(&Init);
230
231 return XrdPosix_Fseeko(stream, offset, whence);
232}
int XrdPosix_Fseeko(FILE *stream, long long offset, int whence)
Definition XrdPosix.cc:395

References XrdPosix_Fseeko(), and Xunix.

+ Here is the call graph for this function:

◆ fstat()

int fstat ( int fildes,
struct stat * buf )

Definition at line 248 of file XrdPosixPreload32.cc.

250{
251 static int Init = Xunix.Init(&Init);
252
253#if defined(__linux__) and defined(_STAT_VER)
254 if (!XrdPosixXrootd::myFD(fildes)) return Xunix.Fstat(ver, fildes, buf);
255#else
256 if (!XrdPosixXrootd::myFD(fildes)) return Xunix.Fstat( fildes, buf);
257#endif
258
259#if defined(__LP64__) || defined(_LP64)
260 return XrdPosix_Fstat(fildes, buf );
261#else
262 int rc;
263 struct stat64 buf64;
264 if ((rc = XrdPosix_Fstat(fildes, (struct stat *)&buf64))) return rc;
265 return XrdPosix_CopyStat(buf, buf64);
266#endif
267}
int XrdPosix_CopyStat(struct stat *buf, struct stat64 &buf64)
int stat64(const char *path, struct stat64 *buf)
int XrdPosix_Fstat(int fildes, struct stat *buf)
Definition XrdPosix.cc:413
#define stat(a, b)
Definition XrdPosix.hh:101

References XrdPosixXrootd::myFD(), stat, stat64(), XrdPosix_CopyStat(), XrdPosix_Fstat(), and Xunix.

+ Here is the call graph for this function:

◆ ftello()

off_t ftello ( FILE * stream)

Definition at line 279 of file XrdPosixPreload32.cc.

280{
281 static int Init = Xunix.Init(&Init);
282
283 return static_cast<off_t>(XrdPosix_Ftello(stream));
284}
long long XrdPosix_Ftello(FILE *stream)
Definition XrdPosix.cc:480

References XrdPosix_Ftello(), and Xunix.

+ Here is the call graph for this function:

◆ ftruncate()

int ftruncate ( int fildes,
off_t offset )

Definition at line 295 of file XrdPosixPreload32.cc.

296{
297 static int Init = Xunix.Init(&Init);
298
299 return XrdPosix_Ftruncate(fildes, offset);
300}
int XrdPosix_Ftruncate(int fildes, long long offset)
Definition XrdPosix.cc:497

References XrdPosix_Ftruncate(), and Xunix.

+ Here is the call graph for this function:

◆ lseek()

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

Definition at line 311 of file XrdPosixPreload32.cc.

312{
313 static int Init = Xunix.Init(&Init);
314
315 return XrdPosix_Lseek(fildes, offset, whence);
316}
long long XrdPosix_Lseek(int fildes, long long offset, int whence)
Definition XrdPosix.cc:573

References XrdPosix_Lseek(), and Xunix.

+ Here is the call graph for this function:

◆ lstat()

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

Definition at line 332 of file XrdPosixPreload32.cc.

334{
335 static int Init = Xunix.Init(&Init);
336
337 if (!XrdPosix_isMyPath(path))
338#if defined(__linux__) and defined(_STAT_VER)
339 return Xunix.Lstat(ver, path, buf);
340#else
341 return Xunix.Lstat( path, buf);
342#endif
343
344#if defined(__LP64__) || defined(_LP64)
345 return XrdPosix_Lstat(path, buf );
346#else
347 struct stat64 buf64;
348 int rc;
349
350 if ((rc = XrdPosix_Lstat(path, (struct stat *)&buf64))) return rc;
351 return XrdPosix_CopyStat(buf, buf64);
352#endif
353}
int XrdPosix_isMyPath(const char *path)
Definition XrdPosix.cc:1083
int XrdPosix_Lstat(const char *path, struct stat *buf)
Definition XrdPosix.cc:589

References stat, stat64(), XrdPosix_CopyStat(), XrdPosix_isMyPath(), XrdPosix_Lstat(), and Xunix.

Referenced by XrdOssCopy::Copy(), XrdOssSys::Create(), XrdOssPath::Extract(), XrdOssCache::Find(), XrdOssPath::getCname(), XrdCl::LocalFileHandler::MkdirPath(), XrdOssSys::Remdir(), XrdOssSys::Rename(), XrdOssSys::RenameLink(), XrdDigUFS::Statlk(), XrdOssSys::Truncate(), and XrdOssSys::Unlink().

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

◆ open()

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

Definition at line 364 of file XrdPosixPreload32.cc.

365{
366 static int Init = Xunix.Init(&Init);
367 va_list ap;
368 int mode;
369
370 va_start(ap, oflag);
371 mode = va_arg(ap, int);
372 va_end(ap);
373 return XrdPosix_Open(path, oflag, mode);
374}

References XrdPosix_Open(), and Xunix.

+ Here is the call graph for this function:

◆ pread()

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

Definition at line 385 of file XrdPosixPreload32.cc.

386{
387 static int Init = Xunix.Init(&Init);
388
389 return XrdPosix_Pread(fildes, buf, nbyte, offset);
390}
long long XrdPosix_Pread(int fildes, void *buf, unsigned long long nbyte, long long offset)
Definition XrdPosix.cc:716

References XrdPosix_Pread(), and Xunix.

+ Here is the call graph for this function:

◆ pwrite()

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

Definition at line 465 of file XrdPosixPreload32.cc.

466{
467 static int Init = Xunix.Init(&Init);
468
469 return XrdPosix_Pwrite(fildes, buf, nbyte, offset);
470}
long long XrdPosix_Pwrite(int fildes, const void *buf, unsigned long long nbyte, long long offset)
Definition XrdPosix.cc:733

References XrdPosix_Pwrite(), and Xunix.

+ Here is the call graph for this function:

◆ readdir()

struct dirent * readdir ( DIR * dirp)

Definition at line 401 of file XrdPosixPreload32.cc.

402{
403 static int Init = Xunix.Init(&Init);
404 struct dirent64 *dp64;
405
406 if ( isLite )
407 {
408 if (!(dp64 = Xunix.Readdir64(dirp))) return 0;
409 }
410 else
411 if (!(dp64 = XrdPosix_Readdir64(dirp))) return 0;
412
413#if !defined(__APPLE__) && !defined(_LP64) && !defined(__LP64__) && !(defined(__FreeBSD_kernel__) && defined(__GLIBC__))
414 if (XrdPosix_CopyDirent((struct dirent *)dp64, dp64)) return 0;
415#endif
416
417 return (struct dirent *)dp64;
418}
int XrdPosix_CopyDirent(struct dirent *dent, struct dirent64 *dent64)
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
Definition XrdPosix.cc:793

References XrdPosix_CopyDirent(), XrdPosix_Readdir64(), and Xunix.

+ Here is the call graph for this function:

◆ readdir_r()

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

Definition at line 429 of file XrdPosixPreload32.cc.

430{
431 static int Init = Xunix.Init(&Init);
432#if defined(__APPLE__) || defined(__LP64__) || defined(_LP64) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
433 return XrdPosix_Readdir_r(dirp, entry, result);
434#else
435 char buff[sizeof(struct dirent64) + 2048];
436 struct dirent64 *dp64 = (struct dirent64 *)buff;
437 struct dirent64 *mydirent;
438 int rc;
439
440 if ( isLite )
441 {
442 if ((rc = Xunix.Readdir64_r(dirp, dp64, &mydirent))) return rc;
443 }
444 else
445 if ((rc = XrdPosix_Readdir64_r(dirp, dp64, &mydirent))) return rc;
446
447 if (!mydirent) {*result = 0; return 0;}
448
449 if ((rc = XrdPosix_CopyDirent(entry, dp64))) return rc;
450
451 *result = entry;
452 return 0;
453#endif
454}
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
Definition XrdPosix.cc:818
int XrdPosix_Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
Definition XrdPosix.cc:809

References XrdPosix_CopyDirent(), XrdPosix_Readdir64_r(), XrdPosix_Readdir_r(), and Xunix.

+ Here is the call graph for this function:

◆ stat()

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

Definition at line 486 of file XrdPosixPreload32.cc.

488{
489 static int Init = Xunix.Init(&Init);
490
491 if (!XrdPosix_isMyPath(path))
492#ifdef __linux__
493 return Xunix.Stat(ver, path, buf);
494#else
495 return Xunix.Stat( path, buf);
496#endif
497
498#if defined(__LP64__) || defined(_LP64)
499 return XrdPosix_Stat(path, buf );
500#else
501 struct stat64 buf64;
502 int rc;
503 if ((rc = XrdPosix_Stat(path, (struct stat *)&buf64))) return rc;
504 return XrdPosix_CopyStat(buf, buf64);
505#endif
506}
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition XrdPosix.cc:917

References stat, stat64(), XrdPosix_CopyStat(), XrdPosix_isMyPath(), XrdPosix_Stat(), and Xunix.

+ Here is the call graph for this function:

◆ statfs()

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

Definition at line 517 of file XrdPosixPreload32.cc.

518{
519 static int Init = Xunix.Init(&Init);
520 struct statfs64 buf64;
521 int rc;
522
523 if ((rc = XrdPosix_Statfs(path, (struct statfs *)&buf64))) return rc;
524 memset(buf, 0, sizeof(struct statfs));
525 buf->f_type = buf64.f_type;
526 buf->f_bsize = buf64.f_bsize;
527 buf->f_blocks = buf64.f_blocks;
528 buf->f_bfree = buf64.f_bfree;
529 buf->f_files = buf64.f_files;
530 buf->f_ffree = buf64.f_ffree;
531 buf->f_fsid = buf64.f_fsid;
532#if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
533 buf->f_namemax = buf64.f_namemax;
534#else
535 buf->f_namelen = buf64.f_namelen;
536#endif
537 return 0;
538}
int statfs64(const char *path, struct statfs64 *buf)
int XrdPosix_Statfs(const char *path, struct statfs *buf)
Definition XrdPosix.cc:943
#define statfs(a, b)
Definition XrdPosix.hh:103

References statfs, statfs64(), XrdPosix_Statfs(), and Xunix.

+ Here is the call graph for this function:

◆ statvfs()

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

Definition at line 549 of file XrdPosixPreload32.cc.

550{
551 static int Init = Xunix.Init(&Init);
552 struct statvfs64 buf64;
553 int rc;
554 if ((rc = XrdPosix_Statvfs(path, (struct statvfs *)&buf64))) return rc;
555 memset(buf, 0, sizeof(struct statvfs));
556 buf->f_flag = buf64.f_flag;
557 buf->f_bsize = buf64.f_bsize;
558 buf->f_blocks = buf64.f_blocks;
559 buf->f_bfree = buf64.f_bfree;
560 buf->f_files = buf64.f_files;
561 buf->f_ffree = buf64.f_ffree;
562 buf->f_fsid = buf64.f_fsid;
563 buf->f_namemax = buf64.f_namemax;
564 return 0;
565}
int statvfs64(const char *path, struct statvfs64 *buf)
int XrdPosix_Statvfs(const char *path, struct statvfs *buf)
Definition XrdPosix.cc:965
#define statvfs(a, b)
Definition XrdPosix.hh:105

References statvfs, statvfs64(), XrdPosix_Statvfs(), and Xunix.

+ Here is the call graph for this function:

◆ truncate()

int truncate ( const char * path,
off_t offset )

Definition at line 576 of file XrdPosixPreload32.cc.

577{
578 static int Init = Xunix.Init(&Init);
579
580 return XrdPosix_Truncate(path, offset);
581}
int XrdPosix_Truncate(const char *path, long long offset)
Definition XrdPosix.cc:1003

References XrdPosix_Truncate(), and Xunix.

+ Here is the call graph for this function:

◆ XrdPosix_CopyDirent()

int XrdPosix_CopyDirent ( struct dirent * dent,
struct dirent64 * dent64 )

Definition at line 99 of file XrdPosixPreload32.cc.

100{
101 const unsigned long long LLMask = 0xffffffff00000000LL;
102 int isdiff = (dent->d_name-(char *)dent) != (dent64->d_name-(char *)dent64);
103
104#if defined(__GNU__)
105 if (isdiff && (dent64->d_ino & LLMask))
106#else
107 if (isdiff && ((dent64->d_ino & LLMask) || (dent64->d_off & LLMask)))
108#endif
109 {errno = EOVERFLOW; return EOVERFLOW;}
110
111 if (isdiff || (void *)dent != (void *)dent64)
112 {dent->d_ino = dent64->d_ino;
113#if !defined(__GNU__)
114 dent->d_off = dent64->d_off;
115#endif
116 dent->d_reclen = dent64->d_reclen;
117 dent->d_type = dent64->d_type;
118#if defined(__GNU__)
119 dent->d_namlen = dent64->d_namlen;
120#endif
121 strcpy(dent->d_name, dent64->d_name);
122 }
123 return 0;
124}

Referenced by readdir(), and readdir_r().

+ Here is the caller graph for this function:

◆ XrdPosix_CopyStat()

int XrdPosix_CopyStat ( struct stat * buf,
struct stat64 & buf64 )

Definition at line 140 of file XrdPosixPreload32.cc.

141{
142 const unsigned long long LLMask = 0xffffffff00000000LL;
143 const int INTMax = 0x7fffffff;
144
145 if (buf64.st_size & LLMask)
146 if (buf64.st_mode & S_IFREG || buf64.st_mode & S_IFDIR)
147 {errno = EOVERFLOW; return -1;}
148 else buf->st_size = INTMax;
149 else buf->st_size = buf64.st_size; /* 64: File size in bytes */
150
151 buf->st_ino = buf64.st_ino & LLMask ? INTMax : buf64.st_ino;
152 buf->st_blocks= buf64.st_blocks & LLMask ? INTMax : buf64.st_blocks;
153 buf->st_mode = buf64.st_mode; /* File mode (see mknod(2)) */
154 buf->st_dev = buf64.st_dev;
155 buf->st_rdev = buf64.st_rdev; /* ID of device */
156 buf->st_nlink = buf64.st_nlink; /* Number of links */
157 buf->st_uid = buf64.st_uid; /* User ID of the file's owner */
158 buf->st_gid = buf64.st_gid; /* Group ID of the file's group */
159 buf->st_atime = buf64.st_atime; /* Time of last access */
160 buf->st_mtime = buf64.st_mtime; /* Time of last data modification */
161 buf->st_ctime = buf64.st_ctime; /* Time of last file status change */
162 buf->st_blksize=buf64.st_blksize; /* Preferred I/O block size */
163 return 0;
164}

References stat, and stat64().

Referenced by fstat(), lstat(), and stat().

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

Variable Documentation

◆ Xunix

XrdPosixLinkage Xunix
extern

Definition at line 57 of file XrdPosixLinkage.cc.