xrootd
XrdPosixExtern.hh
Go to the documentation of this file.
1 #ifndef __XRDPOSIXEXTERN_H__
2 #define __XRDPOSIXEXTERN_H__
3 /******************************************************************************/
4 /* */
5 /* X r d P o s i x E x t e r n . h h */
6 /* */
7 /* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /* Modified by Frank Winklmeier to add the full Posix file system definition. */
32 /******************************************************************************/
33 
34 // These OS-Compatible (not C++) externs are included by XrdPosix.hh to
35 // complete the macro definitions contained therein.
36 
37 // Use this file directly to define your own macros or interfaces. Note that
38 // native types are used to avoid 32/64 bit parameter/return value ambiguities
39 // and to enforce shared library compatability (needed by the preload32 code).
40 
41 // Only 64-bit interfaces are directly supported. However, the preload library
42 // supports the old 32-bit interfaces. To use this include you must specify
43 
44 // -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
45 
46 // compilation options. This ensures LP64 compatability which defines:
47 //
48 // ssize_t -> long long
49 // size_t -> unsigned long long
50 // off_t -> long long
51 
52 #if (!defined(_LARGEFILE_SOURCE) || !defined(_LARGEFILE64_SOURCE) || \
53  _FILE_OFFSET_BITS!=64) && !defined(XRDPOSIXPRELOAD32)
54 #error Compilation options are incompatible with XrdPosixExtern.hh; \
55  Specify -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
56 #endif
57 
58 // We pre-declare various structure t avoid compilation complaints. We cannot
59 // include the necessary ".h" files as these would also try to define entry
60 // points which may conflict with our definitions due to renaming pragmas and
61 // simple defines. All we want is to make sure we have the right name in the
62 // loader's symbol table so that the preload library can intercept the call.
63 // We need these definitions here because the includer may not have included
64 // all of the includes necessary to support all of the API's.
65 //
66 struct iovec;
67 struct stat;
68 struct statfs;
69 struct statvfs;
70 
71 #include <dirent.h>
72 #include <stdio.h>
73 #include <unistd.h>
74 #include <sys/types.h>
75 
77 
78 #ifdef __cplusplus
79 extern "C"
80 {
81 #endif
82 extern int XrdPosix_Access(const char *path, int amode);
83 
84 extern int XrdPosix_Acl(const char *path, int cmd, int nentries,
85  void *aclbufp);
86 
87 extern int XrdPosix_Chdir(const char *path);
88 
89 extern int XrdPosix_Close(int fildes);
90 
91 extern int XrdPosix_Closedir(DIR *dirp);
92 
93 extern int XrdPosix_Creat(const char *path, mode_t mode);
94 
95 extern int XrdPosix_Fclose(FILE *stream);
96 
97 extern int XrdPosix_Fcntl(int fd, int cmd, ...);
98 
99 extern int XrdPosix_Fdatasync(int fildes);
100 
101 extern int XrdPosix_Fflush(FILE *stream);
102 
103 #ifdef __linux__
104 extern long long XrdPosix_Fgetxattr (int fd, const char *name,
105  void *value, unsigned long long size);
106 #endif
107 
108 extern FILE *XrdPosix_Fopen(const char *path, const char *mode);
109 
110 extern size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream);
111 
112 extern int XrdPosix_Fseek(FILE *stream, long offset, int whence);
113 
114 extern int XrdPosix_Fseeko(FILE *stream, long long offset, int whence);
115 
116 extern int XrdPosix_Fstat(int fildes, struct stat *buf);
117 
118 #ifdef __linux__
119 extern int XrdPosix_FstatV(int ver, int fildes, struct stat *buf);
120 #endif
121 
122 extern int XrdPosix_Fsync(int fildes);
123 
124 extern long XrdPosix_Ftell(FILE *stream);
125 
126 extern long long XrdPosix_Ftello(FILE *stream);
127 
128 extern int XrdPosix_Ftruncate(int fildes, long long offset);
129 
130 extern size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
131 
132 #ifdef __linux__
133 extern long long XrdPosix_Getxattr (const char *path, const char *name,
134  void *value, unsigned long long size);
135 
136 extern long long XrdPosix_Lgetxattr(const char *path, const char *name,
137  void *value, unsigned long long size);
138 #endif
139 
140 extern long long XrdPosix_Lseek(int fildes, long long offset, int whence);
141 
142 extern int XrdPosix_Lstat(const char *path, struct stat *buf);
143 
144 extern int XrdPosix_Mkdir(const char *path, mode_t mode);
145 
146 extern int XrdPosix_Open(const char *path, int oflag, ...);
147 
148 extern DIR* XrdPosix_Opendir(const char *path);
149 
150 extern long XrdPosix_Pathconf(const char *path, int name);
151 
152 extern long long XrdPosix_Pread(int fildes, void *buf, unsigned long long nbyte,
153  long long offset);
154 
155 extern long long XrdPosix_Read(int fildes, void *buf, unsigned long long nbyte);
156 
157 extern long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt);
158 
159 extern struct dirent* XrdPosix_Readdir (DIR *dirp);
160 extern struct dirent64* XrdPosix_Readdir64(DIR *dirp);
161 
162 extern int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result);
163 extern int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result);
164 
165 extern int XrdPosix_Rename(const char *oname, const char *nname);
166 
167 extern void XrdPosix_Rewinddir(DIR *dirp);
168 
169 extern int XrdPosix_Rmdir(const char *path);
170 
171 extern void XrdPosix_Seekdir(DIR *dirp, long loc);
172 
173 extern int XrdPosix_Stat(const char *path, struct stat *buf);
174 
175 #if !defined(__solaris__)
176 extern int XrdPosix_Statfs(const char *path, struct statfs *buf);
177 #endif
178 
179 extern int XrdPosix_Statvfs(const char *path, struct statvfs *buf);
180 
181 extern long long XrdPosix_Pwrite(int fildes, const void *buf,
182  unsigned long long nbyte, long long offset);
183 
184 extern long XrdPosix_Telldir(DIR *dirp);
185 
186 extern int XrdPosix_Truncate(const char *path, long long offset);
187 
188 extern int XrdPosix_Unlink(const char *path);
189 
190 extern long long XrdPosix_Write(int fildes, const void *buf,
191  unsigned long long nbyte);
192 
193 extern long long XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt);
194 
195 #ifdef __cplusplus
196 };
197 #endif
198 
199 // The following is for use for wrapper classeses
200 //
201 extern int XrdPosix_isMyPath(const char *path);
202 
203 extern char *XrdPosix_URL(const char *path, char *buff, int blen);
204 
205 #endif
int XrdPosix_Statfs(const char *path, struct statfs *buf)
int XrdPosix_isMyPath(const char *path)
long long XrdPosix_Lseek(int fildes, long long offset, int whence)
int XrdPosix_Truncate(const char *path, long long offset)
long long XrdPosix_Pread(int fildes, void *buf, unsigned long long nbyte, long long offset)
void XrdPosix_Seekdir(DIR *dirp, long loc)
int XrdPosix_Creat(const char *path, mode_t mode)
DIR * XrdPosix_Opendir(const char *path)
int XrdPosix_Fflush(FILE *stream)
long long XrdPosix_Read(int fildes, void *buf, unsigned long long nbyte)
long long XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt)
int XrdPosix_Rename(const char *oname, const char *nname)
int XrdPosix_Acl(const char *path, int cmd, int nentries, void *aclbufp)
size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream)
long long XrdPosix_Pwrite(int fildes, const void *buf, unsigned long long nbyte, long long offset)
int XrdPosix_Fseeko(FILE *stream, long long offset, int whence)
long XrdPosix_Pathconf(const char *path, int name)
int XrdPosix_Fseek(FILE *stream, long offset, int whence)
int XrdPosix_Fsync(int fildes)
long XrdPosix_Telldir(DIR *dirp)
int XrdPosix_Fcntl(int fd, int cmd,...)
FILE * XrdPosix_Fopen(const char *path, const char *mode)
long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt)
int XrdPosix_Unlink(const char *path)
long XrdPosix_Ftell(FILE *stream)
int XrdPosix_Mkdir(const char *path, mode_t mode)
size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
char * XrdPosix_URL(const char *path, char *buff, int blen)
struct dirent * XrdPosix_Readdir(DIR *dirp)
int XrdPosix_Lstat(const char *path, struct stat *buf)
long long XrdPosix_Ftello(FILE *stream)
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
int XrdPosix_Ftruncate(int fildes, long long offset)
int XrdPosix_Stat(const char *path, struct stat *buf)
int XrdPosix_Open(const char *path, int oflag,...)
int XrdPosix_Closedir(DIR *dirp)
int XrdPosix_Close(int fildes)
int XrdPosix_Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
long long XrdPosix_Write(int fildes, const void *buf, unsigned long long nbyte)
int XrdPosix_Fclose(FILE *stream)
int XrdPosix_Fstat(int fildes, struct stat *buf)
int XrdPosix_Chdir(const char *path)
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
int XrdPosix_Access(const char *path, int amode)
int XrdPosix_Rmdir(const char *path)
int XrdPosix_Fdatasync(int fildes)
int XrdPosix_Statvfs(const char *path, struct statvfs *buf)
void XrdPosix_Rewinddir(DIR *dirp)