11 #include <sys/signal.h>
12 #include <search.h> /* XXX insque(3)/remque(3) protos. */
14 typedef struct rpmsig_s * rpmsig;
16 typedef struct rpmsqElem * rpmsq;
20 extern int _rpmsq_debug;
24 * SIGCHLD queue element.
27 struct rpmsqElem * q_forw; /*!< for use by insque(3)/remque(3). */
28 struct rpmsqElem * q_back;
29 pid_t child; /*!< Currently running child. */
30 volatile pid_t reaped; /*!< Reaped waitpid(3) return. */
31 volatile int status; /*!< Reaped waitpid(3) status. */
32 int reaper; /*!< Register SIGCHLD handler? */
33 void * id; /*!< Blocking thread id (pthread_t). */
34 pthread_mutex_t mutex;
39 extern rpmsq rpmsqQueue;
42 extern sigset_t rpmsqCaught;
50 int rpmsqInsert(/*@null@*/ void * elem, /*@null@*/ void * prev)
51 /*@globals rpmsqQueue @*/
52 /*@modifies elem, rpmsqQueue @*/;
56 int rpmsqRemove(/*@null@*/ void * elem)
61 void rpmsqHandler(int signum)
62 /*@globals rpmsqCaught, fileSystem @*/
63 /*@modifies rpmsqCaught, fileSystem @*/;
66 * Enable or disable a signal handler.
67 * @param signum signal to enable (or disable if negative)
68 * @param handler signal handler (or NULL to use rpmsqHandler())
69 * @return no. of refs, -1 on error
71 int rpmsqEnable(int signum, /*@null@*/ sighandler_t handler)
72 /*@globals rpmsqCaught, fileSystem, internalState @*/
73 /*@modifies rpmsqCaught, fileSystem, internalState @*/;
76 * Fork a child process.
77 * @param sq scriptlet queue element
80 pid_t rpmsqFork(rpmsq sq)
81 /*@globals fileSystem, internalState @*/
82 /*@modifies sq, fileSystem, internalState @*/;
85 * Wait for child process to be reaped.
86 * @param sq scriptlet queue element
87 * @return reaped child pid
89 pid_t rpmsqWait(rpmsq sq)
90 /*@globals fileSystem, internalState @*/
91 /*@modifies sq, fileSystem, internalState @*/;
94 * Execute a command, returning its status.
96 int rpmsqExecve (const char ** argv)