17 * Default signal handler prototype.
18 * @param signum signal number
19 * @param info (siginfo_t) signal info
20 * @param context signal context
22 typedef void (*rpmsqAction_t) (int signum, siginfo_t * info, void * context);
25 * SIG_DFL, SIG_IGN and SIG_ERR counterparts
27 #define RPMSQ_DFL ((rpmsqAction_t)0)
28 #define RPMSQ_IGN ((rpmsqAction_t)1)
29 #define RPMSQ_ERR ((rpmsqAction_t)-1)
32 * Test if given signal has been caught (while signals blocked).
33 * Similar to sigismember() but operates on internal signal queue.
34 * @param signum signal to test for
35 * @return 1 if caught, 0 if not and -1 on error
37 int rpmsqIsCaught(int signum);
40 * Activate (or disable) the signal queue.
41 * @param state 1 to enable, 0 to disable
42 * @return 0 on success, negative on error
44 int rpmsqActivate(int state);
47 * Set or delete a signal handler for a signal.
48 * @param signum signal number
49 * @param handler signal handler or NULL to delete
50 * @return previous handler, RPMSQ_ERR on error
52 rpmsqAction_t rpmsqSetAction(int signum, rpmsqAction_t handler);
55 * Block or unblock (almost) all signals.
56 * The operation is "reference counted" so the calls can be nested,
57 * and signals are only unblocked when the reference count falls to zero.
58 * @param op SIG_BLOCK/SIG_UNBLOCK
59 * @return 0 on success, -1 on error
61 int rpmsqBlock(int op);
64 * Poll for caught signals, executing their handlers.
65 * @return no. active signals found
69 void rpmsqSetInterruptSafety(int on);