XrdPosixPreload.cc

Go to the documentation of this file.
00001 /******************************************************************************/
00002 /*                                                                            */
00003 /*                    X r d P o s i x P r e l o a d . c c                     */
00004 /*                                                                            */
00005 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University  */
00006 /*                            All Rights Reserved                             */
00007 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00008 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00009 /******************************************************************************/
00010 
00011 //           $Id: XrdPosixPreload.cc 30949 2009-11-02 16:37:58Z ganis $
00012 
00013 const char *XrdPosixPreloadCVSID = "$Id: XrdPosixPreload.cc 30949 2009-11-02 16:37:58Z ganis $";
00014 
00015 #include <sys/types.h>
00016 #include <stdarg.h>
00017 #include <unistd.h>
00018 
00019 #include "XrdPosix/XrdPosixLinkage.hh"
00020 #include "XrdPosix/XrdPosixOsDep.hh"
00021 
00022 /******************************************************************************/
00023 /*                      P r e - D e c l a r a t i o n s                       */
00024 /******************************************************************************/
00025 
00026 #include "XrdPosix/XrdPosixExtern.hh"
00027  
00028 /******************************************************************************/
00029 /*                   G l o b a l   D e c l a r a t i o n s                    */
00030 /******************************************************************************/
00031   
00032 extern XrdPosixLinkage Xunix;
00033   
00034 /******************************************************************************/
00035 /*                                a c c e s s                                 */
00036 /******************************************************************************/
00037   
00038 extern "C"
00039 {
00040 int access(const char *path, int amode)
00041 {
00042    static int Init = Xunix.Init(&Init);
00043 
00044    return XrdPosix_Access(path, amode);
00045 }
00046 }
00047 
00048 /******************************************************************************/
00049 /*                                   a c l                                    */
00050 /******************************************************************************/
00051 
00052 // This is a required addition for Solaris 10+ systems
00053 
00054 extern "C"
00055 {
00056 int acl(const char *path, int cmd, int nentries, void *aclbufp)
00057 {
00058    static int Init = Xunix.Init(&Init);
00059 
00060    return XrdPosix_Acl(path, cmd, nentries, aclbufp);
00061 }
00062 }
00063   
00064 /******************************************************************************/
00065 /*                                 c h d i r                                  */
00066 /******************************************************************************/
00067 
00068 extern "C"
00069 {
00070 int     chdir(const char *path)
00071 {
00072    static int Init = Xunix.Init(&Init);
00073 
00074    return XrdPosix_Chdir(path);
00075 }
00076 }
00077 
00078 /******************************************************************************/
00079 /*                                 c l o s e                                  */
00080 /******************************************************************************/
00081 
00082 extern "C"
00083 {
00084 int     close(int fildes)
00085 {
00086    static int Init = Xunix.Init(&Init);
00087 
00088    return XrdPosix_Close(fildes);
00089 }
00090 }
00091 
00092 /******************************************************************************/
00093 /*                              c l o s e d i r                               */
00094 /******************************************************************************/
00095   
00096 extern "C"
00097 {
00098 int     closedir(DIR *dirp)
00099 {
00100    static int Init = Xunix.Init(&Init);
00101 
00102    return XrdPosix_Closedir(dirp);
00103 }
00104 }
00105 
00106 /******************************************************************************/
00107 /*                                 c r e a t                                  */
00108 /******************************************************************************/
00109   
00110 extern "C"
00111 {
00112 int     creat64(const char *path, mode_t mode)
00113 {
00114    static int Init = Xunix.Init(&Init);
00115 
00116    return XrdPosix_Creat(path, mode);
00117 }
00118 }
00119   
00120 /******************************************************************************/
00121 /*                                f c l o s e                                 */
00122 /******************************************************************************/
00123 
00124 extern "C"
00125 {
00126 int fclose(FILE *stream)
00127 {
00128    static int Init = Xunix.Init(&Init);
00129 
00130    return XrdPosix_Fclose(stream);
00131 }
00132 }
00133 
00134 /******************************************************************************/
00135 /*                               f c n t l 6 4                                */
00136 /******************************************************************************/
00137   
00138 extern "C"
00139 {
00140 int     fcntl64(int fd, int cmd, ...)
00141 {
00142    static int Init = Xunix.Init(&Init);
00143    va_list ap;
00144    void *theArg;
00145 
00146    va_start(ap, cmd);
00147    theArg = va_arg(ap, void *);
00148    va_end(ap);
00149    return XrdPosix_Fcntl(fd, cmd, theArg);
00150 }
00151 }
00152 
00153 /******************************************************************************/
00154 /*                             f d a t a s y n c                              */
00155 /******************************************************************************/
00156   
00157 extern "C"
00158 {
00159 int     fdatasync(int fildes)
00160 {
00161    static int Init = Xunix.Init(&Init);
00162 
00163    return XrdPosix_Fdatasync(fildes);
00164 }
00165 }
00166 
00167 /******************************************************************************/
00168 /*                                f f l u s h                                 */
00169 /******************************************************************************/
00170   
00171 extern "C"
00172 {
00173 int    fflush(FILE *stream)
00174 {
00175    static int Init = Xunix.Init(&Init);
00176 
00177    return XrdPosix_Fflush(stream);
00178 }
00179 }
00180   
00181 /******************************************************************************/
00182 /*                                 f o p e n                                  */
00183 /******************************************************************************/
00184   
00185 extern "C"
00186 {
00187 FILE  *fopen64(const char *path, const char *mode)
00188 {
00189    static int Init = Xunix.Init(&Init);
00190 
00191    return XrdPosix_Fopen(path, mode);
00192 }
00193 }
00194 
00195 /******************************************************************************/
00196 /*                                 f r e a d                                  */
00197 /******************************************************************************/
00198   
00199 extern "C"
00200 {
00201 size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream)
00202 {
00203    static int Init = Xunix.Init(&Init);
00204 
00205    return XrdPosix_Fread(ptr, size, nitems, stream);
00206 }
00207 }
00208   
00209 /******************************************************************************/
00210 /*                                 f s e e k                                  */
00211 /******************************************************************************/
00212 
00213 extern "C"
00214 {
00215 int fseek(FILE *stream, long offset, int whence)
00216 {
00217    static int Init = Xunix.Init(&Init);
00218 
00219    return XrdPosix_Fseek(stream, offset, whence);
00220 }
00221 }
00222   
00223 /******************************************************************************/
00224 /*                                f s e e k o                                 */
00225 /******************************************************************************/
00226 
00227 extern "C"
00228 {
00229 int fseeko64(FILE *stream, off64_t offset, int whence)
00230 {
00231    static int Init = Xunix.Init(&Init);
00232 
00233    return XrdPosix_Fseeko(stream, offset, whence);
00234 }
00235 }
00236   
00237 /******************************************************************************/
00238 /*                                 f s t a t                                  */
00239 /******************************************************************************/
00240 
00241 extern "C"
00242 {
00243 #if defined __linux__ && __GNUC__ && __GNUC__ >= 2
00244 int  __fxstat64(int ver, int fildes, struct stat64 *buf)
00245 #else
00246 int     fstat64(         int fildes, struct stat64 *buf)
00247 #endif
00248 {
00249    static int Init = Xunix.Init(&Init);
00250 
00251 #ifdef __linux__
00252    return XrdPosix_FstatV(ver, fildes, (struct stat *)buf);
00253 #else
00254    return XrdPosix_Fstat (     fildes, (struct stat *)buf);
00255 #endif
00256 }
00257 }
00258 
00259 /******************************************************************************/
00260 /*                                 f s y n c                                  */
00261 /******************************************************************************/
00262   
00263 extern "C"
00264 {
00265 int     fsync(int fildes)
00266 {
00267    static int Init = Xunix.Init(&Init);
00268 
00269    return XrdPosix_Fsync(fildes);
00270 }
00271 }
00272   
00273 /******************************************************************************/
00274 /*                                 f t e l l                                  */
00275 /******************************************************************************/
00276 
00277 extern "C"
00278 {
00279 long    ftell(FILE *stream)
00280 {
00281    static int Init = Xunix.Init(&Init);
00282 
00283    return XrdPosix_Ftell(stream);
00284 }
00285 }
00286   
00287 /******************************************************************************/
00288 /*                                f t e l l o                                 */
00289 /******************************************************************************/
00290 
00291 extern "C"
00292 {
00293 off64_t ftello64(FILE *stream)
00294 {
00295    static int Init = Xunix.Init(&Init);
00296 
00297    return XrdPosix_Ftello(stream);
00298 }
00299 }
00300   
00301 /******************************************************************************/
00302 /*                             f t r u n c a t e                              */
00303 /******************************************************************************/
00304   
00305 extern "C"
00306 {
00307 int ftruncate64(int fildes, off_t offset)
00308 {
00309    static int Init = Xunix.Init(&Init);
00310 
00311    return XrdPosix_Ftruncate(fildes, offset);
00312 }
00313 }
00314   
00315 /******************************************************************************/
00316 /*                                f w r i t e                                 */
00317 /******************************************************************************/
00318   
00319 extern "C"
00320 {
00321 size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
00322 {
00323    static int Init = Xunix.Init(&Init);
00324 
00325    return XrdPosix_Fwrite(ptr, size, nitems, stream);
00326 }
00327 }
00328   
00329 /******************************************************************************/
00330 /*                             f g e t x a t t r                              */
00331 /******************************************************************************/
00332   
00333 #ifdef __linux__
00334 extern "C"
00335 {
00336 ssize_t fgetxattr (int fd, const char *name, void *value, size_t size)
00337 {
00338    static int Init = Xunix.Init(&Init);
00339 
00340    return XrdPosix_Fgetxattr(fd, name, value, size);
00341 }
00342 }
00343 #endif
00344 
00345 /******************************************************************************/
00346 /*                              g e t x a t t r                               */
00347 /******************************************************************************/
00348   
00349 #ifdef __linux__
00350 extern "C"
00351 {
00352 ssize_t getxattr (const char *path, const char *name, void *value, size_t size)
00353 {
00354    static int Init = Xunix.Init(&Init);
00355 
00356    return XrdPosix_Getxattr(path, name, value, size);
00357 }
00358 }
00359 #endif
00360   
00361 /******************************************************************************/
00362 /*                             l g e t x a t t r                              */
00363 /******************************************************************************/
00364   
00365 #ifdef __linux__
00366 extern "C"
00367 {
00368 ssize_t lgetxattr (const char *path, const char *name, void *value, size_t size)
00369 {
00370    static int Init = Xunix.Init(&Init);
00371 
00372    return XrdPosix_Lgetxattr(path, name, value, size);
00373 }
00374 }
00375 #endif
00376 
00377 /******************************************************************************/
00378 /*                                 l s e e k                                  */
00379 /******************************************************************************/
00380   
00381 extern "C"
00382 {
00383 off64_t lseek64(int fildes, off64_t offset, int whence)
00384 {
00385    static int Init = Xunix.Init(&Init);
00386 
00387    return XrdPosix_Lseek(fildes, offset, whence);
00388 }
00389 }
00390 
00391 /******************************************************************************/
00392 /*                                l l s e e k                                 */
00393 /******************************************************************************/
00394   
00395 extern "C"
00396 {
00397 #if defined(__linux__) || defined(__macos__)
00398 off_t      llseek(int fildes, off_t    offset, int whence)
00399 #else
00400 offset_t   llseek(int fildes, offset_t offset, int whence)
00401 #endif
00402 {
00403    static int Init = Xunix.Init(&Init);
00404 
00405    return XrdPosix_Lseek(fildes, offset, whence);
00406 }
00407 }
00408 
00409 /******************************************************************************/
00410 /*                                 l s t a t                                  */
00411 /******************************************************************************/
00412 
00413 extern "C"
00414 {
00415 #if defined __linux__ && __GNUC__ && __GNUC__ >= 2
00416 int     __lxstat64(int ver, const char *path, struct stat64 *buf)
00417 #else
00418 int        lstat64(         const char *path, struct stat64 *buf)
00419 #endif
00420 {
00421    static int Init = Xunix.Init(&Init);
00422 
00423    return XrdPosix_Lstat(path, (struct stat *)buf);
00424 }
00425 }
00426 
00427 /******************************************************************************/
00428 /*                                 m k d i r                                  */
00429 /******************************************************************************/
00430   
00431 extern "C"
00432 {
00433 int     mkdir(const char *path, mode_t mode)
00434 {
00435    static int Init = Xunix.Init(&Init);
00436 
00437    return XrdPosix_Mkdir(path, mode);
00438 }
00439 }
00440 
00441 /******************************************************************************/
00442 /*                                  o p e n                                   */
00443 /******************************************************************************/
00444 
00445 extern "C"
00446 {
00447 int     open64(const char *path, int oflag, ...)
00448 {
00449    static int Init = Xunix.Init(&Init);
00450    va_list ap;
00451    int mode;
00452 
00453    va_start(ap, oflag);
00454    mode = va_arg(ap, int);
00455    va_end(ap);
00456    return XrdPosix_Open(path, oflag, mode);
00457 }
00458 }
00459 
00460 /******************************************************************************/
00461 /*                               o p e n d i r                                */
00462 /******************************************************************************/
00463   
00464 extern "C"
00465 {
00466 DIR*    opendir(const char *path)
00467 {
00468    static int Init = Xunix.Init(&Init);
00469 
00470    return XrdPosix_Opendir(path);
00471 }
00472 }
00473   
00474 /******************************************************************************/
00475 /*                              p a t h c o n f                               */
00476 /******************************************************************************/
00477 
00478 // This is a required addition for Solaris 10+ systems
00479 
00480 extern "C"
00481 {
00482 long pathconf(const char *path, int name)
00483 {
00484    static int Init = Xunix.Init(&Init);
00485 
00486    return XrdPosix_Pathconf(path, name);
00487 }
00488 }
00489 
00490 /******************************************************************************/
00491 /*                                 p r e a d                                  */
00492 /******************************************************************************/
00493   
00494 extern "C"
00495 {
00496 ssize_t pread64(int fildes, void *buf, size_t nbyte, off_t offset)
00497 {
00498    static int Init = Xunix.Init(&Init);
00499 
00500    return XrdPosix_Pread  (fildes, buf, nbyte, offset);
00501 }
00502 }
00503 
00504 /******************************************************************************/
00505 /*                                p w r i t e                                 */
00506 /******************************************************************************/
00507   
00508 extern "C"
00509 {
00510 ssize_t pwrite64(int fildes, const void *buf, size_t nbyte, off_t offset)
00511 {
00512    static int Init = Xunix.Init(&Init);
00513 
00514    return XrdPosix_Pwrite(fildes, buf, nbyte, offset);
00515 }
00516 }
00517 
00518 /******************************************************************************/
00519 /*                                  r e a d                                   */
00520 /******************************************************************************/
00521   
00522 extern "C"
00523 {
00524 ssize_t read(int fildes, void *buf, size_t nbyte)
00525 {
00526    static int Init = Xunix.Init(&Init);
00527 
00528    return XrdPosix_Read(fildes, buf, nbyte);
00529 }
00530 }
00531   
00532 /******************************************************************************/
00533 /*                                 r e a d v                                  */
00534 /******************************************************************************/
00535   
00536 extern "C"
00537 {
00538 ssize_t readv(int fildes, const struct iovec *iov, int iovcnt)
00539 {
00540    static int Init = Xunix.Init(&Init);
00541 
00542    return XrdPosix_Readv(fildes, iov, iovcnt);
00543 }
00544 }
00545 
00546 /******************************************************************************/
00547 /*                               r e a d d i r                                */
00548 /******************************************************************************/
00549 
00550 extern "C"
00551 {
00552 struct dirent64* readdir64(DIR *dirp)
00553 {
00554    static int Init = Xunix.Init(&Init);
00555 
00556    return XrdPosix_Readdir64(dirp);
00557 }
00558 }
00559 
00560 /******************************************************************************/
00561 /*                             r e a d d i r _ r                              */
00562 /******************************************************************************/
00563   
00564 extern "C"
00565 {
00566 int     readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
00567 {
00568    static int Init = Xunix.Init(&Init);
00569 
00570    return XrdPosix_Readdir64_r(dirp, entry, result);
00571 }
00572 }
00573 
00574 /******************************************************************************/
00575 /*                                r e n a m e                                 */
00576 /******************************************************************************/
00577   
00578 extern "C"
00579 {
00580 int     rename(const char *oldpath, const char *newpath)
00581 {
00582    static int Init = Xunix.Init(&Init);
00583 
00584    return XrdPosix_Rename(oldpath, newpath);
00585 }
00586 }
00587 
00588 /******************************************************************************/
00589 /*                             r e w i n d d i r                              */
00590 /******************************************************************************/
00591 
00592 #ifndef rewinddir
00593 extern "C"
00594 {
00595 void    rewinddir(DIR *dirp)
00596 {
00597    static int Init = Xunix.Init(&Init);
00598 
00599    XrdPosix_Rewinddir(dirp);
00600 }
00601 }
00602 #endif
00603 
00604 /******************************************************************************/
00605 /*                                 r m d i r                                  */
00606 /******************************************************************************/
00607   
00608 extern "C"
00609 {
00610 int     rmdir(const char *path)
00611 {
00612    static int Init = Xunix.Init(&Init);
00613 
00614    return XrdPosix_Rmdir(path);
00615 }
00616 }
00617 
00618 /******************************************************************************/
00619 /*                               s e e k d i r                                */
00620 /******************************************************************************/
00621   
00622 extern "C"
00623 {
00624 void    seekdir(DIR *dirp, long loc)
00625 {
00626    static int Init = Xunix.Init(&Init);
00627 
00628    XrdPosix_Seekdir(dirp, loc);
00629 }
00630 }
00631 
00632 /******************************************************************************/
00633 /*                                  s t a t                                   */
00634 /******************************************************************************/
00635 
00636 extern "C"
00637 {
00638 #if defined __linux__ && __GNUC__ && __GNUC__ >= 2
00639 int     __xstat64(int ver, const char *path, struct stat64 *buf)
00640 #else
00641 int        stat64(         const char *path, struct stat64 *buf)
00642 #endif
00643 {
00644    static int Init = Xunix.Init(&Init);
00645 
00646    return XrdPosix_Stat(path, (struct stat *)buf);
00647 }
00648 }
00649 
00650 /******************************************************************************/
00651 /*                                s t a t f s                                 */
00652 /******************************************************************************/
00653 
00654 #if !defined(__solaris__)
00655 extern "C"
00656 {
00657 int        statfs64(       const char *path, struct statfs64 *buf)
00658 {
00659    static int Init = Xunix.Init(&Init);
00660 
00661    return XrdPosix_Statfs(path, (struct statfs *)buf);
00662 }
00663 }
00664 #endif
00665 
00666 /******************************************************************************/
00667 /*                               s t a t v f s                                */
00668 /******************************************************************************/
00669 
00670 extern "C"
00671 {
00672 int        statvfs64(         const char *path, struct statvfs64 *buf)
00673 {
00674    static int Init = Xunix.Init(&Init);
00675 
00676    return XrdPosix_Statvfs(path, (struct statvfs *)buf);
00677 }
00678 }
00679 
00680 /******************************************************************************/
00681 /*                               t e l l d i r                                */
00682 /******************************************************************************/
00683   
00684 extern "C"
00685 {
00686 long    telldir(DIR *dirp)
00687 {
00688    static int Init = Xunix.Init(&Init);
00689 
00690    return XrdPosix_Telldir(dirp);
00691 }
00692 }
00693   
00694 /******************************************************************************/
00695 /*                              t r u n c a t e                               */
00696 /******************************************************************************/
00697   
00698 extern "C"
00699 {
00700 int truncate64(const char *path, off_t offset)
00701 {
00702    static int Init = Xunix.Init(&Init);
00703 
00704    return XrdPosix_Truncate(path, offset);
00705 }
00706 }
00707 
00708 /******************************************************************************/
00709 /*                                u n l i n k                                 */
00710 /******************************************************************************/
00711   
00712 extern "C"
00713 {
00714 int     unlink(const char *path)
00715 {
00716    static int Init = Xunix.Init(&Init);
00717 
00718    return XrdPosix_Unlink(path);
00719 }
00720 }
00721 
00722 /******************************************************************************/
00723 /*                                 w r i t e                                  */
00724 /******************************************************************************/
00725   
00726 extern "C"
00727 {
00728 ssize_t write(int fildes, const void *buf, size_t nbyte)
00729 {
00730    static int Init = Xunix.Init(&Init);
00731 
00732    return XrdPosix_Write(fildes, buf, nbyte);
00733 }
00734 }
00735 
00736 /******************************************************************************/
00737 /*                                w r i t e v                                 */
00738 /******************************************************************************/
00739   
00740 extern "C"
00741 {
00742 ssize_t writev(int fildes, const struct iovec *iov, int iovcnt)
00743 {
00744    static int Init = Xunix.Init(&Init);
00745 
00746    return XrdPosix_Writev(fildes, iov, iovcnt);
00747 }
00748 }

Generated on Tue Jul 5 14:46:57 2011 for ROOT_528-00b_version by  doxygen 1.5.1