XRootD
Loading...
Searching...
No Matches
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//
66struct iovec;
67struct stat;
68struct statfs;
69struct 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
83extern "C"
84{
85#endif
86extern int XrdPosix_Access(const char *path, int amode);
87
88extern int XrdPosix_Acl(const char *path, int cmd, int nentries,
89 void *aclbufp);
90
91extern int XrdPosix_Chdir(const char *path);
92
93extern int XrdPosix_Close(int fildes);
94
95extern int XrdPosix_Closedir(DIR *dirp);
96
97extern int XrdPosix_Creat(const char *path, mode_t mode);
98
99extern int XrdPosix_Fclose(FILE *stream);
100
101extern int XrdPosix_Fcntl(int fd, int cmd, ...);
102
103extern int XrdPosix_Fdatasync(int fildes);
104
105extern int XrdPosix_Fflush(FILE *stream);
106
107#if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
108extern long long XrdPosix_Fgetxattr (int fd, const char *name,
109 void *value, unsigned long long size);
110#endif
111
112extern FILE *XrdPosix_Fopen(const char *path, const char *mode);
113
114extern size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream);
115
116extern int XrdPosix_Fseek(FILE *stream, long offset, int whence);
117
118extern int XrdPosix_Fseeko(FILE *stream, off64_t offset, int whence);
119
120extern int XrdPosix_Fstat(int fildes, struct stat *buf);
121
122#ifdef __linux__
123extern int XrdPosix_FstatV(int ver, int fildes, struct stat *buf);
124#endif
125
126extern int XrdPosix_Fsync(int fildes);
127
128extern long XrdPosix_Ftell(FILE *stream);
129
130extern off64_t XrdPosix_Ftello(FILE *stream);
131
132extern int XrdPosix_Ftruncate(int fildes, off64_t offset);
133
134extern 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__))
137extern off64_t XrdPosix_Getxattr (const char *path, const char *name,
138 void *value, unsigned long long size);
139
140extern off64_t XrdPosix_Lgetxattr(const char *path, const char *name,
141 void *value, unsigned long long size);
142#endif
143
144extern off64_t XrdPosix_Lseek(int fildes, off64_t offset, int whence);
145
146extern int XrdPosix_Lstat(const char *path, struct stat *buf);
147
148extern int XrdPosix_Mkdir(const char *path, mode_t mode);
149
150extern int XrdPosix_Open(const char *path, int oflag, ...);
151
152extern DIR* XrdPosix_Opendir(const char *path);
153
154extern long XrdPosix_Pathconf(const char *path, int name);
155
156extern ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte,
157 off64_t offset);
158
159extern ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte);
160
161extern long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt);
162
163extern struct dirent* XrdPosix_Readdir (DIR *dirp);
164extern struct dirent64* XrdPosix_Readdir64(DIR *dirp);
165
166extern int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result);
167extern int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result);
168
169extern int XrdPosix_Rename(const char *oname, const char *nname);
170
171extern void XrdPosix_Rewinddir(DIR *dirp);
172
173extern int XrdPosix_Rmdir(const char *path);
174
175extern void XrdPosix_Seekdir(DIR *dirp, long loc);
176
177extern int XrdPosix_Stat(const char *path, struct stat *buf);
178
179#if !defined(__solaris__)
180extern int XrdPosix_Statfs(const char *path, struct statfs *buf);
181#endif
182
183extern int XrdPosix_Statvfs(const char *path, struct statvfs *buf);
184
185extern ssize_t XrdPosix_Pwrite(int fildes, const void *buf,
186 size_t nbyte, off64_t offset);
187
188extern long XrdPosix_Telldir(DIR *dirp);
189
190extern int XrdPosix_Truncate(const char *path, off64_t offset);
191
192extern int XrdPosix_Unlink(const char *path);
193
194extern ssize_t XrdPosix_Write(int fildes, const void *buf,
195 size_t nbyte);
196
197extern 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//
205extern int XrdPosix_isMyPath(const char *path);
206
207extern 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:945
ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte)
int XrdPosix_Rename(const char *oname, const char *nname)
Definition XrdPosix.cc:836
int XrdPosix_Closedir(DIR *dirp)
Definition XrdPosix.cc:187
int XrdPosix_Fsync(int fildes)
Definition XrdPosix.cc:449
int XrdPosix_isMyPath(const char *path)
Definition XrdPosix.cc:1085
int XrdPosix_Open(const char *path, int oflag,...)
Definition XrdPosix.cc:642
void XrdPosix_Rewinddir(DIR *dirp)
Definition XrdPosix.cc:862
long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt)
Definition XrdPosix.cc:768
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
Definition XrdPosix.cc:820
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:903
int XrdPosix_Rmdir(const char *path)
Definition XrdPosix.cc:878
int XrdPosix_Chdir(const char *path)
Definition XrdPosix.cc:155
off64_t XrdPosix_Ftello(FILE *stream)
Definition XrdPosix.cc:482
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition XrdPosix.cc:919
int XrdPosix_Fcntl(int fd, int cmd,...)
Definition XrdPosix.cc:235
int XrdPosix_Fseek(FILE *stream, long offset, int whence)
Definition XrdPosix.cc:379
long XrdPosix_Ftell(FILE *stream)
Definition XrdPosix.cc:465
int XrdPosix_Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
Definition XrdPosix.cc:811
int XrdPosix_Mkdir(const char *path, mode_t mode)
Definition XrdPosix.cc:617
int XrdPosix_Fflush(FILE *stream)
Definition XrdPosix.cc:286
DIR * XrdPosix_Opendir(const char *path)
Definition XrdPosix.cc:678
ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt)
Definition XrdPosix.cc:1071
long XrdPosix_Telldir(DIR *dirp)
Definition XrdPosix.cc:989
int XrdPosix_Lstat(const char *path, struct stat *buf)
Definition XrdPosix.cc:591
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:967
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:415
ssize_t XrdPosix_Write(int fildes, const void *buf, size_t nbyte)
FILE * XrdPosix_Fopen(const char *path, const char *mode)
Definition XrdPosix.cc:306
size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
Definition XrdPosix.cc:515
int XrdPosix_Fclose(FILE *stream)
Definition XrdPosix.cc:215
int XrdPosix_Fdatasync(int fildes)
Definition XrdPosix.cc:254
long XrdPosix_Pathconf(const char *path, int name)
Definition XrdPosix.cc:705
int XrdPosix_Unlink(const char *path)
Definition XrdPosix.cc:1030
char * XrdPosix_URL(const char *path, char *buff, int blen)
Definition XrdPosix.cc:1094
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
Definition XrdPosix.cc:795
size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream)
Definition XrdPosix.cc:353
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
struct dirent * XrdPosix_Readdir(DIR *dirp)
Definition XrdPosix.cc:786
#define statvfs(a, b)
Definition XrdPosix.hh:105
#define stat(a, b)
Definition XrdPosix.hh:101
#define statfs(a, b)
Definition XrdPosix.hh:103