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 compatibility (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 compatibility 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 #ifdef __cplusplus
73 #include <cstdio>
74 #else
75 #include <stdio.h>
76 #endif
77 #include <unistd.h>
78 #include <sys/types.h>
79 
81 
82 #ifdef __cplusplus
83 extern "C"
84 {
85 #endif
86 extern int XrdPosix_Access(const char *path, int amode);
87 
88 extern int XrdPosix_Acl(const char *path, int cmd, int nentries,
89  void *aclbufp);
90 
91 extern int XrdPosix_Chdir(const char *path);
92 
93 extern int XrdPosix_Close(int fildes);
94 
95 extern int XrdPosix_Closedir(DIR *dirp);
96 
97 extern int XrdPosix_Creat(const char *path, mode_t mode);
98 
99 extern int XrdPosix_Fclose(FILE *stream);
100 
101 extern int XrdPosix_Fcntl(int fd, int cmd, ...);
102 
103 extern int XrdPosix_Fdatasync(int fildes);
104 
105 extern int XrdPosix_Fflush(FILE *stream);
106 
107 #if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
108 extern long long XrdPosix_Fgetxattr (int fd, const char *name,
109  void *value, unsigned long long size);
110 #endif
111 
112 extern FILE *XrdPosix_Fopen(const char *path, const char *mode);
113 
114 extern size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream);
115 
116 extern int XrdPosix_Fseek(FILE *stream, long offset, int whence);
117 
118 extern int XrdPosix_Fseeko(FILE *stream, off64_t offset, int whence);
119 
120 extern int XrdPosix_Fstat(int fildes, struct stat *buf);
121 
122 #ifdef __linux__
123 extern int XrdPosix_FstatV(int ver, int fildes, struct stat *buf);
124 #endif
125 
126 extern int XrdPosix_Fsync(int fildes);
127 
128 extern long XrdPosix_Ftell(FILE *stream);
129 
130 extern off64_t XrdPosix_Ftello(FILE *stream);
131 
132 extern int XrdPosix_Ftruncate(int fildes, off64_t offset);
133 
134 extern size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
135 
136 #if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
137 extern off64_t XrdPosix_Getxattr (const char *path, const char *name,
138  void *value, unsigned long long size);
139 
140 extern off64_t XrdPosix_Lgetxattr(const char *path, const char *name,
141  void *value, unsigned long long size);
142 #endif
143 
144 extern off64_t XrdPosix_Lseek(int fildes, off64_t offset, int whence);
145 
146 extern int XrdPosix_Lstat(const char *path, struct stat *buf);
147 
148 extern int XrdPosix_Mkdir(const char *path, mode_t mode);
149 
150 extern int XrdPosix_Open(const char *path, int oflag, ...);
151 
152 extern DIR* XrdPosix_Opendir(const char *path);
153 
154 extern long XrdPosix_Pathconf(const char *path, int name);
155 
156 extern ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte,
157  off64_t offset);
158 
159 extern ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte);
160 
161 extern long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt);
162 
163 extern struct dirent* XrdPosix_Readdir (DIR *dirp);
164 extern struct dirent64* XrdPosix_Readdir64(DIR *dirp);
165 
166 extern int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result);
167 extern int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result);
168 
169 extern int XrdPosix_Rename(const char *oname, const char *nname);
170 
171 extern void XrdPosix_Rewinddir(DIR *dirp);
172 
173 extern int XrdPosix_Rmdir(const char *path);
174 
175 extern void XrdPosix_Seekdir(DIR *dirp, long loc);
176 
177 extern int XrdPosix_Stat(const char *path, struct stat *buf);
178 
179 #if !defined(__solaris__)
180 extern int XrdPosix_Statfs(const char *path, struct statfs *buf);
181 #endif
182 
183 extern int XrdPosix_Statvfs(const char *path, struct statvfs *buf);
184 
185 extern ssize_t XrdPosix_Pwrite(int fildes, const void *buf,
186  size_t nbyte, off64_t offset);
187 
188 extern long XrdPosix_Telldir(DIR *dirp);
189 
190 extern int XrdPosix_Truncate(const char *path, off64_t offset);
191 
192 extern int XrdPosix_Unlink(const char *path);
193 
194 extern ssize_t XrdPosix_Write(int fildes, const void *buf,
195  size_t nbyte);
196 
197 extern ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt);
198 
199 #ifdef __cplusplus
200 };
201 #endif
202 
203 // The following is for use for wrapper classeses
204 //
205 extern int XrdPosix_isMyPath(const char *path);
206 
207 extern char *XrdPosix_URL(const char *path, char *buff, int blen);
208 
209 #endif
int XrdPosix_Statfs(const char *path, struct statfs *buf)
Definition: XrdPosix.cc:943
ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte)
int XrdPosix_Rename(const char *oname, const char *nname)
Definition: XrdPosix.cc:834
int XrdPosix_Closedir(DIR *dirp)
Definition: XrdPosix.cc:187
int XrdPosix_Fsync(int fildes)
Definition: XrdPosix.cc:447
int XrdPosix_isMyPath(const char *path)
Definition: XrdPosix.cc:1083
int XrdPosix_Open(const char *path, int oflag,...)
Definition: XrdPosix.cc:640
void XrdPosix_Rewinddir(DIR *dirp)
Definition: XrdPosix.cc:860
long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt)
Definition: XrdPosix.cc:766
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
Definition: XrdPosix.cc:818
int XrdPosix_Close(int fildes)
Definition: XrdPosix.cc:172
int XrdPosix_Truncate(const char *path, off64_t offset)
off64_t XrdPosix_Lseek(int fildes, off64_t offset, int whence)
void XrdPosix_Seekdir(DIR *dirp, long loc)
Definition: XrdPosix.cc:901
int XrdPosix_Rmdir(const char *path)
Definition: XrdPosix.cc:876
int XrdPosix_Chdir(const char *path)
Definition: XrdPosix.cc:155
FILE * XrdPosix_Fopen(const char *path, const char *mode)
Definition: XrdPosix.cc:306
off64_t XrdPosix_Ftello(FILE *stream)
Definition: XrdPosix.cc:480
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition: XrdPosix.cc:917
int XrdPosix_Fcntl(int fd, int cmd,...)
Definition: XrdPosix.cc:235
int XrdPosix_Fseek(FILE *stream, long offset, int whence)
Definition: XrdPosix.cc:377
long XrdPosix_Ftell(FILE *stream)
Definition: XrdPosix.cc:463
int XrdPosix_Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
Definition: XrdPosix.cc:809
int XrdPosix_Mkdir(const char *path, mode_t mode)
Definition: XrdPosix.cc:615
int XrdPosix_Fflush(FILE *stream)
Definition: XrdPosix.cc:286
char * XrdPosix_URL(const char *path, char *buff, int blen)
Definition: XrdPosix.cc:1092
ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt)
Definition: XrdPosix.cc:1069
DIR * XrdPosix_Opendir(const char *path)
Definition: XrdPosix.cc:676
long XrdPosix_Telldir(DIR *dirp)
Definition: XrdPosix.cc:987
int XrdPosix_Lstat(const char *path, struct stat *buf)
Definition: XrdPosix.cc:589
int XrdPosix_Ftruncate(int fildes, off64_t offset)
int XrdPosix_Fseeko(FILE *stream, off64_t offset, int whence)
int XrdPosix_Creat(const char *path, mode_t mode)
Definition: XrdPosix.cc:201
int XrdPosix_Statvfs(const char *path, struct statvfs *buf)
Definition: XrdPosix.cc:965
ssize_t XrdPosix_Pwrite(int fildes, const void *buf, size_t nbyte, off64_t offset)
int XrdPosix_Acl(const char *path, int cmd, int nentries, void *aclbufp)
Definition: XrdPosix.cc:141
int XrdPosix_Fstat(int fildes, struct stat *buf)
Definition: XrdPosix.cc:413
ssize_t XrdPosix_Write(int fildes, const void *buf, size_t nbyte)
size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
Definition: XrdPosix.cc:513
int XrdPosix_Fclose(FILE *stream)
Definition: XrdPosix.cc:215
int XrdPosix_Fdatasync(int fildes)
Definition: XrdPosix.cc:254
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
Definition: XrdPosix.cc:793
long XrdPosix_Pathconf(const char *path, int name)
Definition: XrdPosix.cc:703
struct dirent * XrdPosix_Readdir(DIR *dirp)
Definition: XrdPosix.cc:784
int XrdPosix_Unlink(const char *path)
Definition: XrdPosix.cc:1028
size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream)
Definition: XrdPosix.cc:351
ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte, off64_t offset)
int XrdPosix_Access(const char *path, int amode)
Definition: XrdPosix.cc:114
int stat(const char *path, struct stat *buf)
int statvfs(const char *path, struct statvfs *buf)
int statfs(const char *path, struct statfs *buf)