rpm  4.8.1
rpmsq.h
Go to the documentation of this file.
1 #ifndef H_RPMSQ
2 #define H_RPMSQ
3 
9 #include <rpm/rpmsw.h>
10 #include <signal.h>
11 #if defined(_RPMSQ_INTERNAL)
12 #include <pthread.h>
13 #endif
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
21 typedef struct rpmsig_s * rpmsig;
22 
25 typedef struct rpmsqElem * rpmsq;
26 
33 #ifdef SA_SIGINFO
34 typedef void (*rpmsqAction_t) (int signum, void * info, void * context);
35 #else
36 typedef void (*rpmsqAction_t) (int signum);
37 #endif
38 
39 extern int _rpmsq_debug;
40 
41 /* XXX make this fully opaque? */
42 #if defined(_RPMSQ_INTERNAL)
43 
46 struct rpmsqElem {
47  struct rpmsqElem * q_forw;
48  struct rpmsqElem * q_back;
49  pid_t child;
50  volatile pid_t reaped;
51  volatile int status;
52  struct rpmop_s op;
53  rpmtime_t ms_scriptlets;
54  int reaper;
55  int pipes[2];
56  void * id;
57  pthread_mutex_t mutex;
58  pthread_cond_t cond;
59 };
60 #endif /* _RPMSQ_INTERNAL */
61 
68 int rpmsqIsCaught(int signum);
69 
76 #ifdef SA_SIGINFO
77 void rpmsqAction(int signum, void * info, void * context);
78 #else
79 void rpmsqAction(int signum);
80 #endif
81 
88 int rpmsqEnable(int signum, rpmsqAction_t handler);
89 
95 pid_t rpmsqFork(rpmsq sq);
96 
102 pid_t rpmsqWait(rpmsq sq);
103 
110 void * rpmsqThread(void * (*start) (void * arg), void * arg);
111 
117 int rpmsqJoin(void * thread);
118 
124 int rpmsqThreadEqual(void * thread);
125 
129 int rpmsqExecve (const char ** argv);
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* H_RPMSQ */
pid_t rpmsqFork(rpmsq sq)
Fork a child process.
struct rpmsqElem * rpmsq
Definition: rpmsq.h:25
int rpmsqJoin(void *thread)
Wait for thread to terminate.
pid_t rpmsqWait(rpmsq sq)
Wait for child process to be reaped.
int rpmsqThreadEqual(void *thread)
Compare thread with current thread.
void * rpmsqThread(void *(*start)(void *arg), void *arg)
Call a function in a thread.
Cumulative statistics for an operation.
Definition: rpmsw.h:40
void rpmsqAction(int signum)
Default signal handler.
void(* rpmsqAction_t)(int signum)
Default signal handler prototype.
Definition: rpmsq.h:36
int rpmsqEnable(int signum, rpmsqAction_t handler)
Enable or disable a signal handler.
int _rpmsq_debug
int rpmsqExecve(const char **argv)
Execute a command, returning its status.
struct rpmsig_s * rpmsig
Definition: rpmsq.h:21
unsigned long int rpmtime_t
Definition: rpmsw.h:17
int rpmsqIsCaught(int signum)
Test if given signal has been caught (while signals blocked).