# rpmio/rpmio.h File Reference

`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <dirent.h>`
`#include "glob.h"`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <unistd.h>`

Include dependency graph for rpmio.h:

Go to the source code of this file.

## Data Structures
struct | FDIO_s
## RPMIO Utilities.
#define | fdFileno(_fd) fdio->_fileno(_fd)
#define | fdOpen(_path, _flags, _mode) fdio->_open((_path), (_flags), (_mode))
#define | fdRead(_fd, _buf, _count) fdio->read((_fd), (_buf), (_count))
#define | fdWrite(_fd, _buf, _count) fdio->write((_fd), (_buf), (_count))
#define | fdClose(_fd) fdio->close(_fd)
#define | fdLink(_fd, _msg) fdio->_fdref(_fd, _msg, __FILE__, __LINE__)
#define | fdFree(_fd, _msg) fdio->_fdderef(_fd, _msg, __FILE__, __LINE__)
#define | fdNew(_msg) fdio->_fdnew(_msg, __FILE__, __LINE__)
enum | ftperrCode_e { FTPERR_NE_ERROR = -1, FTPERR_NE_LOOKUP = -2, FTPERR_NE_AUTH = -3, FTPERR_NE_PROXYAUTH = -4, FTPERR_NE_CONNECT = -5, FTPERR_NE_TIMEOUT = -6, FTPERR_NE_FAILED = -7, FTPERR_NE_RETRY = -8, FTPERR_NE_REDIRECT = -9, FTPERR_BAD_SERVER_RESPONSE = -81, FTPERR_SERVER_IO_ERROR = -82, FTPERR_SERVER_TIMEOUT = -83, FTPERR_BAD_HOST_ADDR = -84, FTPERR_BAD_HOSTNAME = -85, FTPERR_FAILED_CONNECT = -86, FTPERR_FILE_IO_ERROR = -87, FTPERR_PASSIVE_ERROR = -88, FTPERR_FAILED_DATA_CONNECT = -89, FTPERR_FILE_NOT_FOUND = -90, FTPERR_NIC_ABORT_IN_PROGRESS = -91, FTPERR_UNKNOWN = -100 }
| FTP and HTTP error codes. More...
typedef enum ftperrCode_e | ftperrCode
| FTP and HTTP error codes.
char *(* | Getpass )(const char *prompt)
| Return a password.
FDIO_t | fdio
FDIO_t | fpio
FDIO_t | ufdio
FDIO_t | gzdio
FDIO_t | bzdio
FDIO_t | lzdio
FDIO_t | fadio
off_t | fdSize (FD_t fd)
FD_t | fdDup (int fdno)
int | fdFileno (void *cookie)
FD_t | fdOpen (const char *path, int flags, mode_t mode)
ssize_t | fdRead (void *cookie, char *buf, size_t count)
ssize_t | fdWrite (void *cookie, const char *buf, size_t count)
int | fdClose (void *cookie)
FD_t | fdLink (void *cookie, const char *msg)
FD_t | fdFree (FD_t fd, const char *msg)
FD_t | fdNew (const char *msg)
int | fdWritable (FD_t fd, int secs)
int | fdReadable (FD_t fd, int secs)
int | rpmioMkpath (const char *path, mode_t mode, uid_t uid, gid_t gid)
| Insure that directories in path exist, creating as needed.
int | rpmioAccess (const char *FN, const char *path, int mode)
| Check FN access, expanding relative paths and twiddles.
char * | _GetPass (const char *prompt)
char * | _RequestPass (const char *prompt)
const char * | ftpStrerror (int errorNumber)
void * | ufdGetUrlinfo (FD_t fd)
const char * | urlStrerror (const char *url)
int | ufdCopy (FD_t sfd, FD_t tfd)
int | ufdGetFile (FD_t sfd, FD_t tfd)
## RPMRPC Interface.
const char * | _chroot_prefix
int | Mkdir (const char *path, mode_t mode)
| mkdir(2) clone.
int | Chdir (const char *path)
| chdir(2) clone.
int | Rmdir (const char *path)
| rmdir(2) clone.
int | Chroot (const char *path)
| chroot(2) clone.
int | Open (const char *path, int flags, mode_t mode)
| open(2) clone.
int | Rename (const char *oldpath, const char *newpath)
| rename(2) clone.
int | Link (const char *oldpath, const char *newpath)
| link(2) clone.
int | Unlink (const char *path)
| unlink(2) clone.
int | Stat (const char *path, struct stat *st)
| stat(2) clone.
int | Lstat (const char *path, struct stat *st)
| lstat(2) clone.
int | Chown (const char *path, uid_t owner, gid_t group)
| chown(2) clone.
int | Lchown (const char *path, uid_t owner, gid_t group)
| lchown(2) clone.
int | Chmod (const char *path, mode_t mode)
| chmod(2) clone.
int | Mkfifo (const char *path, mode_t mode)
| mkfifo(3) clone.
int | Mknod (const char *path, mode_t mode, dev_t dev)
| mknod(3) clone.
int | Utime (const char *path, const struct utimbuf *buf)
int | Utimes (const char *path, const struct timeval *times)
| utimes(2) clone.
int | Symlink (const char *oldpath, const char *newpath)
| symlink(3) clone.
int | Readlink (const char *path, char *buf, size_t bufsiz)
| readlink(2) clone.
int | Access (const char *path, int amode)
| access(2) clone.
int | Glob_pattern_p (const char *pattern, int quote)
| glob_pattern_p(3) clone.
int | Glob_error (const char *epath, int eerrno)
| glob_error(3) clone.
int | Glob (const char *pattern, int flags, int errfunc(const char *epath, int eerrno), glob_t *pglob)
| glob(3) clone.
void | Globfree (glob_t *pglob)
| globfree(3) clone.
DIR * | Opendir (const char *path)
| opendir(3) clone.
struct dirent * | Readdir (DIR *dir)
| readdir(3) clone.
int | Closedir (DIR *dir)
| closedir(3) clone.
off_t | Lseek (int fdno, off_t offset, int whence)
| lseek(2) clone.
## Typedefs
typedef struct _FD_s * | FD_t
typedef struct FDIO_s * | FDIO_t
typedef off_t | _libio_off_t
| Hide libio API lossage.
typedef off_t | _libio_pos_t
RPMIO Vectors.
typedef ssize_t(* | fdio_read_function_t )(void *cookie, char *buf, size_t nbytes)
typedef ssize_t(* | fdio_write_function_t )(void *cookie, const char *buf, size_t nbytes)
typedef int(* | fdio_seek_function_t )(void *cookie, _libio_pos_t pos, int whence)
typedef int(* | fdio_close_function_t )(void *cookie)
typedef FD_t(* | fdio_ref_function_t )(void *cookie, const char *msg, const char *file, unsigned line)
typedef FD_t(* | fdio_deref_function_t )(FD_t fd, const char *msg, const char *file, unsigned line)
typedef FD_t(* | fdio_new_function_t )(const char *msg, const char *file, unsigned line)
typedef int(* | fdio_fileno_function_t )(void *cookie)
typedef FD_t(* | fdio_open_function_t )(const char *path, int flags, mode_t mode)
typedef FD_t(* | fdio_fopen_function_t )(const char *path, const char *fmode)
typedef void *(* | fdio_ffileno_function_t )(FD_t fd)
typedef int(* | fdio_fflush_function_t )(FD_t fd)
RPMRPC Vectors.
typedef int(* | fdio_mkdir_function_t )(const char *path, mode_t mode)
typedef int(* | fdio_chdir_function_t )(const char *path)
typedef int(* | fdio_rmdir_function_t )(const char *path)
typedef int(* | fdio_rename_function_t )(const char *oldpath, const char *newpath)
typedef int(* | fdio_unlink_function_t )(const char *path)
typedef int(* | fdio_stat_function_t )(const char *path, struct stat *st)
typedef int(* | fdio_lstat_function_t )(const char *path, struct stat *st)
typedef int(* | fdio_access_function_t )(const char *path, int amode)
## Functions
static int | xislower (int c)
static int | xisupper (int c)
static int | xisalpha (int c)
static int | xisdigit (int c)
static int | xisalnum (int c)
static int | xisblank (int c)
static int | xisspace (int c)
static int | xiscntrl (int c)
static int | xisascii (int c)
static int | xisprint (int c)
static int | xisgraph (int c)
static int | xispunct (int c)
static int | xtolower (int c)
static int | xtoupper (int c)
int | xstrcasecmp (const char *s1, const char *s2)
| Locale insensitive strcasecmp(3).
int | xstrncasecmp (const char *s1, const char *s2, size_t n)
| Locale insensitive strncasecmp(3).
const char * | xstrtolocale (const char *str)
| Force encoding of string.
static void * | _free (const void *p)
| Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
void | rpmioClean (void)
| Free all memory allocated by rpmio usage.
RPMIO Interface.
const char * | Fstrerror (FD_t fd)
| strerror(3) clone.
size_t | Fread (void *buf, size_t size, size_t nmemb, FD_t fd)
| fread(3) clone.
size_t | Fwrite (const void *buf, size_t size, size_t nmemb, FD_t fd)
| fwrite(3) clone.
int | Fseek (FD_t fd, _libio_off_t offset, int whence)
| fseek(3) clone.
int | Fclose (FD_t fd)
| fclose(3) clone.
FD_t | Fdopen (FD_t ofd, const char *fmode)
FD_t | Fopen (const char *path, const char *fmode)
| fopen(3) clone.
int | Fflush (FD_t fd)
| fflush(3) clone.
int | Ferror (FD_t fd)
| ferror(3) clone.
int | Fileno (FD_t fd)
| fileno(3) clone.
int | Fcntl (FD_t fd, int op, void *lip)
| fcntl(2) clone.

## Detailed Description

Definition in file rpmio.h.

## Define Documentation

#define fdClose | ( | _fd |  | ) | fdio->close(_fd)

Definition at line 626 of file rpmio.h.

#define fdFileno | ( | _fd |  | ) | fdio->_fileno(_fd)

Definition at line 593 of file rpmio.h.

Referenced by __fdClose(), __fdRead(), __fdWrite(), fdFgets(), fdReadable(), fdSeek(), fdWritable(), Ferror(), Fopen(), ftpAbort(), ftpLogin(), ftpReq(), httpReq(), lzdFdopen(), ufdRead(), and urlConnect().

#define fdFree | ( | _fd,
|  | _msg |  | ) | fdio->_fdderef(_fd, _msg, __FILE__, __LINE__)

Definition at line 644 of file rpmio.h.

Referenced by __fdClose(), closeCallback(), delTE(), Fclose(), fsmTeardown(), ftpAbort(), ftpCmd(), ftpFileDone(), lzdClose(), manageFile(), packageBinaries(), packageSources(), rpmShowProgress(), rpmtsFree(), rpmtsSetScriptFd(), ufdClose(), and urlConnect().

#define fdLink | ( | _fd,
|  | _msg |  | ) | fdio->_fdref(_fd, _msg, __FILE__, __LINE__)

Definition at line 635 of file rpmio.h.

Referenced by closeCallback(), Fclose(), Fdopen(), fsmSetup(), ftpLogin(), ftpNLST(), ftpOpen(), ftpReq(), httpReq(), lzdReadOpen(), lzdWriteOpen(), manageFile(), rpmfd_Fopen(), rpmInstallSourcePackage(), rpmShowProgress(), rpmtsSetScriptFd(), ufdOpen(), and urlConnect().

#define fdNew | ( | _msg |  | ) | fdio->_fdnew(_msg, __FILE__, __LINE__)

Definition at line 653 of file rpmio.h.

Referenced by __fdOpen(), fdDup(), ftpOpen(), lzdReadOpen(), lzdWriteOpen(), packageBinaries(), packageSources(), and urlConnect().

#define fdOpen | ( | _path,
|  | _flags,
|  | _mode |  | ) | fdio->_open((_path), (_flags), (_mode))

Definition at line 601 of file rpmio.h.

#define fdRead | ( | _fd,
|  | _buf,
|  | _count |  | ) | fdio->read((_fd), (_buf), (_count))

Definition at line 611 of file rpmio.h.

#define fdWrite | ( | _fd,
|  | _buf,
|  | _count |  | ) | fdio->write((_fd), (_buf), (_count))

Definition at line 619 of file rpmio.h.

## Typedef Documentation

typedef int(* fdio_access_function_t)(const char *path, int amode)

Definition at line 187 of file rpmio.h.

typedef int(* fdio_chdir_function_t)(const char *path)

Definition at line 150 of file rpmio.h.

typedef int(* fdio_close_function_t)(void *cookie)

Definition at line 76 of file rpmio.h.

typedef FD_t(* fdio_deref_function_t)(FD_t fd, const char *msg, const char *file, unsigned line)

Definition at line 90 of file rpmio.h.

typedef void*(* fdio_ffileno_function_t)(FD_t fd)

Definition at line 125 of file rpmio.h.

typedef int(* fdio_fflush_function_t)(FD_t fd)

Definition at line 131 of file rpmio.h.

typedef int(* fdio_fileno_function_t)(void *cookie)

Definition at line 106 of file rpmio.h.

typedef FD_t(* fdio_fopen_function_t)(const char *path, const char *fmode)

Definition at line 119 of file rpmio.h.

typedef int(* fdio_lstat_function_t)(const char *path,struct stat *st)

Definition at line 181 of file rpmio.h.

typedef int(* fdio_mkdir_function_t)(const char *path, mode_t mode)

Definition at line 144 of file rpmio.h.

typedef FD_t(* fdio_new_function_t)(const char *msg, const char *file, unsigned line)

Definition at line 98 of file rpmio.h.

typedef FD_t(* fdio_open_function_t)(const char *path, int flags, mode_t mode)

Definition at line 113 of file rpmio.h.

typedef ssize_t(* fdio_read_function_t)(void *cookie, char *buf, size_t nbytes)

Definition at line 56 of file rpmio.h.

typedef FD_t(* fdio_ref_function_t)(void *cookie, const char *msg, const char *file, unsigned line)

Definition at line 83 of file rpmio.h.

typedef int(* fdio_rename_function_t)(const char *oldpath, const char *newpath)

Definition at line 162 of file rpmio.h.

typedef int(* fdio_rmdir_function_t)(const char *path)

Definition at line 156 of file rpmio.h.

typedef int(* fdio_seek_function_t)(void *cookie, _libio_pos_t pos, int whence)

Definition at line 70 of file rpmio.h.

typedef int(* fdio_stat_function_t)(const char *path,struct stat *st)

Definition at line 175 of file rpmio.h.

typedef int(* fdio_unlink_function_t)(const char *path)

Definition at line 168 of file rpmio.h.

typedef ssize_t(* fdio_write_function_t)(void *cookie, const char *buf, size_t nbytes)

Definition at line 64 of file rpmio.h.

typedef enum ftperrCode_e ftperrCode

FTP and HTTP error codes.

## Enumeration Type Documentation

enum ftperrCode_e

FTP and HTTP error codes.

Enumerator:

  FTPERR_NE_ERROR | Generic error.
  FTPERR_NE_LOOKUP | Hostname lookup failed.
  FTPERR_NE_AUTH | Server authentication failed.
  FTPERR_NE_PROXYAUTH | Proxy authentication failed.
  FTPERR_NE_CONNECT | Could not connect to server.
  FTPERR_NE_TIMEOUT | Connection timed out.
  FTPERR_NE_FAILED | The precondition failed.
  FTPERR_NE_RETRY | Retry request.
  FTPERR_NE_REDIRECT | Redirect received.
  FTPERR_BAD_SERVER_RESPONSE | Bad server response
  FTPERR_SERVER_IO_ERROR | Server I/O error
  FTPERR_SERVER_TIMEOUT | Server timeout
  FTPERR_BAD_HOST_ADDR | Unable to lookup server host address
  FTPERR_BAD_HOSTNAME | Unable to lookup server host name
  FTPERR_FAILED_CONNECT | Failed to connect to server
  FTPERR_FILE_IO_ERROR | Failed to establish data connection to server
  FTPERR_PASSIVE_ERROR | I/O error to local file
  FTPERR_FAILED_DATA_CONNECT | Error setting remote server to passive mode
  FTPERR_FILE_NOT_FOUND | File not found on server
  FTPERR_NIC_ABORT_IN_PROGRESS | Abort in progress
  FTPERR_UNKNOWN | Unknown or unexpected error

Definition at line 707 of file rpmio.h.

## Function Documentation

static void* _free | ( | const void * | p | ) | `[inline, static]`

Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.

Parameters:

  | p | memory to free

Returns:
  NULL always

Definition at line 871 of file rpmio.h.

char* _GetPass | ( | const char * | prompt | ) |

Definition at line 13 of file getpass.c.

char* _RequestPass | ( | const char * | prompt | ) |

Definition at line 37 of file getpass.c.

References argvSplit().

int Access | ( | const char * | path,
|  | int | amode |
| ) |  |  |

access(2) clone.

Todo:
  Implement remotely.

Definition at line 1656 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmdbRebuild(), rpmInstallSourcePackage(), and rpmioAccess().

int Chdir | ( | const char * | path | ) |

chdir(2) clone.

Definition at line 98 of file rpmrpc.c.

References errno, ftpChdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by enterChroot(), getOutputFrom(), leaveChroot(), rpmpsmStage(), rpmtsRun(), and runScript().

int Chmod | ( | const char * | path,
|  | mode_t | mode |
| ) |  |  |

chmod(2) clone.

Todo:
  Implement remotely.

Definition at line 1458 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), rpmdbMoveDatabase(), and sql_open().

int Chown | ( | const char * | path,
|  | uid_t | owner,
|  | gid_t | group |
| ) |  |  |

chown(2) clone.

Todo:
  Implement remotely.

Definition at line 1406 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), rpmdbMoveDatabase(), and rpmioMkpath().

int Chroot | ( | const char * | path | ) |

chroot(2) clone.

Todo:
  Implement remotely.

Definition at line 164 of file rpmrpc.c.

References _chroot_prefix, _free(), _rpmio_debug, errno, rpmGetPath(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by enterChroot(), leaveChroot(), rpmpsmStage(), rpmtsRun(), and runScript().

int Closedir | ( | DIR * | dir | ) |

closedir(3) clone.

Definition at line 1830 of file rpmrpc.c.

References _rpmio_debug.

Referenced by Fts_open(), and Glob().

int Fclose | ( | FD_t | fd | ) |

fclose(3) clone.

Definition at line 3199 of file rpmio.c.

References FDIO_s::close, DBGIO, fdbg(), fdClose, fdFree, fdGetFdno(), fdGetFILE, FDIOVEC, fdLink, _FDSTACK_s::fdno, fdPop(), FDSANE, fdSetFp(), _FDSTACK_s::fp, fpio, _FD_s::fps, _FDSTACK_s::io, _FD_s::nfps, noLibio, _FD_s::persist, _FD_s::req, and ufdClose().

Referenced by addFileToTagAux(), closeCallback(), closeSpec(), cpio_doio(), dodigest(), doIcon(), fsmStage(), IDTXglob(), isCompressed(), makeGPGSignature(), makeHDRSignature(), manageFile(), processPackageFiles(), readLineFromOFI(), rpmcliSign(), rpmdbExportInfo(), rpmdsCpuinfo(), rpmdsSysinfoFile(), rpmfd_dealloc(), rpmfd_free(), rpmfd_init(), rpmgiFree(), rpmgiLoadManifest(), rpmgiNext(), rpmgiOpen(), rpmgiReadHeader(), rpmHeaderFromFD(), rpmHeaderFromFile(), rpmInstallSource(), rpmInstallSourcePackage(), rpmioSlurp(), rpmLoadMacroFile(), rpmpsmStage(), rpmShowProgress(), rpmSingleHeaderFromFD(), rpmTempFile(), rpmts_dealloc(), rpmts_free(), rpmts_HdrFromFdno(), rpmtsCallback(), rpmtsRollback(), rpmtsSolve(), runScript(), showVerifyPackage(), ufdGetFile(), unsatisfiedDepend(), urlGetFile(), writeRPM(), and XurlFree().

int Fcntl | ( | FD_t | fd,
|  | int | op,
|  | void * | lip |
| ) |  |  |

fcntl(2) clone.

Definition at line 3635 of file rpmio.c.

References Fileno().

int fdClose | ( | void * | cookie | ) |

FD_t fdDup | ( | int | fdno | ) |

Definition at line 263 of file rpmio.c.

References DBGIO, fdbg(), fdNew, fdSetFdno(), and fdSetOpen().

Referenced by cpio_doio(), dodigest(), rpmHeaderFromFD(), rpmpsmStage(), rpmSingleHeaderFromFD(), rpmts_HdrFromFdno(), rpmts_setattro(), rpmtsCallback(), runScript(), showVerifyPackage(), and ufdOpen().

int fdFileno | ( | void * | cookie | ) |

FD_t fdFree | ( | FD_t | fd,
|  | const char * | msg |
| ) |  |  |

FD_t fdLink | ( | void * | cookie,
|  | const char * | msg |
| ) |  |  |

FD_t fdNew | ( | const char * | msg | ) |

FD_t fdOpen | ( | const char * | path,
|  | int | flags,
|  | mode_t | mode |
| ) |  |  |

FD_t Fdopen | ( | FD_t | ofd,
|  | const char * | fmode |
| ) |  |  |

Definition at line 3375 of file rpmio.c.

References _rpmio_debug, FDIO_s::close, cvtfmode(), DBGIO, fdbg(), fdGetFp(), fdLink, fdPush(), FDSANE, fdSetFp(), Fileno(), fpio, lzdFdopen(), noLibio, FDIO_s::read, FDIO_s::seek, and FDIO_s::write.

Referenced by cpio_doio(), Fopen(), rpmpsmStage(), and rpmReadPackageManifest().

ssize_t fdRead | ( | void * | cookie,
|  | char * | buf,
|  | size_t | count |
| ) |  |  |

int fdReadable | ( | FD_t | fd,
|  | int | secs |
| ) |  |  |

Definition at line 614 of file rpmio.c.

References errno, fdFileno, and _FD_s::req.

Referenced by fdFgets(), ftpAbort(), ufdClose(), and ufdRead().

off_t fdSize | ( | FD_t | fd | ) |

Definition at line 236 of file rpmio.c.

References _FD_s::contentLength, DBGIO, FDSANE, Fileno(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and _FD_s::urlType.

Referenced by rpmioSlurp().

int fdWritable | ( | FD_t | fd,
|  | int | secs |
| ) |  |  |

Definition at line 559 of file rpmio.c.

References _rpmio_debug, errno, fdFileno, and _FD_s::req.

Referenced by checkResponse(), ftpLogin(), httpReq(), and ufdWrite().

ssize_t fdWrite | ( | void * | cookie,
|  | const char * | buf,
|  | size_t | count |
| ) |  |  |

int Ferror | ( | FD_t | fd | ) |

ferror(3) clone.

Definition at line 3575 of file rpmio.c.

References DBGIO, _FD_s::errcookie, fdbg(), fdFileno, fdGetFILE, fpio, _FD_s::fps, _FDSTACK_s::io, _FD_s::nfps, _FD_s::req, and _FD_s::syserrno.

Referenced by addFileToTagAux(), cpio_copy(), dodigest(), doIcon(), fsmStage(), IDTXglob(), isCompressed(), makeGPGSignature(), makeHDRSignature(), manageFile(), processPackageFiles(), rdLead(), readFile(), readLineFromOFI(), rpmcliSign(), rpmdsCpuinfo(), rpmdsSysinfoFile(), rpmfd_Fopen(), rpmfd_init(), rpmgiOpen(), rpmInstallSource(), rpmioSlurp(), rpmLoadMacroFile(), rpmpsmStage(), rpmShowProgress(), rpmTempFile(), rpmtsSolve(), rpmWriteHeader(), runScript(), unsatisfiedDepend(), urlGetFile(), and writeRPM().

int Fflush | ( | FD_t | fd | ) |

fflush(3) clone.

Definition at line 3553 of file rpmio.c.

References fdGetFILE, fdGetFp(), fdGetIo(), and fpio.

Referenced by copyFile(), cpio_doio(), extractRegular(), rpmpsmStage(), and writeRPM().

int Fileno | ( | FD_t | fd | ) |

fileno(3) clone.

Definition at line 3617 of file rpmio.c.

References DBGIO, fdbg(), _FDSTACK_s::fdno, _FD_s::fps, _FD_s::nfps, and _FD_s::req.

Referenced by cpio_doio(), extractRegular(), Fcntl(), Fdopen(), fdSize(), printSize(), rpmpsmStage(), rpmReadPackageFile(), rpmTempFile(), rpmtsCallback(), runScript(), ufdOpen(), writeFile(), and writeRPM().

FD_t Fopen | ( | const char * | path,
|  | const char * | fmode |
| ) |  |  |

fopen(3) clone.

Definition at line 3484 of file rpmio.c.

References _rpmio_debug, cvtfmode(), fdClose, fdFileno, fdGetFdno(), fdGetFp(), Fdopen(), fdOpen, fdPush(), fpio, _FD_s::req, ufdOpen(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlIsURL().

Referenced by addFileToTagAux(), dodigest(), doIcon(), fsmStage(), IDTXglob(), isCompressed(), makeGPGSignature(), makeHDRSignature(), manageFile(), processPackageFiles(), readLineFromOFI(), rpmcliSign(), rpmdbExportInfo(), rpmdsCpuinfo(), rpmdsSysinfoFile(), rpmfd_Fopen(), rpmfd_init(), rpmgiOpen(), rpmHeaderFromFile(), rpmInstallSource(), rpmioSlurp(), rpmLoadMacroFile(), rpmpsmStage(), rpmShowProgress(), rpmTempFile(), rpmtsRollback(), rpmtsSolve(), runScript(), unsatisfiedDepend(), urlGetFile(), and writeRPM().

size_t Fread | ( | void * | buf,
|  | size_t | size,
|  | size_t | nmemb,
|  | FD_t | fd |
| ) |  |  |

fread(3) clone.

Definition at line 3122 of file rpmio.c.

References DBGIO, fdbg(), fdGetFILE, fdGetIo(), FDIOVEC, FDSANE, fpio, and FDIO_s::read.

Referenced by copyFile(), cpio_copy(), dodigest(), doIcon(), fsmStage(), isCompressed(), makeGPGSignature(), readFile(), rpmioSlurp(), rpmReadPackageFile(), ufdCopy(), unsatisfiedDepend(), and writeRPM().

int Fseek | ( | FD_t | fd,
|  | _libio_off_t | offset,
|  | int | whence |
| ) |  |  |

fseek(3) clone.

Definition at line 3167 of file rpmio.c.

References DBGIO, fdbg(), fdGetFILE, fdGetIo(), FDIOVEC, FDSANE, fpio, and FDIO_s::seek.

const char* Fstrerror | ( | FD_t | fd | ) |

strerror(3) clone.

Definition at line 3111 of file rpmio.c.

References errno, FDSANE, and getFdErrstr().

Referenced by copyFile(), cpio_copy(), doIcon(), IDTXglob(), isCompressed(), manageFile(), processPackageFiles(), rdLead(), readFile(), readLineFromOFI(), rpmcliSign(), rpmfd_Fopen(), rpmfd_init(), rpmgiOpen(), rpmInstallSource(), rpmpsmStage(), rpmReadPackageFile(), rpmReSign(), rpmShowProgress(), rpmtsSolve(), rpmWriteHeader(), urlGetFile(), and writeRPM().

const char* ftpStrerror | ( | int | errorNumber | ) |

Definition at line 732 of file rpmio.c.

References _, FTPERR_BAD_HOST_ADDR, FTPERR_BAD_HOSTNAME, FTPERR_BAD_SERVER_RESPONSE, FTPERR_FAILED_CONNECT, FTPERR_FAILED_DATA_CONNECT, FTPERR_FILE_IO_ERROR, FTPERR_FILE_NOT_FOUND, FTPERR_NE_AUTH, FTPERR_NE_CONNECT, FTPERR_NE_ERROR, FTPERR_NE_FAILED, FTPERR_NE_LOOKUP, FTPERR_NE_PROXYAUTH, FTPERR_NE_REDIRECT, FTPERR_NE_RETRY, FTPERR_NE_TIMEOUT, FTPERR_NIC_ABORT_IN_PROGRESS, FTPERR_PASSIVE_ERROR, FTPERR_SERVER_IO_ERROR, FTPERR_SERVER_TIMEOUT, and FTPERR_UNKNOWN.

Referenced by ftpLogin(), ftpReq(), httpReq(), prepFetch(), tcpConnect(), ufdCopy(), and urlStrerror().

size_t Fwrite | ( | const void * | buf,
|  | size_t | size,
|  | size_t | nmemb,
|  | FD_t | fd |
| ) |  |  |

fwrite(3) clone.

Definition at line 3144 of file rpmio.c.

References DBGIO, fdbg(), fdGetFILE, fdGetIo(), FDIOVEC, FDSANE, fpio, and FDIO_s::write.

Referenced by copyFile(), cpio_copy(), fsmStage(), rpmWriteHeader(), runScript(), ufdCopy(), writeRPM(), wrLead(), and wrSignature().

int Glob | ( | const char * | pattern,
|  | int | flags,
|  | int | errfuncconst char *epath, int eerrno,
|  | glob_t * | pglob |
| ) |  |  |

glob(3) clone.

Definition at line 1732 of file rpmrpc.c.

References _rpmio_debug, Closedir(), getenv(), Lstat(), Opendir(), Readdir(), Stat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by rpmGlob().

int Glob_error | ( | const char * | epath,
|  | int | eerrno |
| ) |  |  |

glob_error(3) clone.

Definition at line 1727 of file rpmrpc.c.

Referenced by rpmGlob().

int Glob_pattern_p | ( | const char * | pattern,
|  | int | quote |
| ) |  |  |

glob_pattern_p(3) clone.

Definition at line 1687 of file rpmrpc.c.

References URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, and urlPath().

Referenced by processBinaryFile(), and rpmGlob().

void Globfree | ( | glob_t * | pglob | ) |

globfree(3) clone.

Definition at line 1775 of file rpmrpc.c.

References _rpmio_debug.

Referenced by rpmGlob().

int Lchown | ( | const char * | path,
|  | uid_t | owner,
|  | gid_t | group |
| ) |  |  |

lchown(2) clone.

Todo:
  Implement remotely.

Definition at line 1432 of file rpmrpc.c.

References _rpmio_debug, errno, lchown, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int Link | ( | const char * | oldpath,
|  | const char * | newpath |
| ) |  |  |

link(2) clone.

Definition at line 305 of file rpmrpc.c.

References _rpmio_debug, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xstrncasecmp().

Referenced by fsmStage().

off_t Lseek | ( | int | fdno,
|  | off_t | offset,
|  | int | whence |
| ) |  |  |

lseek(2) clone.

Todo:
  Implement SEEK_HOLE/SEEK_DATA.

Definition at line 1845 of file rpmrpc.c.

References _rpmio_debug.

int Lstat | ( | const char * | path,
|  | struct stat * | st |
| ) |  |  |

lstat(2) clone.

Definition at line 1374 of file rpmrpc.c.

References _rpmio_debug, errno, ftpLstat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by addFile(), checkOwners(), fsmStage(), Fts_open(), Glob(), prepFetch(), rpmfiDecideFate(), rpmQueryVerify(), rpmtsRun(), and rpmVerifyFile().

int Mkdir | ( | const char * | path,
|  | mode_t | mode |
| ) |  |  |

mkdir(2) clone.

Definition at line 69 of file rpmrpc.c.

References ftpMkdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), packageBinaries(), rpmdbRebuild(), rpmioMkpath(), and rpmMkdirPath().

int Mkfifo | ( | const char * | path,
|  | mode_t | mode |
| ) |  |  |

mkfifo(3) clone.

Todo:
  Implement remotely.

Definition at line 1484 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int Mknod | ( | const char * | path,
|  | mode_t | mode,
|  | dev_t | dev |
| ) |  |  |

mknod(3) clone.

Todo:
  Implement remotely.

Definition at line 1510 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int Open | ( | const char * | path,
|  | int | flags,
|  | mode_t | mode |
| ) |  |  |

open(2) clone.

Todo:
  Implement remotely.

Definition at line 200 of file rpmrpc.c.

References _chroot_prefix, _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by db_init().

DIR* Opendir | ( | const char * | path | ) |

opendir(3) clone.

Definition at line 1782 of file rpmrpc.c.

References _rpmio_debug, ftpOpendir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by Fts_open(), and Glob().

struct dirent* Readdir | ( | DIR * | dir | ) | `[read]`

readdir(3) clone.

Definition at line 1815 of file rpmrpc.c.

References _rpmio_debug.

Referenced by Fts_open(), and Glob().

int Readlink | ( | const char * | path,
|  | char * | buf,
|  | size_t | bufsiz |
| ) |  |  |

readlink(2) clone.

Todo:
  Implement remotely.

Definition at line 1622 of file rpmrpc.c.

References errno, ftpReadlink(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), genCpioListAndHeader(), and rpmVerifyFile().

int Rename | ( | const char * | oldpath,
|  | const char * | newpath |
| ) |  |  |

rename(2) clone.

Definition at line 250 of file rpmrpc.c.

References _rpmio_debug, ftpRename(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and xstrncasecmp().

Referenced by fsmStage(), rpmdbMoveDatabase(), and rpmReSign().

int Rmdir | ( | const char * | path | ) |

rmdir(2) clone.

Definition at line 131 of file rpmrpc.c.

References ftpRmdir(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by buildSpec(), fsmStage(), rpmdbRebuild(), and rpmdbRemoveDatabase().

int rpmioAccess | ( | const char * | FN,
|  | const char * | path,
|  | int | mode |
| ) |  |  |

Check FN access, expanding relative paths and twiddles.

Parameters:

  | FN | file path to check
  | path | colon separated search path (NULL uses $PATH)
  | mode | type of access(2) to check (0 uses X_OK)

Returns:
  0 if accessible

Definition at line 3698 of file rpmio.c.

References _rpmio_debug, Access(), alloca_strdup, F_OK, getenv(), R_OK, rpmCleanPath(), stpcpy(), W_OK, and X_OK.

Referenced by rpmtsCreate(), and unsatisfiedDepend().

void rpmioClean | ( | void |  | ) |

Free all memory allocated by rpmio usage.

Definition at line 3886 of file rpmio.c.

References rpmlogClose(), and urlFreeCache().

Referenced by rpmcliFini().

int rpmioMkpath | ( | const char * | path,
|  | mode_t | mode,
|  | uid_t | uid,
|  | gid_t | gid |
| ) |  |  |

Insure that directories in path exist, creating as needed.

Parameters:

  | path | directory path
  | mode | directory mode (if created)
  | uid | directory uid (if created), or -1 to skip
  | gid | directory uid (if created), or -1 to skip

Returns:
  0 on success, errno (or -1) on error

Definition at line 3643 of file rpmio.c.

References alloca(), Chown(), D_, errno, Mkdir(), rpmlog(), RPMLOG_DEBUG, Stat(), and stpcpy().

Referenced by db3open(), rpmTempFile(), and sql_open().

int Stat | ( | const char * | path,
|  | struct stat * | st |
| ) |  |  |

stat(2) clone.

Definition at line 1342 of file rpmrpc.c.

References _rpmio_debug, errno, ftpStat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by db3open(), fsmStage(), Fts_open(), Glob(), main(), makeGPGSignature(), packageBinaries(), processSourceFiles(), rpmAddSignature(), rpmdbMoveDatabase(), rpmdsSysinfo(), rpmioFileExists(), rpmioMkpath(), and rpmMkdirPath().

int Symlink | ( | const char * | oldpath,
|  | const char * | newpath |
| ) |  |  |

symlink(3) clone.

Todo:
  Implement remotely.

Definition at line 1592 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage().

int ufdCopy | ( | FD_t | sfd,
|  | FD_t | tfd |
| ) |  |  |

Definition at line 1520 of file rpmio.c.

References DBGIO, Fread(), FTPERR_FILE_IO_ERROR, ftpStrerror(), Fwrite(), RPMCALLBACK_INST_OPEN_FILE, and RPMCALLBACK_INST_PROGRESS.

Referenced by ufdGetFile().

int ufdGetFile | ( | FD_t | sfd,
|  | FD_t | tfd |
| ) |  |  |

Definition at line 1623 of file rpmio.c.

References Fclose(), FDSANE, and ufdCopy().

Referenced by urlGetFile().

void* ufdGetUrlinfo | ( | FD_t | fd | ) |

Definition at line 1889 of file rpmio.c.

References FDSANE, _FD_s::url, and urlLink.

int Unlink | ( | const char * | path | ) |

unlink(2) clone.

Definition at line 353 of file rpmrpc.c.

References ftpUnlink(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by buildSpec(), db3open(), doRmSource(), fsmStage(), makeGPGSignature(), makeHDRSignature(), rpmdbExportInfo(), rpmdbMoveDatabase(), rpmdbRemoveDatabase(), rpmReSign(), rpmtsRollback(), runScript(), sql_close(), urlGetFile(), and writeRPM().

const char* urlStrerror | ( | const char * | url | ) |

Definition at line 787 of file rpmio.c.

References _, errno, ftpStrerror(), urlinfo_s::openError, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, urlIsURL(), and urlSplit().

int Utime | ( | const char * | path,
|  | const struct utimbuf * | buf |
| ) |  |  |

Definition at line 1538 of file rpmrpc.c.

References _rpmio_debug, errno, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by fsmStage(), rpmdbExportInfo(), and rpmdbMoveDatabase().

int Utimes | ( | const char * | path,
|  | const struct timeval * | times |
| ) |  |  |

utimes(2) clone.

Todo:
  Implement remotely.

static int xisalnum | ( | int | c | ) | `[inline, static]`

Definition at line 812 of file rpmio.h.

References xisalpha(), and xisdigit().

Referenced by _tagCanonicalize(), expandMacro(), parseRCPOT(), rdToken(), rpmdsPipe(), rpmdsSysinfoFile(), and xispunct().

static int xisalpha | ( | int | c | ) | `[inline, static]`

Definition at line 806 of file rpmio.h.

References xislower(), and xisupper().

Referenced by doDefine(), doUndefine(), dpkgEVRctype(), parseBits(), rdToken(), xisalnum(), and xisrpmalpha().

static int xisascii | ( | int | c | ) | `[inline, static]`

Definition at line 824 of file rpmio.h.

Referenced by xisgraph(), and xisprint().

static int xisblank | ( | int | c | ) | `[inline, static]`

Definition at line 815 of file rpmio.h.

Referenced by xisspace().

static int xiscntrl | ( | int | c | ) | `[inline, static]`

Definition at line 821 of file rpmio.h.

static int xisdigit | ( | int | c | ) | `[inline, static]`

Definition at line 809 of file rpmio.h.

Referenced by doFoo(), dpkgEVRcmp(), dpkgEVRctype(), expandMacro(), getHostAddress(), parseForDev(), parseFormat(), rdToken(), rpmds_ParseEVR(), rpmEVRcmp(), rpmEVRparse(), rpmnsClassify(), rpmtsInitIterator(), unsatisfiedDepend(), and xisalnum().

static int xisgraph | ( | int | c | ) | `[inline, static]`

Definition at line 830 of file rpmio.h.

References xisascii().

Referenced by xispunct().

static int xislower | ( | int | c | ) | `[inline, static]`

Definition at line 800 of file rpmio.h.

Referenced by xisalpha(), and xtoupper().

static int xisprint | ( | int | c | ) | `[inline, static]`

Definition at line 827 of file rpmio.h.

References xisascii().

static int xispunct | ( | int | c | ) | `[inline, static]`

Definition at line 833 of file rpmio.h.

References xisalnum(), and xisgraph().

Referenced by xisrpmalpha().

static int xisspace | ( | int | c | ) | `[inline, static]`

Definition at line 818 of file rpmio.h.

References xisblank().

Referenced by addChangelog(), copyNextLineFinish(), dbiTagsInit(), doFoo(), findPreambleTag(), isPart(), parseBits(), rdToken(), readLine(), rpmcliAllArgCallback(), rpmPlatform(), and stripTrailingBlanksStringBuf().

static int xisupper | ( | int | c | ) | `[inline, static]`

Definition at line 803 of file rpmio.h.

Referenced by xisalpha(), and xtolower().

static int xtolower | ( | int | c | ) | `[inline, static]`

Definition at line 837 of file rpmio.h.

References xisupper().

Referenced by _tagCanonicalize(), myTagName(), rpmRebuildTargetVars(), xstrcasecmp(), and xstrncasecmp().

static int xtoupper | ( | int | c | ) | `[inline, static]`

Definition at line 840 of file rpmio.h.

References xislower().

Referenced by _tagCanonicalize().

## Variable Documentation

const char* _chroot_prefix

Definition at line 161 of file rpmrpc.c.

Referenced by Chroot(), and Open().

FDIO_t bzdio

Referenced by fdbg().

FDIO_t fadio

FDIO_t fdio

Definition at line 557 of file rpmio.c.

Referenced by fdbg(), and XurlFree().

FDIO_t fpio

Definition at line 3907 of file rpmio.c.

Referenced by Fclose(), fdbg(), Fdopen(), Ferror(), Fflush(), Fopen(), Fread(), Fseek(), Fwrite(), and XurlFree().

char*(* Getpass)(const char *prompt)

Return a password.

Parameters:

  | prompt | prompt string

Returns:
  password

Referenced by main(), and urlFind().

FDIO_t gzdio

Referenced by fdbg().

FDIO_t lzdio

Definition at line 3079 of file rpmio.c.

Referenced by fdbg(), lzdFileno(), lzdReadOpen(), and lzdWriteOpen().

FDIO_t ufdio

Definition at line 2305 of file rpmio.c.

Referenced by fdbg(), ftpAbort(), ftpOpen(), ufdOpen(), urlConnect(), and XfdNew().