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 /* Modified by Frank Winklmeier to add the full Posix file system definition. */
12 /******************************************************************************/
13 
14 // $Id$
15 
16 // These OS-Compatible (not C++) externs are included by XrdPosix.hh to
17 // complete the macro definitions contained therein.
18 
19 // Use this file directly to define your own macros or interfaces. Note that
20 // native types are used to avoid 32/64 bit parameter/return value ambiguities
21 // and to enforce shared library compatability (needed by the preload32 code).
22 
23 // Only 64-bit interfaces are directly supported. However, the preload library
24 // supports the old 32-bit interfaces. To use this include you must specify
25 
26 // -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
27 
28 // compilation options. This ensures LP64 compatability which defines:
29 //
30 // ssize_t -> long long
31 // size_t -> unsigned long long
32 // off_t -> long long
33 
34 #if (!defined(_LARGEFILE_SOURCE) || !defined(_LARGEFILE64_SOURCE) || \
35  _FILE_OFFSET_BITS!=64) && !defined(XRDPOSIXPRELOAD32)
36 #error Compilation options are incompatible with XrdPosixExtern.hh; \
37  Specify -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
38 #endif
39 
40 // We pre-declare various structure t avoid compilation complaints. We cannot
41 // include the necessary ".h" files as these would also try to define entry
42 // points which may conflict with our definitions due to renaming pragmas and
43 // simple defines. All we want is to make sure we have the right name in the
44 // loader's symbol table so that the preload library can intercept the call.
45 // We need these definitions here because the includer may not have included
46 // all of the includes necessary to support all of the API's.
47 //
48 struct iovec;
49 struct stat;
50 struct statfs;
51 struct statvfs;
52 
53 #include <dirent.h>
54 #include <stdio.h>
55 #include <unistd.h>
56 #include <sys/types.h>
57 
59 
60 #ifdef __cplusplus
61 extern "C"
62 {
63 #endif
64 extern int XrdPosix_Access(const char *path, int amode);
65 
66 extern int XrdPosix_Acl(const char *path, int cmd, int nentries,
67  void *aclbufp);
68 
69 extern int XrdPosix_Chdir(const char *path);
70 
71 extern int XrdPosix_Close(int fildes);
72 
73 extern int XrdPosix_Closedir(DIR *dirp);
74 
75 extern int XrdPosix_Creat(const char *path, mode_t mode);
76 
77 extern int XrdPosix_Fclose(FILE *stream);
78 
79 extern int XrdPosix_Fcntl(int fd, int cmd, ...);
80 
81 extern int XrdPosix_Fdatasync(int fildes);
82 
83 extern int XrdPosix_Fflush(FILE *stream);
84 
85 #ifdef __linux__
86 extern long long XrdPosix_Fgetxattr (int fd, const char *name,
87  void *value, unsigned long long size);
88 #endif
89 
90 extern FILE *XrdPosix_Fopen(const char *path, const char *mode);
91 
92 extern size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream);
93 
94 extern int XrdPosix_Fseek(FILE *stream, long offset, int whence);
95 
96 extern int XrdPosix_Fseeko(FILE *stream, long long offset, int whence);
97 
98 extern int XrdPosix_Fstat(int fildes, struct stat *buf);
99 
100 #ifdef __linux__
101 extern int XrdPosix_FstatV(int ver, int fildes, struct stat *buf);
102 #endif
103 
104 extern int XrdPosix_Fsync(int fildes);
105 
106 extern long XrdPosix_Ftell(FILE *stream);
107 
108 extern long long XrdPosix_Ftello(FILE *stream);
109 
110 extern int XrdPosix_Ftruncate(int fildes, long long offset);
111 
112 extern size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
113 
114 #ifdef __linux__
115 extern long long XrdPosix_Getxattr (const char *path, const char *name,
116  void *value, unsigned long long size);
117 
118 extern long long XrdPosix_Lgetxattr(const char *path, const char *name,
119  void *value, unsigned long long size);
120 #endif
121 
122 extern long long XrdPosix_Lseek(int fildes, long long offset, int whence);
123 
124 extern int XrdPosix_Lstat(const char *path, struct stat *buf);
125 
126 extern int XrdPosix_Mkdir(const char *path, mode_t mode);
127 
128 extern int XrdPosix_Open(const char *path, int oflag, ...);
129 
130 extern DIR* XrdPosix_Opendir(const char *path);
131 
132 extern long XrdPosix_Pathconf(const char *path, int name);
133 
134 extern long long XrdPosix_Pread(int fildes, void *buf, unsigned long long nbyte,
135  long long offset);
136 
137 extern long long XrdPosix_Read(int fildes, void *buf, unsigned long long nbyte);
138 
139 extern long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt);
140 
141 extern struct dirent* XrdPosix_Readdir (DIR *dirp);
142 extern struct dirent64* XrdPosix_Readdir64(DIR *dirp);
143 
144 extern int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result);
145 extern int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result);
146 
147 extern int XrdPosix_Rename(const char *oname, const char *nname);
148 
149 extern void XrdPosix_Rewinddir(DIR *dirp);
150 
151 extern int XrdPosix_Rmdir(const char *path);
152 
153 extern void XrdPosix_Seekdir(DIR *dirp, long loc);
154 
155 extern int XrdPosix_Stat(const char *path, struct stat *buf);
156 
157 #if !defined(__solaris__)
158 extern int XrdPosix_Statfs(const char *path, struct statfs *buf);
159 #endif
160 
161 extern int XrdPosix_Statvfs(const char *path, struct statvfs *buf);
162 
163 extern long long XrdPosix_Pwrite(int fildes, const void *buf,
164  unsigned long long nbyte, long long offset);
165 
166 extern long XrdPosix_Telldir(DIR *dirp);
167 
168 extern int XrdPosix_Truncate(const char *path, long long offset);
169 
170 extern int XrdPosix_Unlink(const char *path);
171 
172 extern long long XrdPosix_Write(int fildes, const void *buf,
173  unsigned long long nbyte);
174 
175 extern long long XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt);
176 
177 #ifdef __cplusplus
178 };
179 #endif
180 
181 // The following is for use for wrapper classeses
182 //
183 extern int XrdPosix_isMyPath(const char *path);
184 
185 extern char *XrdPosix_URL(const char *path, char *buff, int blen);
186 
187 #endif