25 #if !defined(__LCLINT__) && !defined(__UCLIBC__) && defined(__GLIBC__) && \
26 (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
27 #define USE_COOKIE_SEEK_POINTER 1
136 size_t Fread(
void * buf,
size_t size,
size_t nmemb, FD_t
fd)
146 size_t Fwrite(
const void * buf,
size_t size,
size_t nmemb, FD_t
fd)
176 FD_t
Fdopen(FD_t ofd,
const char * fmode)
183 FD_t
Fopen(
const char * path,
227 int Mkdir(
const char * path, mode_t
mode)
234 int Chdir(
const char * path)
241 int Rmdir(
const char * path)
252 int Chroot(
const char * path)
267 int Rename(
const char * oldpath,
const char * newpath)
274 int Link(
const char * oldpath,
const char * newpath)
281 int Unlink(
const char * path)
288 int Stat(
const char * path,
struct stat *
st)
295 int Lstat(
const char * path,
struct stat *
st)
324 int Chown(
const char * path, uid_t owner, gid_t group)
332 int Fchown(FD_t
fd, uid_t owner, gid_t group)
340 int Lchown(
const char * path, uid_t owner, gid_t group)
348 int Chmod(
const char * path, mode_t
mode)
404 int Mknod(
const char * path, mode_t
mode, dev_t dev)
413 int Utime(
const char * path,
const struct utimbuf * buf)
421 int Utimes(
const char * path,
const struct timeval * times)
429 int Lutimes(
const char * path,
const struct timeval * times)
437 int Symlink(
const char * oldpath,
const char * newpath)
446 int Readlink(
const char * path,
char * buf,
size_t bufsiz)
455 int Access(
const char * path,
int amode)
459 #if defined(__linux__)
463 int Mount(
const char *source,
const char *target,
464 const char *filesystemtype,
unsigned long mountflags,
472 int Umount(
const char *target)
479 int Umount2(
const char *target,
int flags)
493 int Glob_error(
const char * epath,
int eerrno)
500 int errfunc(
const char * epath,
int eerrno),
518 char *
Realpath(
const char * path,
char * resolved_path)
548 ssize_t
fdRead(
void * cookie,
char * buf,
size_t count)
551 #define fdRead(_fd, _buf, _count) fdio->read((_fd), (_buf), (_count))
555 ssize_t
fdWrite(
void * cookie,
const char * buf,
size_t count)
558 #define fdWrite(_fd, _buf, _count) fdio->write((_fd), (_buf), (_count))
565 #define fdClose(_fd) fdio->close(_fd)
569 FD_t
fdOpen(
const char *path,
int flags, mode_t
mode)
572 #define fdOpen(_path, _flags, _mode) fdio->_open((_path), (_flags), (_mode))
578 FD_t
fdLink (
void * cookie,
const char *
msg)
581 #define fdLink(_fd, _msg) \
582 ((FD_t)rpmioLinkPoolItem((rpmioItem)(_fd), _msg, __FILE__, __LINE__))
590 #define fdFree(_fd, _msg) \
591 ((FD_t)rpmioFreePoolItem((rpmioItem)(_fd), _msg, __FILE__, __LINE__))
601 FD_t
XfdNew (
const char *
msg,
const char *
fn,
unsigned ln)
604 #define fdNew(_msg) XfdNew(_msg, __FILE__, __LINE__)
647 extern char * (*Getpass) (
const char * prompt)
649 char *
_GetPass (
const char * prompt)
713 int ufdCopy(FD_t sfd, FD_t tfd)
788 size_t size,
int limit,
int flags,
789 char * (*dbg) (
void *item),
790 void (*init) (
void *item),
791 void (*fini) (
void *item))
805 const char *
msg,
const char *
fn,
unsigned ln)
819 const char *
msg,
const char *
fn,
unsigned ln)
833 const char *
msg,
const char *
fn,
unsigned ln)
int ufdCopy(FD_t sfd, FD_t tfd)
FD_t(* fdio_fopen_function_t)(const char *path, const char *fmode)
int fdWritable(FD_t fd, int secs)
int Fcntl(FD_t fd, int op, void *lip)
fcntl(2) clone.
int Fchflags(FD_t fd, unsigned int flags)
fchflags(2) clone.
ftperrCode_e
FTP and HTTP error codes.
int Chroot(const char *path)
chroot(2) clone.
int Symlink(const char *oldpath, const char *newpath)
symlink(3) clone.
size_t Fwrite(const void *buf, size_t size, size_t nmemb, FD_t fd)
fwrite(3) clone.
int Glob_error(const char *epath, int eerrno)
glob_error(3) clone.
int Fsetpos(FD_t fd, fpos_t *pos)
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
int Utimes(const char *path, const struct timeval *times)
utimes(2) clone.
rpmioItem rpmioLinkPoolItem(rpmioItem item, const char *msg, const char *fn, unsigned ln)
Increment a pool item refcount.
int Access(const char *path, int amode)
access(2) clone.
enum ftperrCode_e ftperrCode
FTP and HTTP error codes.
int rpmioMkpath(const char *path, mode_t mode, uid_t uid, gid_t gid)
Insure that directories in path exist, creating as needed.
int Fgetpos(FD_t fd, fpos_t *pos)
const char * urlStrerror(const char *url)
int Stat(const char *path, struct stat *st)
stat(2) clone.
void Globfree(void *_pglob)
globfree(3) clone.
int Open(const char *path, int flags, mode_t mode)
open(2) clone.
int Fflush(FD_t fd)
fflush(3) clone.
void * rpmioFreePoolItem(rpmioItem item, const char *msg, const char *fn, unsigned ln)
Free a pool item.
int Link(const char *oldpath, const char *newpath)
link(2) clone.
ssize_t(* fdio_write_function_t)(void *cookie, const char *buf, size_t nbytes)
fdio_fdopen_function_t _fdopen
int Fadvise(FD_t fd, off_t offset, off_t length, int advice)
posix_fadvise(2) clone.
const char * ftpStrerror(int errorNumber)
FD_t(* fdio_fdopen_function_t)(void *cookie, const char *fmode)
int Fseek(FD_t fd, _libio_off_t offset, int whence)
fseek(3) clone.
int Utime(const char *path, const struct utimbuf *buf)
static PyObject *char * mode
fdio_fopen_function_t _fopen
#define fdLink(_fd, _msg)
int Fstat(FD_t fd, struct stat *st)
fstat(2) clone.
int Chown(const char *path, uid_t owner, gid_t group)
chown(2) clone.
int(* fdio_close_function_t)(void *cookie)
int Fchown(FD_t fd, uid_t owner, gid_t group)
fchown(2) clone.
const char * Fstrerror(FD_t fd)
strerror(3) clone.
fdio_close_function_t close
int Rmdir(const char *path)
rmdir(2) clone.
int Lutimes(const char *path, const struct timeval *times)
lutimes(2) clone.
int Glob(const char *pattern, int flags, int errfunc(const char *epath, int eerrno), void *_pglob)
glob(3) clone.
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
int Rename(const char *oldpath, const char *newpath)
rename(2) clone.
char * _RequestPass(const char *prompt)
int Mkdir(const char *path, mode_t mode)
mkdir(2) clone.
int Lstat(const char *path, struct stat *st)
lstat(2) clone.
int fdReadable(FD_t fd, int secs)
int Chflags(const char *path, unsigned int flags)
chflags(2) clone.
int rpmioAccess(const char *FN, const char *path, int mode)
Check FN access, expanding relative paths and twiddles.
int Fallocate(FD_t fd, off_t offset, off_t length)
posix_fallocate(3)/fallocate(2) clone.
int Glob_pattern_p(const char *pattern, int quote)
glob_pattern_p(3) clone.
The FD_t File Handle data structure.
fdio_flush_function_t _flush
rpmioItem rpmioPutPool(rpmioItem item)
Put unused item into pool (or free).
int Mknod(const char *path, mode_t mode, dev_t dev)
mknod(3) clone.
int Chdir(const char *path)
chdir(2) clone.
void * ufdGetUrlinfo(FD_t fd)
size_t Fread(void *buf, size_t size, size_t nmemb, FD_t fd)
fread(3) clone.
int Fchmod(FD_t fd, mode_t mode)
fchmod(2) clone.
int Fclose(FD_t fd)
fclose(3) clone.
rpmioItem rpmioUnlinkPoolItem(rpmioItem item, const char *msg, const char *fn, unsigned ln)
Decrement a pool item refcount.
int Readlink(const char *path, char *buf, size_t bufsiz)
readlink(2) clone.
FD_t XfdNew(const char *msg, const char *fn, unsigned ln)
int ufdGetFile(FD_t sfd, FD_t tfd)
int Ferror(FD_t fd)
ferror(3) clone.
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
FD_t Fdopen(FD_t ofd, const char *fmode)
int(* fdio_flush_function_t)(void *cookie)
int Lchown(const char *path, uid_t owner, gid_t group)
lchown(2) clone.
off_t _libio_off_t
Hide libio API lossage.
const char * _chroot_prefix
fdio_write_function_t write
int Fileno(FD_t fd)
fileno(3) clone.
int Chmod(const char *path, mode_t mode)
chmod(2) clone.
ssize_t(* fdio_read_function_t)(void *cookie, char *buf, size_t nbytes)
char * buf
Parse (and execute) macro undefinition.
fdio_read_function_t read
int
Save source and expand field into target.
int Lchmod(const char *path, mode_t mode)
lchmod(2) clone.
int(* fdio_seek_function_t)(void *cookie, _libio_pos_t pos, int whence)
fdio_seek_function_t seek
int Lchflags(const char *path, unsigned int flags)
lchflags(2) clone.
off_t Lseek(int fdno, off_t offset, int whence)
lseek(2) clone.
char * _GetPass(const char *prompt)
char * Realpath(const char *path, char *resolved_path)
realpath(3) clone.
#define fdFree(_fd, _msg)
rpmioPool rpmioFreePool(rpmioPool pool)
Reclaim memory pool items.
int Mkfifo(const char *path, mode_t mode)
mkfifo(3) clone.
int Unlink(const char *path)
unlink(2) clone.