rpm
5.4.14
|
#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... | |
if ((0)==0) | |
if (sigprocmask(SIG_BLOCK,&newMask,&oldMask)< 0) | |
else | if (pid==(pid_t) 0) |
if (((0)==0 &&(rpmsqEnable(-SIGINT, NULL)< 0||rpmsqEnable(-SIGQUIT, NULL)< 0))||sigprocmask(SIG_SETMASK,&oldMask, NULL)!=0) | |
Variables | |
int | _rpmsq_debug = 0 |
static struct rpmsqElem | rpmsqRock = { &rpmsqRock, NULL } |
rpmsq | rpmsqQueue = &rpmsqRock |
sigset_t | rpmsqCaught |
static struct rpmsig_s | rpmsigTbl [] |
int | |
SIGCHLD cancellation handler. More... | |
pid_t | pid = 0 |
sigset_t | newMask |
sigset_t | oldMask |
rpmsq | sq = (rpmsq) memset(alloca(sizeof(*sq)), 0, sizeof(*sq)) |
int | xx = (0) |
else | |
status = -1 | |
goto | out |
out_restore_sigquit_and_sigint | __pad0__ |
out_restore_sigquit_and_sigint | NULL |
out_restore_sigint | __pad1__ |
out | __pad2__ |
Class: Rpmspec | |
pid_t | result = NULL |
#define ADD_REF | ( | __tbl | ) | /*@-noeffect@*/ (0) /*@=noeffect@*/ |
Definition at line 251 of file rpmsq.c.
Referenced by rpmsqEnable().
#define DO_LOCK | ( | ) | (0) |
Definition at line 248 of file rpmsq.c.
Referenced by if(), and rpmsqEnable().
#define DO_UNLOCK | ( | ) | (0) |
Definition at line 249 of file rpmsq.c.
Referenced by rpmsqEnable().
#define ME | ( | ) | __pid2vp(getpid()) |
Definition at line 259 of file rpmsq.c.
Referenced by rpmsqEnable(), rpmsqFork(), rpmsqInsert(), rpmsqRemove(), rpmsqWait(), and rpmsqWaitUnregister().
#define rpmsigTbl_sighup (&rpmsigTbl[3]) /* XXX unused */ |
#define rpmsigTbl_sigint (&rpmsigTbl[0]) |
#define rpmsigTbl_sigpipe (&rpmsigTbl[5]) /* XXX unused */ |
#define rpmsigTbl_sigquit (&rpmsigTbl[1]) |
#define rpmsigTbl_sigterm (&rpmsigTbl[4]) /* XXX unused */ |
#define SUB_REF | ( | __tbl | ) | /*@-noeffect@*/ (0) /*@=noeffect@*/ |
Definition at line 252 of file rpmsq.c.
Referenced by if(), and rpmsqEnable().
|
static |
if | ( | (0) | = = 0 | ) |
Definition at line 747 of file rpmsq.c.
References NULL, out, rpmsigTbl_sigchld, rpmsqEnable(), and SUB_REF.
if | ( | ) |
if | ( | ((0)==0 &&(rpmsqEnable(-SIGINT, NULL)< 0||rpmsqEnable(-SIGQUIT, NULL)< 0))||sigprocmask(SIG_SETMASK,&oldMask, NULL)! | = 0 | ) |
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, int, ME, NULL, ret, rpmsigTbl, rpmsqAction(), rpmsig_s::signum, SUB_REF, void, and xx.
Referenced by if(), rpmdbClose(), rpmdbOpenDatabase(), rpmsqFork(), and rpmsqWaitUnregister().
pid_t rpmsqFork | ( | rpmsq | sq | ) |
Fork a child process.
sq | scriptlet queue element |
Definition at line 495 of file rpmsq.c.
References fprintf(), int, ME, NULL, out, pid, rpmsqEnable(), rpmsqInsert(), and xx.
Referenced by runScript().
Wait for thread to terminate.
thread | thread |
Definition at line 671 of file rpmsq.c.
Referenced by fsmNext(), iosmNext(), and rpmpsmNext().
Call a function in a thread.
start | function |
arg | function argument |
Definition at line 656 of file rpmsq.c.
References NULL, ret, and void.
Referenced by fsmNext(), iosmNext(), and rpmpsmNext().
pid_t rpmsqWait | ( | rpmsq | sq | ) |
Wait for child process to be reaped, and unregister SIGCHLD handler.
sq | scriptlet queue element |
Definition at line 557 of file rpmsq.c.
References assert(), fprintf(), ME, NULL, ret, rpmsqEnable(), rpmsqRemove(), rpmswEnter(), rpmswExit(), void, and xx.
Referenced by rpmsqWait().
else |
int |
SIGCHLD cancellation handler.
Execute a command, returning its status.
void sigaddset & newMask |
Definition at line 738 of file rpmsq.c.
Referenced by blockSignals(), rpmdbCheckTerminate(), and signalsCaught().
sigset_t oldMask |
Definition at line 738 of file rpmsq.c.
Referenced by rpmdbCheckTerminate(), and signalsCaught().
goto out |
Definition at line 804 of file rpmsq.c.
Referenced by addChangelog(), if(), rpmsqFork(), runScript(), and Symlink().
pid = 0 |
Definition at line 736 of file rpmsq.c.
Referenced by __pid2vp(), dodigest(), makeGPGSignature(), open_dso(), rpmCheckPassPhrase(), rpmsqFork(), runScript(), and unsatisfiedDepend().
Definition at line 737 of file rpmsq.c.
Referenced by glob(), hdrSprintf(), if(), parseExpressionBoolean(), parseExpressionString(), rpmdsAnyMatchesDep(), rpmdsCompare(), rpmdsMatch(), rpmdsNVRMatchesDep(), rpmdsResult(), rpmdsSetResult(), rpmEVRoverlap(), rpmGenPath(), rpmrbLoadClasses(), rpmrbLoadFile(), rpmtsCallback(), rpmVerifySignatures(), urlGetFile(), while(), and xstrtolocale().
|
static |
Referenced by rpmsqAction(), and rpmsqEnable().
sigset_t rpmsqCaught |
Definition at line 352 of file rpmsq.c.
Referenced by rpmdbCheckSignals(), rpmdbCheckTerminate(), and signalsCaught().
Definition at line 739 of file rpmsq.c.
Referenced by rpmsqAction(), rpmsqInsert(), and rpmsqRemove().
return status = -1 |
Definition at line 792 of file rpmsq.c.
Referenced by dodigest(), doScript(), getOutputFrom(), glob(), main(), makeGPGSignature(), rpmCheckPassPhrase(), rpmsqAction(), rpmsqWait(), and xstrtolocale().