rpm  5.4.14
Data Structures | Typedefs | Functions | Variables
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <rpmiotypes.h>
#include <rpmzlog.h>
Include dependency graph for rpmio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  FDIO_s
 

Typedefs

typedef struct _FD_sFD_t
 
typedef struct FDIO_sFDIO_t
 
typedef off_t _libio_off_t
 Hide libio API lossage. More...
 
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_fopen_function_t )(const char *path, const char *fmode)
 
typedef FD_t(* fdio_fdopen_function_t )(void *cookie, const char *fmode)
 
typedef int(* fdio_flush_function_t )(void *cookie)
 

Functions

void rpmioClean (void)
 Free all memory allocated by rpmio usage. More...
 
rpmioPool rpmioFreePool (rpmioPool pool)
 Reclaim memory pool items. More...
 
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. More...
 
rpmioItem rpmioUnlinkPoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
 Decrement a pool item refcount. More...
 
rpmioItem rpmioLinkPoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
 Increment a pool item refcount. More...
 
voidrpmioFreePoolItem (rpmioItem item, const char *msg, const char *fn, unsigned ln)
 Free a pool item. More...
 
rpmioItem rpmioGetPool (rpmioPool pool, size_t size)
 Get unused item from pool, or alloc a new item. More...
 
rpmioItem rpmioPutPool (rpmioItem item)
 Put unused item into pool (or free). More...
 
RPMIO Interface.
const char * Fstrerror (FD_t fd)
 strerror(3) clone. More...
 
size_t Fread (void *buf, size_t size, size_t nmemb, FD_t fd)
 fread(3) clone. More...
 
size_t Fwrite (const void *buf, size_t size, size_t nmemb, FD_t fd)
 fwrite(3) clone. More...
 
int Fseek (FD_t fd, _libio_off_t offset, int whence)
 fseek(3) clone. More...
 
long Ftell (FD_t fd)
 
void Rewind (FD_t fd)
 
int Fgetpos (FD_t fd, fpos_t *pos)
 
int Fsetpos (FD_t fd, fpos_t *pos)
 
int Fclose (FD_t fd)
 fclose(3) clone. More...
 
FD_t Fdopen (FD_t ofd, const char *fmode)
 
FD_t Fopen (const char *path, const char *fmode)
 fopen(3) clone. More...
 
int Fflush (FD_t fd)
 fflush(3) clone. More...
 
int Ferror (FD_t fd)
 ferror(3) clone. More...
 
int Fileno (FD_t fd)
 fileno(3) clone. More...
 
int Fcntl (FD_t fd, int op, void *lip)
 fcntl(2) clone. More...
 

Variables

int _rpmio_debug
 
rpmioPool _fdPool
 

RPMRPC Interface.

const char * _chroot_prefix
 
int Mkdir (const char *path, mode_t mode)
 mkdir(2) clone. More...
 
int Chdir (const char *path)
 chdir(2) clone. More...
 
int Rmdir (const char *path)
 rmdir(2) clone. More...
 
int Chroot (const char *path)
 chroot(2) clone. More...
 
int Open (const char *path, int flags, mode_t mode)
 open(2) clone. More...
 
int Rename (const char *oldpath, const char *newpath)
 rename(2) clone. More...
 
int Link (const char *oldpath, const char *newpath)
 link(2) clone. More...
 
int Unlink (const char *path)
 unlink(2) clone. More...
 
int Stat (const char *path, struct stat *st)
 stat(2) clone. More...
 
int Lstat (const char *path, struct stat *st)
 lstat(2) clone. More...
 
int Fstat (FD_t fd, struct stat *st)
 fstat(2) clone. More...
 
int Fadvise (FD_t fd, off_t offset, off_t length, int advice)
 posix_fadvise(2) clone. More...
 
int Fallocate (FD_t fd, off_t offset, off_t length)
 posix_fallocate(3)/fallocate(2) clone. More...
 
int Chown (const char *path, uid_t owner, gid_t group)
 chown(2) clone. More...
 
int Fchown (FD_t fd, uid_t owner, gid_t group)
 fchown(2) clone. More...
 
int Lchown (const char *path, uid_t owner, gid_t group)
 lchown(2) clone. More...
 
int Chmod (const char *path, mode_t mode)
 chmod(2) clone. More...
 
int Lchmod (const char *path, mode_t mode)
 lchmod(2) clone. More...
 
int Fchmod (FD_t fd, mode_t mode)
 fchmod(2) clone. More...
 
int Chflags (const char *path, unsigned int flags)
 chflags(2) clone. More...
 
int Lchflags (const char *path, unsigned int flags)
 lchflags(2) clone. More...
 
int Fchflags (FD_t fd, unsigned int flags)
 fchflags(2) clone. More...
 
int Mkfifo (const char *path, mode_t mode)
 mkfifo(3) clone. More...
 
int Mknod (const char *path, mode_t mode, dev_t dev)
 mknod(3) clone. More...
 
int Utime (const char *path, const struct utimbuf *buf)
 
int Utimes (const char *path, const struct timeval *times)
 utimes(2) clone. More...
 
int Lutimes (const char *path, const struct timeval *times)
 lutimes(2) clone. More...
 
int Symlink (const char *oldpath, const char *newpath)
 symlink(3) clone. More...
 
int Readlink (const char *path, char *buf, size_t bufsiz)
 readlink(2) clone. More...
 
int Access (const char *path, int amode)
 access(2) clone. More...
 
int Glob_pattern_p (const char *pattern, int quote)
 glob_pattern_p(3) clone. More...
 
int Glob_error (const char *epath, int eerrno)
 glob_error(3) clone. More...
 
int Glob (const char *pattern, int flags, int errfunc(const char *epath, int eerrno), void *_pglob)
 glob(3) clone. More...
 
void Globfree (void *_pglob)
 globfree(3) clone. More...
 
char * Realpath (const char *path, char *resolved_path)
 realpath(3) clone. More...
 
off_t Lseek (int fdno, off_t offset, int whence)
 lseek(2) clone. More...
 

RPMIO Utilities.

#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 fdOpen(_path, _flags, _mode)   fdio->_open((_path), (_flags), (_mode))
 
#define fdLink(_fd, _msg)   ((FD_t)rpmioLinkPoolItem((rpmioItem)(_fd), _msg, __FILE__, __LINE__))
 
#define fdFree(_fd, _msg)   ((FD_t)rpmioFreePoolItem((rpmioItem)(_fd), _msg, __FILE__, __LINE__))
 
#define fdNew(_msg)   XfdNew(_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. More...
 
char *(* Getpass )(const char *prompt)
 Return a password. More...
 
FDIO_t fdio
 
FDIO_t fpio
 
FDIO_t ufdio
 
FDIO_t gzdio
 
FDIO_t bzdio
 
FDIO_t lzdio
 
FDIO_t xzdio
 
FD_t fdDup (int fdno)
 
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 fdOpen (const char *path, int flags, mode_t mode)
 
FD_t fdLink (void *cookie, const char *msg)
 
FD_t fdFree (FD_t fd, const char *msg)
 
FD_t fdNew (const char *msg)
 
FD_t XfdNew (const char *msg, const char *fn, unsigned ln)
 
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. More...
 
int rpmioAccess (const char *FN, const char *path, int mode)
 Check FN access, expanding relative paths and twiddles. More...
 
char * _GetPass (const char *prompt)
 
char * _RequestPass (const char *prompt)
 
const char * ftpStrerror (int errorNumber)
 
voidufdGetUrlinfo (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)
 

Macro Definition Documentation

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

Definition at line 565 of file rpmio.h.

#define fdFree (   _fd,
  _msg 
)    ((FD_t)rpmioFreePoolItem((rpmioItem)(_fd), _msg, __FILE__, __LINE__))

Definition at line 590 of file rpmio.h.

#define fdLink (   _fd,
  _msg 
)    ((FD_t)rpmioLinkPoolItem((rpmioItem)(_fd), _msg, __FILE__, __LINE__))

Definition at line 581 of file rpmio.h.

#define fdNew (   _msg)    XfdNew(_msg, __FILE__, __LINE__)

Definition at line 604 of file rpmio.h.

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

Definition at line 572 of file rpmio.h.

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

Definition at line 551 of file rpmio.h.

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

Definition at line 558 of file rpmio.h.

Typedef Documentation

typedef int(* fdio_close_function_t)(void *cookie)

Definition at line 80 of file rpmio.h.

typedef FD_t(* fdio_fdopen_function_t)(void *cookie, const char *fmode)

Definition at line 92 of file rpmio.h.

typedef int(* fdio_flush_function_t)(void *cookie)

Definition at line 98 of file rpmio.h.

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

Definition at line 86 of file rpmio.h.

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

Definition at line 60 of file rpmio.h.

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

Definition at line 74 of file rpmio.h.

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

Definition at line 68 of file rpmio.h.

typedef enum ftperrCode_e ftperrCode

FTP and HTTP error codes.

Enumeration Type Documentation

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 658 of file rpmio.h.

Function Documentation

char* _GetPass ( const char *  prompt)

Definition at line 85 of file rpmku.c.

References _free(), _kuKeyring, assert(), memset(), NULL, rpmExpand(), and void.

char* _RequestPass ( const char *  prompt)

Definition at line 119 of file rpmku.c.

References argvFree(), argvSplit(), assert(), av, key, NULL, and xx.

int Access ( const char *  path,
int  amode 
)
int Chdir ( const char *  path)
int Chflags ( const char *  path,
unsigned int  flags 
)

chflags(2) clone.

Todo:
Implement remotely.

Definition at line 1861 of file rpmrpc.c.

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

int Chmod ( const char *  path,
mode_t  mode 
)

chmod(2) clone.

Todo:
Implement remotely.

Definition at line 1765 of file rpmrpc.c.

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

Referenced by iosmStage().

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

chown(2) clone.

Todo:
Implement remotely.

Definition at line 1674 of file rpmrpc.c.

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

Referenced by createDir(), iosmStage(), and rpmioMkpath().

int Chroot ( const char *  path)
int Fadvise ( FD_t  fd,
off_t  offset,
off_t  length,
int  advice 
)

posix_fadvise(2) clone.

Definition at line 1495 of file rpmrpc.c.

References _, _rpmio_debug, fdGetOPath(), fdno, Fileno(), fprintf(), NULL, path, rc, rpmlog(), RPMLOG_DEBUG, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by iosmStage(), rpmgiOpen(), and rpmShowProgress().

int Fallocate ( FD_t  fd,
off_t  offset,
off_t  length 
)

posix_fallocate(3)/fallocate(2) clone.

Definition at line 1548 of file rpmrpc.c.

References _, _rpmio_debug, fdGetOPath(), fdno, Fileno(), fprintf(), int, NULL, offset, path, rc, rpmlog(), RPMLOG_DEBUG, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Fchflags ( FD_t  fd,
unsigned int  flags 
)

fchflags(2) clone.

Todo:
Implement remotely.

Definition at line 1927 of file rpmrpc.c.

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

int Fchmod ( FD_t  fd,
mode_t  mode 
)

fchmod(2) clone.

Todo:
Implement remotely.

Definition at line 1830 of file rpmrpc.c.

References _rpmio_debug, errno, exit, fdGetOPath(), Fileno(), fprintf(), rc, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Fchown ( FD_t  fd,
uid_t  owner,
gid_t  group 
)

fchown(2) clone.

Todo:
Implement remotely.

Definition at line 1704 of file rpmrpc.c.

References _rpmio_debug, errno, exit, fdGetOPath(), Fileno(), fprintf(), rc, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

int Fclose ( FD_t  fd)
int Fcntl ( FD_t  fd,
int  op,
void lip 
)

fcntl(2) clone.

Definition at line 3007 of file rpmio.c.

References Fileno().

Referenced by rpmShowProgress().

int fdClose ( void cookie)
FD_t fdDup ( int  fdno)
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 ( FD_t  ofd,
const char *  fmode 
)
FD_t fdOpen ( const char *  path,
int  flags,
mode_t  mode 
)
ssize_t fdRead ( void cookie,
char *  buf,
size_t  count 
)
int fdReadable ( FD_t  fd,
int  secs 
)

Definition at line 633 of file rpmio.c.

References errno, fdFileno(), fdno, NULL, rc, and _FD_s::req.

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

int fdWritable ( FD_t  fd,
int  secs 
)

Definition at line 578 of file rpmio.c.

References _rpmio_debug, errno, fdFileno(), fdno, fprintf(), NULL, rc, 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)
int Fflush ( FD_t  fd)

fflush(3) clone.

Definition at line 2914 of file rpmio.c.

References FDIO_s::_flush, bzdio, fdGetFILE, fdGetFp(), fdGetIo(), fpio, gzdio, lzdio, NULL, and xzdio.

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

int Fgetpos ( FD_t  fd,
fpos_t *  pos 
)

Definition at line 2504 of file rpmio.c.

References DBGIO, errno, fdbg(), fdGetFILE, fdGetIo(), FDSANE, fpio, and rc.

int Fileno ( FD_t  fd)
FD_t Fopen ( const char *  path,
const char *  fmode 
)
size_t Fread ( void buf,
size_t  size,
size_t  nmemb,
FD_t  fd 
)
int Fseek ( FD_t  fd,
_libio_off_t  offset,
int  whence 
)

fseek(3) clone.

Definition at line 2455 of file rpmio.c.

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

int Fsetpos ( FD_t  fd,
fpos_t *  pos 
)

Definition at line 2518 of file rpmio.c.

References DBGIO, errno, fdbg(), fdGetFILE, fdGetIo(), FDSANE, fpio, and rc.

int Fstat ( FD_t  fd,
struct stat *  st 
)
const char* Fstrerror ( FD_t  fd)
long Ftell ( FD_t  fd)

Definition at line 2481 of file rpmio.c.

References DBGIO, errno, fdbg(), fdGetFILE, fdGetIo(), FDSANE, fpio, and rc.

const char* ftpStrerror ( int  errorNumber)
size_t Fwrite ( const void buf,
size_t  size,
size_t  nmemb,
FD_t  fd 
)
int Glob ( const char *  pattern,
int  flags,
int   errfuncconst char *epath, int eerrno,
void _pglob 
)
int Glob_error ( const char *  epath,
int  eerrno 
)

glob_error(3) clone.

Definition at line 2271 of file rpmrpc.c.

Referenced by rpmGlob().

int Glob_pattern_p ( const char *  pattern,
int  quote 
)
void Globfree ( void _pglob)

globfree(3) clone.

Definition at line 2322 of file rpmrpc.c.

References _rpmio_debug, fprintf(), and globfree().

Referenced by rpmGlob().

int Lchflags ( const char *  path,
unsigned int  flags 
)

lchflags(2) clone.

Todo:
Implement remotely.

Definition at line 1893 of file rpmrpc.c.

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

int Lchmod ( const char *  path,
mode_t  mode 
)

lchmod(2) clone.

Todo:
Implement remotely.

Definition at line 1795 of file rpmrpc.c.

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

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

lchown(2) clone.

Todo:
Implement remotely.

Definition at line 1735 of file rpmrpc.c.

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

Referenced by iosmStage().

int Link ( const char *  oldpath,
const char *  newpath 
)
off_t Lseek ( int  fdno,
off_t  offset,
int  whence 
)

lseek(2) clone.

Todo:
Implement SEEK_HOLE/SEEK_DATA.

Definition at line 2417 of file rpmrpc.c.

References _rpmio_debug, and fprintf().

int Lstat ( const char *  path,
struct stat *  st 
)
int Lutimes ( const char *  path,
const struct timeval *  times 
)

lutimes(2) clone.

Todo:
Implement remotely.
int Mkdir ( const char *  path,
mode_t  mode 
)
int Mkfifo ( const char *  path,
mode_t  mode 
)

mkfifo(3) clone.

Todo:
Implement remotely.

Definition at line 1959 of file rpmrpc.c.

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

Referenced by iosmStage().

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

mknod(3) clone.

Todo:
Implement remotely.

Definition at line 1989 of file rpmrpc.c.

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

Referenced by iosmStage().

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

open(2) clone.

Todo:
Implement remotely.

Definition at line 219 of file rpmrpc.c.

References _chroot_prefix, _free(), _rpmio_debug, errno, fdno, fn, fprintf(), nb, NULL, rpmExpand(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), and void.

Referenced by db_init().

int Readlink ( const char *  path,
char *  buf,
size_t  bufsiz 
)
char* Realpath ( const char *  path,
char *  resolved_path 
)
int Rename ( const char *  oldpath,
const char *  newpath 
)
void Rewind ( FD_t  fd)

Definition at line 2495 of file rpmio.c.

References DBGIO, fdbg(), fdGetFILE, fdGetIo(), FDSANE, and fpio.

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

Check FN access, expanding relative paths and twiddles.

Parameters
FNfile path to check
pathcolon separated search path (NULL uses $PATH)
modetype of access(2) to check (0 uses X_OK)
Returns
0 if accessible

Definition at line 3070 of file rpmio.c.

References _path, _rpmio_debug, Access(), alloca_strdup, exit, F_OK, fn, fprintf(), getenv(), negate, NULL, R_OK, rc, rpmCleanPath(), stpcpy(), strcmp(), t, te, W_OK, and X_OK.

Referenced by rpmtsPRCO(), and unsatisfiedDepend().

void rpmioClean ( void  )
rpmioPool rpmioFreePool ( rpmioPool  pool)

Reclaim memory pool items.

Parameters
poolmemory pool (NULL uses global rpmio pool)
Returns
NULL always

Definition at line 72 of file rpmmalloc.c.

References _free(), _rpmioPool, assert(), count, D_, rpmioPool_s::have, rpmioPool_s::head, if(), rpmioPool_s::made, rpmioPool_s::name, NULL, rpmioItem_s::pool, rpmioPool_s::reused, rpmlog(), RPMLOG_DEBUG, RPMLOG_WARNING, rpmioPool_s::size, rpmioItem_s::use, VALGRIND_DESTROY_MEMPOOL, VALGRIND_HG_CLEAN_MEMORY, and void.

Referenced by main(), and rpmioClean().

void* rpmioFreePoolItem ( rpmioItem  item,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Free a pool item.

Parameters
itempool item
msgdebugging msg (NULL disables debugging)
fnusually FILE
lnusually LINE
Returns
pool item (NULL on last dereference)

Definition at line 186 of file rpmmalloc.c.

References ANNOTATE_HAPPENS_AFTER, assert(), rpmioPool_s::dbg, rpmioPool_s::fini, rpmioPool_s::flags, fprintf(), L, rpmioPool_s::name, NULL, rpmioItem_s::pool, rpmioPutPool(), rpmioPool_s::size, rpmioItem_s::use, VALGRIND_HG_CLEAN_MEMORY, and VALGRIND_MEMPOOL_FREE.

Referenced by mireFreeAll(), rpmDigestFinal(), rpmDigestInit(), rpmmiInit(), and urlFini().

rpmioItem rpmioGetPool ( rpmioPool  pool,
size_t  size 
)
rpmioItem rpmioLinkPoolItem ( rpmioItem  item,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Increment a pool item refcount.

Parameters
itempool item
msgdebugging msg (NULL disables debugging)
fnusually FILE
lnusually LINE
Returns
pool item

Definition at line 165 of file rpmmalloc.c.

References ANNOTATE_HAPPENS_BEFORE, rpmioPool_s::dbg, rpmioPool_s::flags, fprintf(), rpmioPool_s::name, NULL, rpmioItem_s::pool, and rpmioItem_s::use.

Referenced by newPackage(), newSpec(), rpmDigestDup(), rpmDigestInit(), rpmmiInit(), XfdNew(), XrpmtsiInit(), and XurlNew().

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

Insure that directories in path exist, creating as needed.

Parameters
pathdirectory path
modedirectory mode (if created)
uiddirectory uid (if created), or -1 to skip
giddirectory uid (if created), or -1 to skip
Returns
0 on success, errno (or -1) on error

Definition at line 3015 of file rpmio.c.

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

Referenced by db3open(), db_init(), doSetupMacro(), packageBinaries(), packageSources(), rpmdbExportHR_MIB(), rpmdbExportL10N_SQL(), rpmrepoMkdir(), rpmTempFile(), sql_initDB(), and sql_open().

rpmioPool rpmioNewPool ( const char *  name,
size_t  size,
int  limit,
int  flags,
char *(*)(void *item)  dbg,
void(*)(void *item)  init,
void(*)(void *item)  fini 
)
rpmioItem rpmioPutPool ( rpmioItem  item)

Put unused item into pool (or free).

Parameters
_itemunused item
Returns
NULL always

Definition at line 264 of file rpmmalloc.c.

References _free(), rpmioPool_s::have, NULL, rpmioItem_s::pool, rpmioPool_s::tail, rpmioItem_s::use, and void.

Referenced by headerLoad(), rpmdbClose(), rpmdbNew(), and rpmioFreePoolItem().

rpmioItem rpmioUnlinkPoolItem ( rpmioItem  item,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Decrement a pool item refcount.

Parameters
itempool item
msgdebugging msg (NULL disables debugging)
fnusually FILE
lnusually LINE
Returns
pool item (NULL on last dereference)

Definition at line 143 of file rpmmalloc.c.

References ANNOTATE_HAPPENS_AFTER, rpmioPool_s::dbg, rpmioPool_s::flags, fprintf(), rpmioPool_s::name, NULL, rpmioItem_s::pool, and rpmioItem_s::use.

int Stat ( const char *  path,
struct stat *  st 
)
int Symlink ( const char *  oldpath,
const char *  newpath 
)

symlink(3) clone.

Todo:
Implement remotely.

Definition at line 2120 of file rpmrpc.c.

References _rpmio_debug, errno, exit, fprintf(), out, rc, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_MONGO, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by iosmStage().

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

Definition at line 1659 of file rpmio.c.

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

Referenced by urlGetFile().

void* ufdGetUrlinfo ( FD_t  fd)

Definition at line 1928 of file rpmio.c.

References FDSANE, NULL, _FD_s::u, and urlLink().

int Unlink ( const char *  path)
const char* urlStrerror ( const char *  url)
int Utime ( const char *  path,
const struct utimbuf *  buf 
)
int Utimes ( const char *  path,
const struct timeval *  times 
)

utimes(2) clone.

Todo:
Implement remotely.
FD_t XfdNew ( const char *  msg,
const char *  fn,
unsigned  ln 
)

Variable Documentation

const char* _chroot_prefix

Definition at line 174 of file rpmrpc.c.

Referenced by Chroot(), and Open().

rpmioPool _fdPool

Definition at line 335 of file rpmio.c.

Referenced by fdGetPool().

FDIO_t bzdio

Referenced by fdbg(), Fdopen(), Ferror(), Fflush(), and getFdErrstr().

FDIO_t fdio

Definition at line 576 of file rpmio.c.

Referenced by fdbg(), Fdopen(), and urlFini().

FDIO_t fpio
char*(* Getpass)(const char *prompt)

Return a password.

Parameters
promptprompt string
Returns
password

Definition at line 154 of file rpmku.c.

Referenced by main(), and urlFind().

FDIO_t gzdio

Referenced by fdbg(), Fdopen(), Ferror(), Fflush(), and getFdErrstr().

FDIO_t lzdio

Referenced by fdbg(), Fdopen(), Ferror(), Fflush(), and getFdErrstr().

FDIO_t ufdio

Definition at line 2360 of file rpmio.c.

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

FDIO_t xzdio

Referenced by fdbg(), Fdopen(), Ferror(), Fflush(), and getFdErrstr().