#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 |
Defines | |
#define | DO_LOCK() |
#define | DO_UNLOCK() |
#define | INIT_LOCK() |
#define | ADD_REF(__tbl) /*@-noeffect@*/ (0) |
#define | SUB_REF(__tbl) /*@-noeffect@*/ (0) |
#define | CLEANUP_HANDLER(__handler, __arg, __oldtypeptr) |
#define | CLEANUP_RESET(__execute, __oldtype) |
#define | SAME_THREAD(_a, _b) (42) |
#define | ME() (((void *)getpid())) |
#define | _RPMSQ_DEBUG 0 |
#define | rpmsigTbl_sigint (&rpmsigTbl[0]) |
#define | rpmsigTbl_sigquit (&rpmsigTbl[1]) |
#define | rpmsigTbl_sigchld (&rpmsigTbl[2]) |
#define | rpmsigTbl_sighup (&rpmsigTbl[3]) |
#define | rpmsigTbl_sigterm (&rpmsigTbl[4]) |
#define | rpmsigTbl_sigpipe (&rpmsigTbl[5]) |
Functions | |
int | rpmsqInsert (void *elem, void *prev) |
Insert node into from queue. | |
int | rpmsqRemove (void *elem) |
Remove node from queue. | |
void | rpmsqAction (int signum, void *info, void *context) |
Default signal handler. | |
int | rpmsqEnable (int signum, rpmsqAction_t handler) |
Enable or disable a signal handler. | |
pid_t | rpmsqFork (rpmsq sq) |
Fork a child process. | |
static int | rpmsqWaitUnregister (rpmsq sq) |
Wait for child process to be reaped, and unregister SIGCHLD handler. | |
pid_t | rpmsqWait (rpmsq sq) |
Wait for child process to be reaped. | |
void * | rpmsqThread (void *(*start)(void *arg), void *arg) |
Call a function in a thread. | |
int | rpmsqJoin (void *thread) |
Wait for thread to terminate. | |
int | rpmsqThreadEqual (void *thread) |
Compare thread with current thread. | |
static void | sigchld_cancel (void *arg) |
SIGCHLD cancellation handler. | |
int | rpmsqExecve (const char **argv) |
Execute a command, returning its status. | |
Variables | |
int | _rpmsq_debug = 0 |
static struct rpmsqElem | rpmsqRock |
rpmsq | rpmsqQueue = &rpmsqRock |
sigset_t | rpmsqCaught |
static struct rpmsig_s | rpmsigTbl [] |
Definition in file rpmsq.c.
|
|
|
Definition at line 162 of file rpmsq.c. Referenced by rpmsqEnable(), and rpmsqExecve(). |
|
Definition at line 164 of file rpmsq.c. Referenced by rpmsqExecve(). |
|
Definition at line 165 of file rpmsq.c. Referenced by rpmsqExecve(). |
|
Definition at line 159 of file rpmsq.c. Referenced by rpmsqEnable(), rpmsqExecve(), and sigchld_cancel(). |
|
Definition at line 160 of file rpmsq.c. Referenced by rpmsqEnable(), rpmsqExecve(), and sigchld_cancel(). |
|
Definition at line 161 of file rpmsq.c. Referenced by rpmsqExecve(). |
|
Definition at line 169 of file rpmsq.c. Referenced by rpmsqEnable(), rpmsqFork(), rpmsqInsert(), rpmsqRemove(), rpmsqWait(), and rpmsqWaitUnregister(). |
|
Referenced by rpmsqExecve(), and sigchld_cancel(). |
|
|
|
Referenced by rpmsqExecve(). |
|
|
|
Referenced by rpmsqExecve(). |
|
|
|
|
|
Definition at line 163 of file rpmsq.c. Referenced by rpmsqEnable(), rpmsqExecve(), and sigchld_cancel(). |
|
Default signal handler.
Definition at line 280 of file rpmsq.c. References rpmsqElem::child, rpmsqElem::cond, errno, rpmsqElem::q_forw, rpmsqElem::reaped, rpmsigTbl, rpmsig_s::signum, and rpmsqElem::status. Referenced by rpmsqEnable(). |
|
Enable or disable a signal handler.
Definition at line 325 of file rpmsq.c. References ADD_REF, DO_LOCK, DO_UNLOCK, rpmsqElem::id, ME, rpmsigTbl, rpmsqAction(), rpmsig_s::signum, and SUB_REF. Referenced by openDatabase(), rpmdbClose(), rpmsqExecve(), rpmsqFork(), rpmsqWaitUnregister(), and sigchld_cancel(). |
|
Execute a command, returning its status.
Definition at line 588 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(), sigchld_cancel(), and SUB_REF. |
|
Fork a child process.
Definition at line 372 of file rpmsq.c. References rpmsqElem::child, ME, rpmsqElem::pipes, rpmsqElem::reaper, rpmsqEnable(), and rpmsqInsert(). Referenced by runScript(). |
|
Insert node into from queue.
Definition at line 189 of file rpmsq.c. References rpmsqElem::child, rpmsqElem::cond, rpmsqElem::id, ME, rpmsqElem::mutex, rpmsqElem::pipes, rpmsqElem::reaped, rpmsqElem::reaper, and rpmsqElem::status. Referenced by rpmsqFork(). |
|
Wait for thread to terminate.
Definition at line 544 of file rpmsq.c. Referenced by fsmNext(), and rpmpsmNext(). |
|
Remove node from queue.
Definition at line 219 of file rpmsq.c. References rpmsqElem::child, rpmsqElem::cond, rpmsqElem::id, ME, rpmsqElem::mutex, rpmsqElem::pipes, rpmsqElem::reaped, rpmsqElem::reaper, and rpmsqElem::status. Referenced by rpmsqWaitUnregister(). |
|
Call a function in a thread.
Definition at line 535 of file rpmsq.c. Referenced by fsmNext(), and rpmpsmNext(). |
|
Compare thread with current thread.
|
|
Wait for child process to be reaped.
Definition at line 503 of file rpmsq.c. References rpmsqElem::child, ME, rpmsqElem::reaped, rpmsqElem::reaper, rpmsqWaitUnregister(), and rpmsqElem::status. Referenced by psmWait(). |
|
Wait for child process to be reaped, and unregister SIGCHLD handler.
Definition at line 436 of file rpmsq.c. References rpmsqElem::child, rpmsqElem::cond, ME, rpmsqElem::ms_scriptlets, rpmsqElem::mutex, rpmsqElem::op, rpmsqElem::pipes, rpmsqElem::reaped, rpmsqElem::reaper, rpmsqEnable(), rpmsqRemove(), rpmswEnter(), and rpmswExit(). Referenced by rpmsqWait(). |
|
SIGCHLD cancellation handler.
Definition at line 563 of file rpmsq.c. References DO_LOCK, DO_UNLOCK, errno, rpmsigTbl_sigchld, rpmsqEnable(), and SUB_REF. Referenced by rpmsqExecve(). |
|
|
|
Referenced by rpmsqAction(), and rpmsqEnable(). |
|
Definition at line 254 of file rpmsq.c. Referenced by rpmdbCheckSignals(). |
|
|
|
|