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