rpm  4.8.1
rpmio.h
Go to the documentation of this file.
1 #ifndef H_RPMIO
2 #define H_RPMIO
3 
9 #include <sys/types.h>
10 #include <sys/stat.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <unistd.h>
14 
15 #include <rpm/rpmtypes.h>
16 #include <rpm/rpmsw.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
28 #if defined(__GLIBC__) && \
29  (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
30 #define USE_COOKIE_SEEK_POINTER 1
31 typedef _IO_off64_t _libio_off_t;
32 typedef _libio_off_t * _libio_pos_t;
33 #else
34 typedef off_t _libio_off_t;
35 typedef off_t _libio_pos_t;
36 #endif
37 
40 typedef const struct FDIO_s * FDIO_t;
41 
42 
50 const char * Fstrerror(FD_t fd);
51 
55 ssize_t Fread(void * buf, size_t size, size_t nmemb, FD_t fd);
56 
60 ssize_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd);
61 
65 int Fseek(FD_t fd, _libio_off_t offset, int whence);
66 
70 off_t Ftell(FD_t fd);
71 
75 int Fclose( FD_t fd);
76 
79 FD_t Fdopen(FD_t ofd, const char * fmode);
80 
84 FD_t Fopen(const char * path,
85  const char * fmode);
86 
87 
91 int Fflush(FD_t fd);
92 
96 int Ferror(FD_t fd);
97 
101 int Fileno(FD_t fd);
102 
106 int Fcntl(FD_t fd, int op, void *lip);
107 
114 off_t fdSize(FD_t fd);
115 
118 FD_t fdDup(int fdno);
119 
123 FILE * fdGetFILE(FD_t fd);
124 
127 FD_t fdLink (void * cookie, const char * msg);
128 
131 FD_t fdFree(FD_t fd, const char * msg);
132 
135 FD_t fdNew (const char * msg);
136 
139 int fdWritable(FD_t fd, int secs);
140 
143 int fdReadable(FD_t fd, int secs);
144 
147 int ufdCopy(FD_t sfd, FD_t tfd);
148 
154 ssize_t timedRead(FD_t fd, void * bufptr, size_t length);
155 
159 typedef enum fdOpX_e {
166 } fdOpX;
167 
171 rpmop fdOp(FD_t fd, fdOpX opx);
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif /* H_RPMIO */
int Fcntl(FD_t fd, int op, void *lip)
fcntl(2) clone.
off_t _libio_off_t
Hide libio API lossage.
Definition: rpmio.h:34
const struct FDIO_s * FDIO_t
Definition: rpmio.h:40
fdOpX_e
Identify per-desciptor I/O operation statistics.
Definition: rpmio.h:159
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:82
int ufdCopy(FD_t sfd, FD_t tfd)
ssize_t timedRead(FD_t fd, void *bufptr, size_t length)
XXX the name is misleading, this is a legacy wrapper that ensures only S_ISREG() files are read...
const char * Fstrerror(FD_t fd)
strerror(3) clone.
off_t Ftell(FD_t fd)
ftell(3) clone.
int Fileno(FD_t fd)
fileno(3) clone.
FD_t fdLink(void *cookie, const char *msg)
ssize_t Fwrite(const void *buf, size_t size, size_t nmemb, FD_t fd)
fwrite(3) clone.
int Fflush(FD_t fd)
fflush(3) clone.
off_t _libio_pos_t
Definition: rpmio.h:35
int fdWritable(FD_t fd, int secs)
FD_t fdNew(const char *msg)
FD_t Fdopen(FD_t ofd, const char *fmode)
ssize_t Fread(void *buf, size_t size, size_t nmemb, FD_t fd)
fread(3) clone.
FD_t fdDup(int fdno)
int fdReadable(FD_t fd, int secs)
int Ferror(FD_t fd)
ferror(3) clone.
FD_t fdFree(FD_t fd, const char *msg)
enum fdOpX_e fdOpX
Identify per-desciptor I/O operation statistics.
int Fclose(FD_t fd)
fclose(3) clone.
FD_t Fopen(const char *path, const char *fmode)
fopen(3) clone.
Cumulative statistics for an operation.
Definition: rpmsw.h:40
FILE * fdGetFILE(FD_t fd)
Get associated FILE stream from fd (if any)
rpmop fdOp(FD_t fd, fdOpX opx)
int Fseek(FD_t fd, _libio_off_t offset, int whence)
fseek(3) clone.
off_t fdSize(FD_t fd)