XRootD
Loading...
Searching...
No Matches
XrdPosixExtern.hh
Go to the documentation of this file.
1#ifndef __XRDPOSIXEXTERN_H__
2#define __XRDPOSIXEXTERN_H__
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//
67struct iovec;
68struct stat;
69struct statfs;
70struct 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
84extern "C"
85{
86#endif
87extern int XrdPosix_Access(const char *path, int amode);
88
89extern int XrdPosix_Acl(const char *path, int cmd, int nentries,
90 void *aclbufp);
91
92extern int XrdPosix_Chdir(const char *path);
93
94extern int XrdPosix_Close(int fildes);
95
96extern int XrdPosix_Closedir(DIR *dirp);
97
98extern int XrdPosix_Creat(const char *path, mode_t mode);
99
100extern int XrdPosix_Fclose(FILE *stream);
101
102extern int XrdPosix_Fcntl(int fd, int cmd, ...);
103
104extern int XrdPosix_Fdatasync(int fildes);
105
106extern int XrdPosix_Fflush(FILE *stream);
107
108#if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
109extern ssize_t XrdPosix_Fgetxattr (int fd, const char *name, void *value, size_t 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, off_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 off_t XrdPosix_Ftello(FILE *stream);
131
132extern int XrdPosix_Ftruncate(int fildes, off_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 ssize_t XrdPosix_Getxattr (const char *path, const char *name, void *value, size_t size);
138
139extern ssize_t XrdPosix_Lgetxattr(const char *path, const char *name, void *value, size_t size);
140#endif
141
142extern off_t XrdPosix_Lseek(int fildes, off_t offset, int whence);
143
144extern int XrdPosix_Lstat(const char *path, struct stat *buf);
145
146extern int XrdPosix_Mkdir(const char *path, mode_t mode);
147
148extern int XrdPosix_Open(const char *path, int oflag, ...);
149
150extern DIR* XrdPosix_Opendir(const char *path);
151
152extern long XrdPosix_Pathconf(const char *path, int name);
153
154extern ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte, off_t offset);
155
156extern ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte);
157
158extern ssize_t XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt);
159
160extern struct dirent* XrdPosix_Readdir (DIR *dirp);
161extern struct dirent64* XrdPosix_Readdir64(DIR *dirp);
162
163extern int XrdPosix_Readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result);
164extern int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result);
165
166extern int XrdPosix_Rename(const char *oname, const char *nname);
167
168extern void XrdPosix_Rewinddir(DIR *dirp);
169
170extern int XrdPosix_Rmdir(const char *path);
171
172extern void XrdPosix_Seekdir(DIR *dirp, long loc);
173
174extern int XrdPosix_Stat(const char *path, struct stat *buf);
175
176#if !defined(__solaris__)
177extern int XrdPosix_Statfs(const char *path, struct statfs *buf);
178#endif
179
180extern int XrdPosix_Statvfs(const char *path, struct statvfs *buf);
181
182extern int XrdPosix_Statx(int dirfd, const char *path, int flags,
183 unsigned int mask, XrdSysStatx *stx);
184
185extern ssize_t XrdPosix_Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset);
186
187extern long XrdPosix_Telldir(DIR *dirp);
188
189extern int XrdPosix_Truncate(const char *path, off_t offset);
190
191extern int XrdPosix_Unlink(const char *path);
192
193extern ssize_t XrdPosix_Write(int fildes, const void *buf, size_t nbyte);
194
195extern ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt);
196
197#ifdef __cplusplus
198};
199#endif
200
201// The following is for use for wrapper classeses
202//
203extern int XrdPosix_isMyPath(const char *path);
204
205extern char *XrdPosix_URL(const char *path, char *buff, int blen);
206
207#endif
int XrdPosix_Statfs(const char *path, struct statfs *buf)
Definition XrdPosix.cc:968
int XrdPosix_Truncate(const char *path, off_t offset)
Definition XrdPosix.cc:1028
int XrdPosix_Ftruncate(int fildes, off_t offset)
ssize_t XrdPosix_Read(int fildes, void *buf, size_t nbyte)
Definition XrdPosix.cc:749
int XrdPosix_Rename(const char *oname, const char *nname)
Definition XrdPosix.cc:833
int XrdPosix_Closedir(DIR *dirp)
Definition XrdPosix.cc:189
int XrdPosix_Fsync(int fildes)
Definition XrdPosix.cc:450
ssize_t XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt)
Definition XrdPosix.cc:765
int XrdPosix_isMyPath(const char *path)
Definition XrdPosix.cc:1108
int XrdPosix_Open(const char *path, int oflag,...)
Definition XrdPosix.cc:641
void XrdPosix_Rewinddir(DIR *dirp)
Definition XrdPosix.cc:859
ssize_t XrdPosix_Pread(int fildes, void *buf, size_t nbyte, off_t offset)
Definition XrdPosix.cc:717
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
Definition XrdPosix.cc:817
int XrdPosix_Close(int fildes)
Definition XrdPosix.cc:174
void XrdPosix_Seekdir(DIR *dirp, long loc)
Definition XrdPosix.cc:900
int XrdPosix_Rmdir(const char *path)
Definition XrdPosix.cc:875
int XrdPosix_Chdir(const char *path)
Definition XrdPosix.cc:157
int XrdPosix_Stat(const char *path, struct stat *buf)
Definition XrdPosix.cc:916
int XrdPosix_Fcntl(int fd, int cmd,...)
Definition XrdPosix.cc:237
int XrdPosix_Fseek(FILE *stream, long offset, int whence)
Definition XrdPosix.cc:380
long XrdPosix_Ftell(FILE *stream)
Definition XrdPosix.cc:466
int XrdPosix_Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
Definition XrdPosix.cc:808
int XrdPosix_Mkdir(const char *path, mode_t mode)
Definition XrdPosix.cc:616
int XrdPosix_Fflush(FILE *stream)
Definition XrdPosix.cc:287
DIR * XrdPosix_Opendir(const char *path)
Definition XrdPosix.cc:677
ssize_t XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt)
Definition XrdPosix.cc:1094
long XrdPosix_Telldir(DIR *dirp)
Definition XrdPosix.cc:1012
ssize_t XrdPosix_Pwrite(int fildes, const void *buf, size_t nbyte, off_t offset)
Definition XrdPosix.cc:733
int XrdPosix_Lstat(const char *path, struct stat *buf)
Definition XrdPosix.cc:590
int XrdPosix_Creat(const char *path, mode_t mode)
Definition XrdPosix.cc:203
int XrdPosix_Statx(int dirfd, const char *path, int flags, unsigned int mask, XrdSysStatx *stx)
Definition XrdPosix.cc:938
int XrdPosix_Statvfs(const char *path, struct statvfs *buf)
Definition XrdPosix.cc:990
int XrdPosix_Acl(const char *path, int cmd, int nentries, void *aclbufp)
Definition XrdPosix.cc:143
int XrdPosix_Fstat(int fildes, struct stat *buf)
Definition XrdPosix.cc:416
off_t XrdPosix_Lseek(int fildes, off_t offset, int whence)
Definition XrdPosix.cc:574
ssize_t XrdPosix_Write(int fildes, const void *buf, size_t nbyte)
Definition XrdPosix.cc:1078
FILE * XrdPosix_Fopen(const char *path, const char *mode)
Definition XrdPosix.cc:307
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:516
int XrdPosix_Fclose(FILE *stream)
Definition XrdPosix.cc:217
off_t XrdPosix_Ftello(FILE *stream)
Definition XrdPosix.cc:483
int XrdPosix_Fdatasync(int fildes)
Definition XrdPosix.cc:256
long XrdPosix_Pathconf(const char *path, int name)
Definition XrdPosix.cc:704
int XrdPosix_Unlink(const char *path)
Definition XrdPosix.cc:1053
char * XrdPosix_URL(const char *path, char *buff, int blen)
Definition XrdPosix.cc:1117
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
Definition XrdPosix.cc:792
size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream)
Definition XrdPosix.cc:354
int XrdPosix_Access(const char *path, int amode)
Definition XrdPosix.cc:116
struct dirent * XrdPosix_Readdir(DIR *dirp)
Definition XrdPosix.cc:783
#define statvfs(a, b)
Definition XrdPosix.hh:105
#define stat(a, b)
Definition XrdPosix.hh:101
#define statfs(a, b)
Definition XrdPosix.hh:103
#define dirfd(x)