xrootd
|
00001 #ifndef __XRDPOSIXEXTERN_H__ 00002 #define __XRDPOSIXEXTERN_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d P o s i x E x t e r n . h h */ 00006 /* */ 00007 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /* Modified by Frank Winklmeier to add the full Posix file system definition. */ 00012 /******************************************************************************/ 00013 00014 // $Id$ 00015 00016 // These OS-Compatible (not C++) externs are included by XrdPosix.hh to 00017 // complete the macro definitions contained therein. 00018 00019 // Use this file directly to define your own macros or interfaces. Note that 00020 // native types are used to avoid 32/64 bit parameter/return value ambiguities 00021 // and to enforce shared library compatability (needed by the preload32 code). 00022 00023 // Only 64-bit interfaces are directly supported. However, the preload library 00024 // supports the old 32-bit interfaces. To use this include you must specify 00025 00026 // -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 00027 00028 // compilation options. This ensures LP64 compatability which defines: 00029 // 00030 // ssize_t -> long long 00031 // size_t -> unsigned long long 00032 // off_t -> long long 00033 00034 #if (!defined(_LARGEFILE_SOURCE) || !defined(_LARGEFILE64_SOURCE) || \ 00035 _FILE_OFFSET_BITS!=64) && !defined(XRDPOSIXPRELOAD32) 00036 #error Compilation options are incompatible with XrdPosixExtern.hh; \ 00037 Specify -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 00038 #endif 00039 00040 // We pre-declare various structure t avoid compilation complaints. We cannot 00041 // include the necessary ".h" files as these would also try to define entry 00042 // points which may conflict with our definitions due to renaming pragmas and 00043 // simple defines. All we want is to make sure we have the right name in the 00044 // loader's symbol table so that the preload library can intercept the call. 00045 // We need these definitions here because the includer may not have included 00046 // all of the includes necessary to support all of the API's. 00047 // 00048 struct iovec; 00049 struct stat; 00050 struct statfs; 00051 struct statvfs; 00052 00053 #include <dirent.h> 00054 #include <stdio.h> 00055 #include <unistd.h> 00056 #include <sys/types.h> 00057 00058 #include "XrdPosix/XrdPosixOsDep.hh" 00059 00060 #ifdef __cplusplus 00061 extern "C" 00062 { 00063 #endif 00064 extern int XrdPosix_Access(const char *path, int amode); 00065 00066 extern int XrdPosix_Acl(const char *path, int cmd, int nentries, 00067 void *aclbufp); 00068 00069 extern int XrdPosix_Chdir(const char *path); 00070 00071 extern int XrdPosix_Close(int fildes); 00072 00073 extern int XrdPosix_Closedir(DIR *dirp); 00074 00075 extern int XrdPosix_Creat(const char *path, mode_t mode); 00076 00077 extern int XrdPosix_Fclose(FILE *stream); 00078 00079 extern int XrdPosix_Fcntl(int fd, int cmd, ...); 00080 00081 extern int XrdPosix_Fdatasync(int fildes); 00082 00083 extern int XrdPosix_Fflush(FILE *stream); 00084 00085 #ifdef __linux__ 00086 extern long long XrdPosix_Fgetxattr (int fd, const char *name, 00087 void *value, unsigned long long size); 00088 #endif 00089 00090 extern FILE *XrdPosix_Fopen(const char *path, const char *mode); 00091 00092 extern size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream); 00093 00094 extern int XrdPosix_Fseek(FILE *stream, long offset, int whence); 00095 00096 extern int XrdPosix_Fseeko(FILE *stream, long long offset, int whence); 00097 00098 extern int XrdPosix_Fstat(int fildes, struct stat *buf); 00099 00100 #ifdef __linux__ 00101 extern int XrdPosix_FstatV(int ver, int fildes, struct stat *buf); 00102 #endif 00103 00104 extern int XrdPosix_Fsync(int fildes); 00105 00106 extern long XrdPosix_Ftell(FILE *stream); 00107 00108 extern long long XrdPosix_Ftello(FILE *stream); 00109 00110 extern int XrdPosix_Ftruncate(int fildes, long long offset); 00111 00112 extern size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream); 00113 00114 #ifdef __linux__ 00115 extern long long XrdPosix_Getxattr (const char *path, const char *name, 00116 void *value, unsigned long long size); 00117 00118 extern long long XrdPosix_Lgetxattr(const char *path, const char *name, 00119 void *value, unsigned long long size); 00120 #endif 00121 00122 extern long long XrdPosix_Lseek(int fildes, long long offset, int whence); 00123 00124 extern int XrdPosix_Lstat(const char *path, struct stat *buf); 00125 00126 extern int XrdPosix_Mkdir(const char *path, mode_t mode); 00127 00128 extern int XrdPosix_Open(const char *path, int oflag, ...); 00129 00130 extern DIR* XrdPosix_Opendir(const char *path); 00131 00132 extern long XrdPosix_Pathconf(const char *path, int name); 00133 00134 extern long long XrdPosix_Pread(int fildes, void *buf, unsigned long long nbyte, 00135 long long offset); 00136 00137 extern long long XrdPosix_Read(int fildes, void *buf, unsigned long long nbyte); 00138 00139 extern long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt); 00140 00141 extern struct dirent* XrdPosix_Readdir (DIR *dirp); 00142 extern struct dirent64* XrdPosix_Readdir64(DIR *dirp); 00143 00144 extern int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result); 00145 extern int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result); 00146 00147 extern int XrdPosix_Rename(const char *oname, const char *nname); 00148 00149 extern void XrdPosix_Rewinddir(DIR *dirp); 00150 00151 extern int XrdPosix_Rmdir(const char *path); 00152 00153 extern void XrdPosix_Seekdir(DIR *dirp, long loc); 00154 00155 extern int XrdPosix_Stat(const char *path, struct stat *buf); 00156 00157 #if !defined(__solaris__) 00158 extern int XrdPosix_Statfs(const char *path, struct statfs *buf); 00159 #endif 00160 00161 extern int XrdPosix_Statvfs(const char *path, struct statvfs *buf); 00162 00163 extern long long XrdPosix_Pwrite(int fildes, const void *buf, 00164 unsigned long long nbyte, long long offset); 00165 00166 extern long XrdPosix_Telldir(DIR *dirp); 00167 00168 extern int XrdPosix_Truncate(const char *path, long long offset); 00169 00170 extern int XrdPosix_Unlink(const char *path); 00171 00172 extern long long XrdPosix_Write(int fildes, const void *buf, 00173 unsigned long long nbyte); 00174 00175 extern long long XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt); 00176 00177 #ifdef __cplusplus 00178 }; 00179 #endif 00180 00181 // The following is for use for wrapper classeses 00182 // 00183 extern int XrdPosix_isMyPath(const char *path); 00184 00185 extern char *XrdPosix_URL(const char *path, char *buff, int blen); 00186 00187 #endif