rpm
5.4.10
|
#include "system.h"
#include <signal.h>
#include <sys/signal.h>
#include <sys/wait.h>
#include <search.h>
#include <rpmsq.h>
#include "debug.h"
Go to the source code of this file.
Data Structures | |
struct | rpmsig_s |
Macros | |
#define | DO_LOCK() (0) |
#define | DO_UNLOCK() (0) |
#define | INIT_LOCK() |
#define | ADD_REF(__tbl) /*@-noeffect@*/ (0) /*@=noeffect@*/ |
#define | SUB_REF(__tbl) /*@-noeffect@*/ (0) /*@=noeffect@*/ |
#define | CLEANUP_HANDLER(__handler, __arg, __oldtypeptr) |
#define | CLEANUP_RESET(__execute, __oldtype) |
#define | SAME_THREAD(_a, _b) (42) |
#define | ME() __pid2vp(getpid()) |
#define | _RPMSQ_INTERNAL |
#define | _RPMSQ_DEBUG 0 |
#define | rpmsigTbl_sigint (&rpmsigTbl[0]) |
#define | rpmsigTbl_sigquit (&rpmsigTbl[1]) |
#define | rpmsigTbl_sigchld (&rpmsigTbl[2]) |
#define | rpmsigTbl_sighup (&rpmsigTbl[3]) /* XXX unused */ |
#define | rpmsigTbl_sigterm (&rpmsigTbl[4]) /* XXX unused */ |
#define | rpmsigTbl_sigpipe (&rpmsigTbl[5]) /* XXX unused */ |
Functions | |
static void * | __pid2vp (pid_t pid) |
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... | |
static int | rpmsqWaitUnregister (rpmsq sq) |
Wait for child process to be reaped, and unregister SIGCHLD handler. 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) |
SIGCHLD cancellation handler. More... | |
Variables | |
int | _rpmsq_debug = 0 |
static struct rpmsqElem | rpmsqRock = { &rpmsqRock, NULL } |
rpmsq | rpmsqQueue = &rpmsqRock |
sigset_t | rpmsqCaught |
static struct rpmsig_s | rpmsigTbl [] |
#define ADD_REF | ( | __tbl | ) | /*@-noeffect@*/ (0) /*@=noeffect@*/ |
Definition at line 251 of file rpmsq.c.
Referenced by rpmsqEnable(), and rpmsqExecve().
#define CLEANUP_HANDLER | ( | __handler, | |
__arg, | |||
__oldtypeptr | |||
) |
Definition at line 253 of file rpmsq.c.
Referenced by rpmsqExecve().
#define CLEANUP_RESET | ( | __execute, | |
__oldtype | |||
) |
Definition at line 254 of file rpmsq.c.
Referenced by rpmsqExecve().
#define DO_LOCK | ( | ) | (0) |
Definition at line 248 of file rpmsq.c.
Referenced by rpmsqEnable(), rpmsqExecve(), and rpmsqThreadEqual().
#define DO_UNLOCK | ( | ) | (0) |
Definition at line 249 of file rpmsq.c.
Referenced by rpmsqEnable(), rpmsqExecve(), and rpmsqThreadEqual().
#define INIT_LOCK | ( | ) |
Definition at line 250 of file rpmsq.c.
Referenced by rpmsqExecve().
#define ME | ( | ) | __pid2vp(getpid()) |
Definition at line 259 of file rpmsq.c.
Referenced by rpmsqEnable(), rpmsqFork(), rpmsqInsert(), rpmsqRemove(), rpmsqWait(), and rpmsqWaitUnregister().
#define rpmsigTbl_sigchld (&rpmsigTbl[2]) |
Referenced by rpmsqExecve(), and rpmsqThreadEqual().
#define rpmsigTbl_sighup (&rpmsigTbl[3]) /* XXX unused */ |
#define rpmsigTbl_sigint (&rpmsigTbl[0]) |
Referenced by rpmsqExecve().
#define rpmsigTbl_sigpipe (&rpmsigTbl[5]) /* XXX unused */ |
#define rpmsigTbl_sigquit (&rpmsigTbl[1]) |
Referenced by rpmsqExecve().
#define rpmsigTbl_sigterm (&rpmsigTbl[4]) /* XXX unused */ |
#define SUB_REF | ( | __tbl | ) | /*@-noeffect@*/ (0) /*@=noeffect@*/ |
Definition at line 252 of file rpmsq.c.
Referenced by rpmsqEnable(), rpmsqExecve(), and rpmsqThreadEqual().
void rpmsqAction | ( | int | signum, |
void * | info, | ||
void * | context | ||
) |
Default signal handler.
signum | signal number |
info | (siginfo_t) signal info |
context | signal context |
Definition at line 390 of file rpmsq.c.
References errno, and rpmsig_s::signum.
Referenced by rpmsqEnable().
int rpmsqEnable | ( | int | signum, |
rpmsqAction_t | handler | ||
) |
Enable or disable a signal handler.
signum | signal to enable (or disable if negative) |
handler | sa_sigaction handler (or NULL to use rpmsqHandler()) |
Definition at line 439 of file rpmsq.c.
References ADD_REF, DO_LOCK, DO_UNLOCK, ME, rpmsqAction(), and SUB_REF.
Referenced by rpmdbClose(), rpmdbOpenDatabase(), rpmsqExecve(), rpmsqFork(), rpmsqThreadEqual(), and rpmsqWaitUnregister().
int rpmsqExecve | ( | const char ** | argv | ) |
SIGCHLD cancellation handler.
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, rpmsigTbl_sigchld, rpmsigTbl_sigint, rpmsigTbl_sigquit, rpmsqEnable(), and SUB_REF.
pid_t rpmsqFork | ( | rpmsq | sq | ) |
Fork a child process.
sq | scriptlet queue element |
Definition at line 495 of file rpmsq.c.
References ME, rpmsqEnable(), and rpmsqInsert().
Referenced by runScript().
int rpmsqInsert | ( | void * | elem, |
void * | prev | ||
) |
Insert node into from queue.
elem | node to link |
prev | previous node from queue |
Definition at line 291 of file rpmsq.c.
References ME.
Referenced by rpmsqFork().
int rpmsqJoin | ( | void * | thread | ) |
Wait for thread to terminate.
thread | thread |
Definition at line 671 of file rpmsq.c.
Referenced by fsmNext(), iosmNext(), and rpmpsmNext().
int rpmsqRemove | ( | void * | elem | ) |
Remove node from queue.
elem | node to link |
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.
start | function |
arg | function argument |
Definition at line 656 of file rpmsq.c.
Referenced by fsmNext(), iosmNext(), and rpmpsmNext().
int rpmsqThreadEqual | ( | void * | thread | ) |
Compare thread with current thread.
thread | thread |
Definition at line 684 of file rpmsq.c.
References DO_LOCK, DO_UNLOCK, errno, rpmsigTbl_sigchld, rpmsqEnable(), and SUB_REF.
pid_t rpmsqWait | ( | rpmsq | sq | ) |
Wait for child process to be reaped.
sq | scriptlet queue element |
Definition at line 624 of file rpmsq.c.
References ME, and rpmsqWaitUnregister().
Referenced by psmWait().
|
static |
Wait for child process to be reaped, and unregister SIGCHLD handler.
sq | scriptlet queue element |
Definition at line 557 of file rpmsq.c.
References ME, rpmsqEnable(), rpmsqRemove(), rpmswEnter(), and rpmswExit().
Referenced by rpmsqWait().
|
static |
sigset_t rpmsqCaught |
Definition at line 352 of file rpmsq.c.
Referenced by rpmdbCheckSignals(), rpmdbCheckTerminate(), and signalsCaught().