rpm  5.4.15
Typedefs | Functions | Variables
rpmsq.h File Reference
#include <unistd.h>
#include <rpmsw.h>
Include dependency graph for rpmsq.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct rpmsig_srpmsig
 
typedef struct rpmsqElem * rpmsq
 
typedef void(* rpmsqAction_t )(int signum, void *info, void *context)
 Default signal handler prototype. More...
 

Functions

int rpmsqInsert (void *elem, void *prev)
 Insert node into from queue. More...
 
int rpmsqRemove (void *elem)
 Remove node from queue. More...
 
void rpmsqAction (int signum, void *info, void *context)
 Default signal handler. More...
 
int rpmsqEnable (int signum, rpmsqAction_t handler)
 Enable or disable a signal handler. More...
 
pid_t rpmsqFork (rpmsq sq)
 Fork a child process. More...
 
pid_t rpmsqWait (rpmsq sq)
 Wait for child process to be reaped. More...
 
void * rpmsqThread (void *(*start)(void *arg), void *arg)
 Call a function in a thread. More...
 
int rpmsqJoin (void *thread)
 Wait for thread to terminate. More...
 
int rpmsqThreadEqual (void *thread)
 Compare thread with current thread. More...
 
int rpmsqExecve (const char **argv)
 Execute a command, returning its status. More...
 

Variables

int _rpmsq_debug
 
rpmsq rpmsqQueue
 
sigset_t rpmsqCaught
 

Typedef Documentation

typedef struct rpmsig_s* rpmsig

Definition at line 14 of file rpmsq.h.

typedef struct rpmsqElem* rpmsq

Definition at line 18 of file rpmsq.h.

typedef void(* rpmsqAction_t)(int signum, void *info, void *context)

Default signal handler prototype.

Parameters
signumsignal number
info(siginfo_t) signal info
contextsignal context

Definition at line 26 of file rpmsq.h.

Function Documentation

void rpmsqAction ( int  signum,
void *  info,
void *  context 
)

Default signal handler.

Parameters
signumsignal number
info(siginfo_t) signal info
contextsignal context

Definition at line 390 of file rpmsq.c.

References errno, rpmsigTbl, and rpmsig_s::signum.

Referenced by rpmsqEnable().

int rpmsqEnable ( int  signum,
rpmsqAction_t  handler 
)

Enable or disable a signal handler.

Parameters
signumsignal to enable (or disable if negative)
handlersa_sigaction handler (or NULL to use rpmsqHandler())
Returns
no. of refs, -1 on error

Definition at line 439 of file rpmsq.c.

References ADD_REF, DO_LOCK, DO_UNLOCK, ME, rpmsigTbl, rpmsqAction(), rpmsig_s::signum, and SUB_REF.

Referenced by rpmdbClose(), rpmdbOpenDatabase(), rpmsqExecve(), rpmsqFork(), rpmsqWaitUnregister(), signals_fini(), and signals_init().

int rpmsqExecve ( const char **  argv)

Execute a command, returning its status.

Execute a command, returning its status.

Definition at line 728 of file rpmsq.c.

References ADD_REF, alloca(), CLEANUP_HANDLER, CLEANUP_RESET, DO_LOCK, DO_UNLOCK, environ, errno, INIT_LOCK, out, rpmsigTbl_sigchld, rpmsigTbl_sigint, rpmsigTbl_sigquit, rpmsqEnable(), and SUB_REF.

pid_t rpmsqFork ( rpmsq  sq)

Fork a child process.

Parameters
sqscriptlet queue element
Returns
fork(2) pid

Definition at line 495 of file rpmsq.c.

References ME, out, rpmsqEnable(), and rpmsqInsert().

Referenced by runScript().

int rpmsqInsert ( void *  elem,
void *  prev 
)

Insert node into from queue.

Parameters
elemnode to link
prevprevious node from queue
Returns
0 on success

Definition at line 291 of file rpmsq.c.

References ME.

Referenced by rpmsqFork().

int rpmsqJoin ( void *  thread)

Wait for thread to terminate.

Parameters
threadthread
Returns
0 on success

Definition at line 671 of file rpmsq.c.

References pthread_join, and pthread_t.

Referenced by fsmNext(), iosmNext(), and rpmpsmNext().

int rpmsqRemove ( void *  elem)

Remove node from queue.

Parameters
elemnode to link
Returns
0 on success

Definition at line 320 of file rpmsq.c.

References ME.

Referenced by rpmsqWaitUnregister().

void* rpmsqThread ( void *(*)(void *arg start,
void *  arg 
)

Call a function in a thread.

Parameters
startfunction
argfunction argument
Returns
thread pointer (NULL on error)

Definition at line 656 of file rpmsq.c.

References pthread_create, and pthread_t.

Referenced by fsmNext(), iosmNext(), and rpmpsmNext().

int rpmsqThreadEqual ( void *  thread)

Compare thread with current thread.

Parameters
threadthread
Returns
0 if not equal

Definition at line 684 of file rpmsq.c.

References pthread_equal, pthread_self, and pthread_t.

pid_t rpmsqWait ( rpmsq  sq)

Wait for child process to be reaped.

Parameters
sqscriptlet queue element
Returns
reaped child pid

Definition at line 624 of file rpmsq.c.

References ME, and rpmsqWaitUnregister().

Referenced by psmWait().

Variable Documentation

int _rpmsq_debug

Definition at line 278 of file rpmsq.c.

sigset_t rpmsqCaught

Definition at line 352 of file rpmsq.c.

rpmsq rpmsqQueue

Definition at line 288 of file rpmsq.c.