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#include <cstdio>
73#include <unistd.h>
74#include <sys/types.h>
75
77
78#ifdef __cplusplus
79extern "C"
80{
81#endif
82extern int XrdPosix_Access(const char *path, int amode);
83
84extern int XrdPosix_Acl(const char *path, int cmd, int nentries,
85 void *aclbufp);
86
87extern int XrdPosix_Chdir(const char *path);
88
89extern int XrdPosix_Close(int fildes);
90
91extern int XrdPosix_Closedir(DIR *dirp);
92
93extern int XrdPosix_Creat(const char *path, mode_t mode);
94
95extern int XrdPosix_Fclose(FILE *stream);
96
97extern int XrdPosix_Fcntl(int fd, int cmd, ...);
98
99extern int XrdPosix_Fdatasync(int fildes);
100
101extern int XrdPosix_Fflush(FILE *stream);
102
103#if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
104extern long long XrdPosix_Fgetxattr (int fd, const char *name,
105 void *value, unsigned long long size);
106#endif
107
108extern FILE *XrdPosix_Fopen(const char *path, const char *mode);
109
110extern size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream);
111
112extern int XrdPosix_Fseek(FILE *stream, long offset, int whence);
113
114extern int XrdPosix_Fseeko(FILE *stream, long long offset, int whence);
115
116extern int XrdPosix_Fstat(int fildes, struct stat *buf);
117
118#ifdef __linux__
119extern int XrdPosix_FstatV(int ver, int fildes, struct stat *buf);
120#endif
121
122extern int XrdPosix_Fsync(int fildes);
123
124extern long XrdPosix_Ftell(FILE *stream);
125
126extern long long XrdPosix_Ftello(FILE *stream);
127
128extern int XrdPosix_Ftruncate(int fildes, long long offset);
129
130extern size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
131
132#if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
133extern long long XrdPosix_Getxattr (const char *path, const char *name,
134 void *value, unsigned long long size);
135
136extern long long XrdPosix_Lgetxattr(const char *path, const char *name,
137 void *value, unsigned long long size);
138#endif
139
140extern long long XrdPosix_Lseek(int fildes, long long offset, int whence);
141
142extern int XrdPosix_Lstat(const char *path, struct stat *buf);
143
144extern int XrdPosix_Mkdir(const char *path, mode_t mode);
145
146extern int XrdPosix_Open(const char *path, int oflag, ...);
147
148extern DIR* XrdPosix_Opendir(const char *path);
149
150extern long XrdPosix_Pathconf(const char *path, int name);
151
152extern long long XrdPosix_Pread(int fildes, void *buf, unsigned long long nbyte,
153 long long offset);
154
155extern long long XrdPosix_Read(int fildes, void *buf, unsigned long long nbyte);
156
157extern long long 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 long long XrdPosix_Pwrite(int fildes, const void *buf,
182 unsigned long long nbyte, long long offset);
183
184extern long XrdPosix_Telldir(DIR *dirp);
185
186extern int XrdPosix_Truncate(const char *path, long long offset);
187
188extern int XrdPosix_Unlink(const char *path);
189
190extern long long XrdPosix_Write(int fildes, const void *buf,
191 unsigned long long nbyte);
192
193extern long long XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt);
194
195#ifdef __cplusplus
196};
197#endif
198
199// The following is for use for wrapper classeses
200//
201extern int XrdPosix_isMyPath(const char *path);
202
203extern char *XrdPosix_URL(const char *path, char *buff, int blen);
204
205#endif
int XrdPosix_Statfs(const char *path, struct statfs *buf)
int XrdPosix_Rename(const char *oname, const char *nname)
long long XrdPosix_Pread(int fildes, void *buf, unsigned long long nbyte, long long offset)
long long XrdPosix_Write(int fildes, const void *buf, unsigned long long nbyte)
long long XrdPosix_Lseek(int fildes, long long offset, int whence)
long long XrdPosix_Writev(int fildes, const struct iovec *iov, int iovcnt)
int XrdPosix_Closedir(DIR *dirp)
int XrdPosix_Fsync(int fildes)
int XrdPosix_isMyPath(const char *path)
long long XrdPosix_Ftello(FILE *stream)
int XrdPosix_Open(const char *path, int oflag,...)
void XrdPosix_Rewinddir(DIR *dirp)
long long XrdPosix_Readv(int fildes, const struct iovec *iov, int iovcnt)
int XrdPosix_Readdir64_r(DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
int XrdPosix_Close(int fildes)
void XrdPosix_Seekdir(DIR *dirp, long loc)
int XrdPosix_Rmdir(const char *path)
int XrdPosix_Chdir(const char *path)
int XrdPosix_Stat(const char *path, struct stat *buf)
int XrdPosix_Fcntl(int fd, int cmd,...)
int XrdPosix_Fseek(FILE *stream, long offset, int whence)
long XrdPosix_Ftell(FILE *stream)
int XrdPosix_Readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
long long XrdPosix_Pwrite(int fildes, const void *buf, unsigned long long nbyte, long long offset)
int XrdPosix_Mkdir(const char *path, mode_t mode)
long long XrdPosix_Read(int fildes, void *buf, unsigned long long nbyte)
int XrdPosix_Fflush(FILE *stream)
DIR * XrdPosix_Opendir(const char *path)
long XrdPosix_Telldir(DIR *dirp)
int XrdPosix_Lstat(const char *path, struct stat *buf)
int XrdPosix_Creat(const char *path, mode_t mode)
int XrdPosix_Statvfs(const char *path, struct statvfs *buf)
int XrdPosix_Acl(const char *path, int cmd, int nentries, void *aclbufp)
int XrdPosix_Fstat(int fildes, struct stat *buf)
FILE * XrdPosix_Fopen(const char *path, const char *mode)
size_t XrdPosix_Fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream)
int XrdPosix_Fclose(FILE *stream)
int XrdPosix_Fdatasync(int fildes)
int XrdPosix_Ftruncate(int fildes, long long offset)
long XrdPosix_Pathconf(const char *path, int name)
int XrdPosix_Truncate(const char *path, long long offset)
int XrdPosix_Unlink(const char *path)
char * XrdPosix_URL(const char *path, char *buff, int blen)
struct dirent64 * XrdPosix_Readdir64(DIR *dirp)
size_t XrdPosix_Fread(void *ptr, size_t size, size_t nitems, FILE *stream)
int XrdPosix_Fseeko(FILE *stream, long long offset, int whence)
int XrdPosix_Access(const char *path, int amode)
struct dirent * XrdPosix_Readdir(DIR *dirp)
#define statvfs(a, b)
Definition XrdPosix.hh:100
#define stat(a, b)
Definition XrdPosix.hh:96
#define statfs(a, b)
Definition XrdPosix.hh:98
Definition XrdOucIOVec.hh:65