# Signal Queue API.

## Typedefs
typedef struct rpmsig_s * | rpmsig
typedef struct rpmsqElem * | rpmsq
typedef void(* | rpmsqAction_t )(int signum)
| Default signal handler prototype.
## Functions
int | rpmsqIsCaught (int signum)
| Test if given signal has been caught (while signals blocked).
void | rpmsqAction (int signum)
| 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.
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.
int | rpmsqExecve (const char **argv)
| Execute a command, returning its status.

## Typedef Documentation

typedef struct rpmsig_s* rpmsig

Definition at line 21 of file rpmsq.h.

typedef struct rpmsqElem* rpmsq

Definition at line 25 of file rpmsq.h.

typedef void(* rpmsqAction_t)(int signum)

Default signal handler prototype.

Parameters:

  | signum | signal number
  | info | (siginfo_t) signal info
  | context | signal context

Definition at line 36 of file rpmsq.h.

## Function Documentation

void rpmsqAction | ( | int | signum | ) |

Default signal handler.

Parameters:

  | signum | signal number
  | info | (siginfo_t) signal info
  | context | signal context

int rpmsqEnable | ( | int | signum,
|  | rpmsqAction_t | handler |
| ) |  |  |

Enable or disable a signal handler.

Parameters:

  | signum | signal to enable (or disable if negative)
  | handler | sa_sigaction handler (or NULL to use rpmsqHandler())

Returns:
  no. of refs, -1 on error

int rpmsqExecve | ( | const char ** | argv | ) |

Execute a command, returning its status.

pid_t rpmsqFork | ( | rpmsq | sq | ) |

Fork a child process.

Parameters:

  | sq | scriptlet queue element

Returns:
  fork(2) pid

int rpmsqIsCaught | ( | int | signum | ) |

Test if given signal has been caught (while signals blocked).

Similar to sigismember() but operates on internal signal queue.

Parameters:

  | signum | signal to test for

Returns:
  1 if caught, 0 if not and -1 on error

int rpmsqJoin | ( | void * | thread | ) |

Wait for thread to terminate.

Parameters:

  | thread | thread

Returns:
  0 on success

void* rpmsqThread | ( | void *(*)(void *arg) | start,
|  | void * | arg |
| ) |  |  |

Call a function in a thread.

Parameters:

  | start | function
  | arg | function argument

Returns:
  thread pointer (NULL on error)

int rpmsqThreadEqual | ( | void * | thread | ) |

Compare thread with current thread.

Parameters:

  | thread | thread

Returns:
  0 if not equal

pid_t rpmsqWait | ( | rpmsq | sq | ) |

Wait for child process to be reaped.

Parameters:

  | sq | scriptlet queue element

Returns:
  reaped child pid