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 ssize_t XrdPosix_Fgetxattr (int fd, const char *name, void *value, size_t size);
109#endif
110
111extern FILE *XrdPosix_Fopen(const char *path, const char *mode);
112
113extern size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream);
114
115extern int XrdPosix_Fseek(FILE *stream, long offset, int whence);
116
117extern int XrdPosix_Fseeko(FILE *stream, off_t offset, int whence);
118
119extern int XrdPosix_Fstat(int fildes, struct stat *buf);
120
121#ifdef __linux__
122extern int XrdPosix_FstatV(int ver, int fildes, struct stat *buf);
123#endif
124
125extern int XrdPosix_Fsync(int fildes);
126
127extern long XrdPosix_Ftell(FILE *stream);
128
129extern off_t XrdPosix_Ftello(FILE *stream);
130
131extern int XrdPosix_Ftruncate(int fildes, off_t offset);
132
133extern size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
134
135#if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
136extern ssize_t XrdPosix_Getxattr (const char *path, const char *name, void *value, size_t size);
137
138extern ssize_t XrdPosix_Lgetxattr(const char *path, const char *name, void *value, size_t size);
139#endif
140
141extern off_t XrdPosix_Lseek(int fildes, off_t offset, int whence);
142
143extern int XrdPosix_Lstat(const char *path, struct stat *buf);
144
145extern int XrdPosix_Mkdir(const char *path, mode_t mode);
146
147extern int XrdPosix_Open(const char *path, int oflag, ...);
148
149extern DIR* XrdPosix_Opendir(const char *path);
150
151extern long XrdPosix_Pathconf(const char *path, int name);
152
153extern ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte, off_t offset);
154
155extern ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte);
156
157extern ssize_t XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt);
158
159extern struct dirent* XrdPosix_Readdir (DIR *dirp);
160extern struct dirent64* XrdPosix_Readdir64(DIR *dirp);
161
162extern int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result);
163extern int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result);
164
165extern int XrdPosix_Rename(const char *oname, const char *nname);
166
167extern void XrdPosix_Rewinddir(DIR *dirp);
168
169extern int XrdPosix_Rmdir(const char *path);
170
171extern void XrdPosix_Seekdir(DIR *dirp, long loc);
172
173extern int XrdPosix_Stat(const char *path, struct stat *buf);
174
175#if !defined(__solaris__)
176extern int XrdPosix_Statfs(const char *path, struct statfs *buf);
177#endif
178
179extern int XrdPosix_Statvfs(const char *path, struct statvfs *buf);
180
181extern ssize_t XrdPosix_Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset);
182
183extern long XrdPosix_Telldir(DIR *dirp);
184
185extern int XrdPosix_Truncate(const char *path, off_t offset);
186
187extern int XrdPosix_Unlink(const char *path);
188
189extern ssize_t XrdPosix_Write(int fildes, const void *buf, size_t nbyte);
190
191extern ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt);
192
193#ifdef __cplusplus
194};
195#endif
196
197// The following is for use for wrapper classeses
198//
199extern int XrdPosix_isMyPath(const char *path);
200
201extern char *XrdPosix_URL(const char *path, char *buff, int blen);
202
203#endif
int XrdPosix_Statfs(const char *path, struct statfs *buf)
Definition XrdPosix.cc:940
int XrdPosix_Truncate(const char *path, off_t offset)
Definition XrdPosix.cc:1000
int XrdPosix_Ftruncate(int fildes, off_t offset)
ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte)
Definition XrdPosix.cc:747
int XrdPosix_Rename(const char *oname, const char *nname)
Definition XrdPosix.cc:831
int XrdPosix_Closedir(DIR *dirp)
Definition XrdPosix.cc:187
int XrdPosix_Fsync(int fildes)
Definition XrdPosix.cc:448
ssize_t XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt)
Definition XrdPosix.cc:763
int XrdPosix_isMyPath(const char *path)
Definition XrdPosix.cc:1080
int XrdPosix_Open(const char *path, int oflag,...)
Definition XrdPosix.cc:639
void XrdPosix_Rewinddir(DIR *dirp)
Definition XrdPosix.cc:857
ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte, off_t offset)
Definition XrdPosix.cc:715
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
Definition XrdPosix.cc:815
int XrdPosix_Close(int fildes)
Definition XrdPosix.cc:172
void XrdPosix_Seekdir(DIR *dirp, long loc)
Definition XrdPosix.cc:898
int XrdPosix_Rmdir(const char *path)
Definition XrdPosix.cc:873
int XrdPosix_Chdir(const char *path)
Definition XrdPosix.cc:155
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition XrdPosix.cc:914
int XrdPosix_Fcntl(int fd, int cmd,...)
Definition XrdPosix.cc:235
int XrdPosix_Fseek(FILE *stream, long offset, int whence)
Definition XrdPosix.cc:378
long XrdPosix_Ftell(FILE *stream)
Definition XrdPosix.cc:464
int XrdPosix_Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
Definition XrdPosix.cc:806
int XrdPosix_Mkdir(const char *path, mode_t mode)
Definition XrdPosix.cc:614
int XrdPosix_Fflush(FILE *stream)
Definition XrdPosix.cc:285
DIR * XrdPosix_Opendir(const char *path)
Definition XrdPosix.cc:675
ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt)
Definition XrdPosix.cc:1066
long XrdPosix_Telldir(DIR *dirp)
Definition XrdPosix.cc:984
ssize_t XrdPosix_Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset)
Definition XrdPosix.cc:731
int XrdPosix_Lstat(const char *path, struct stat *buf)
Definition XrdPosix.cc:588
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:962
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:414
off_t XrdPosix_Lseek(int fildes, off_t offset, int whence)
Definition XrdPosix.cc:572
ssize_t XrdPosix_Write(int fildes, const void *buf, size_t nbyte)
Definition XrdPosix.cc:1050
FILE * XrdPosix_Fopen(const char *path, const char *mode)
Definition XrdPosix.cc:305
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:514
int XrdPosix_Fclose(FILE *stream)
Definition XrdPosix.cc:215
off_t XrdPosix_Ftello(FILE *stream)
Definition XrdPosix.cc:481
int XrdPosix_Fdatasync(int fildes)
Definition XrdPosix.cc:254
long XrdPosix_Pathconf(const char *path, int name)
Definition XrdPosix.cc:702
int XrdPosix_Unlink(const char *path)
Definition XrdPosix.cc:1025
char * XrdPosix_URL(const char *path, char *buff, int blen)
Definition XrdPosix.cc:1089
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
Definition XrdPosix.cc:790
size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream)
Definition XrdPosix.cc:352
int XrdPosix_Access(const char *path, int amode)
Definition XrdPosix.cc:114
struct dirent * XrdPosix_Readdir(DIR *dirp)
Definition XrdPosix.cc:781
#define statvfs(a, b)
Definition XrdPosix.hh:105
#define stat(a, b)
Definition XrdPosix.hh:101
#define statfs(a, b)
Definition XrdPosix.hh:103