15 #include <rpm/rpmtypes.h>
16 #include <rpm/rpmsw.h>
23 * Hide libio API lossage.
24 * The libio interface changed after glibc-2.1.3 to pass the seek offset
25 * argument as a pointer rather than as an off_t. The snarl below defines
26 * typedefs to isolate the lossage.
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;
34 typedef off_t _libio_off_t;
35 typedef off_t _libio_pos_t;
40 typedef const struct FDIO_s * FDIO_t;
44 * \name RPMIO Interface.
50 const char * Fstrerror(FD_t fd);
55 ssize_t Fread(void * buf, size_t size, size_t nmemb, FD_t fd);
60 ssize_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd);
65 int Fseek(FD_t fd, _libio_off_t offset, int whence);
79 FD_t Fdopen(FD_t ofd, const char * fmode);
84 FD_t Fopen(const char * path,
106 int Fcntl(FD_t fd, int op, void *lip);
109 * \name RPMIO Utilities.
114 off_t fdSize(FD_t fd);
118 FD_t fdDup(int fdno);
121 * Get associated FILE stream from fd (if any)
123 FILE * fdGetFILE(FD_t fd);
127 FD_t fdLink(void * cookie);
131 FD_t fdFree(FD_t fd);
139 int ufdCopy(FD_t sfd, FD_t tfd);
142 * XXX the name is misleading, this is a legacy wrapper that ensures
143 * only S_ISREG() files are read, nothing to do with timed...
144 * TODO: get this out of the API
146 ssize_t timedRead(FD_t fd, void * bufptr, size_t length);
149 * Identify per-desciptor I/O operation statistics.
151 typedef enum fdOpX_e {
152 FDSTAT_READ = 0, /*!< Read statistics index. */
153 FDSTAT_WRITE = 1, /*!< Write statistics index. */
154 FDSTAT_SEEK = 2, /*!< Seek statistics index. */
155 FDSTAT_CLOSE = 3, /*!< Close statistics index */
156 FDSTAT_DIGEST = 4, /*!< Digest statistics index. */
163 rpmop fdOp(FD_t fd, fdOpX opx);