Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

rpmio/rpmsq.h File Reference

More...

#include <rpmsw.h>

Go to the source code of this file.

Data Structures

struct  rpmsqElem
 SIGCHLD queue element. More...


Typedefs

typedef rpmsig_srpmsig
typedef rpmsqElemrpmsq
typedef void(* rpmsqAction_t )(int signum, void *info, void *context)
 Default signal handler prototype.


Functions

int rpmsqInsert (void *elem, void *prev)
 Insert node into from queue.

int rpmsqRemove (void *elem)
 Remove node from queue.

void rpmsqAction (int signum, void *info, void *context)
 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.


Variables

int _rpmsq_debug
rpmsq rpmsqQueue
sigset_t rpmsqCaught


Detailed Description

Definition in file rpmsq.h.


Typedef Documentation

typedef struct rpmsig_s* rpmsig
 

Definition at line 13 of file rpmsq.h.

typedef struct rpmsqElem* rpmsq
 

Definition at line 17 of file rpmsq.h.

typedef void(* rpmsqAction_t)(int signum, void * info, void * context)
 

Default signal handler prototype.

Parameters:
signum  signal number
info  (siginfo_t) signal info
context  signal context

Definition at line 25 of file rpmsq.h.

Referenced by rpmsqEnable().


Function Documentation

void rpmsqAction int    signum,
void *    info,
void *    context
 

Default signal handler.

Parameters:
signum  signal number
info  (siginfo_t) signal info
context  signal context

Definition at line 280 of file rpmsq.c.

References rpmsqElem::child, rpmsqElem::cond, errno, rpmsqElem::q_forw, rpmsqElem::reaped, rpmsigTbl, rpmsqCaught, rpmsqQueue, rpmsig_s::signum, and rpmsqElem::status.

Referenced by rpmsqEnable().

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

Definition at line 325 of file rpmsq.c.

References ADD_REF, DO_LOCK, DO_UNLOCK, rpmsqElem::id, ME, rpmsigTbl, rpmsqAction(), rpmsqAction_t, rpmsqCaught, rpmsqQueue, rpmsig_s::signum, and SUB_REF.

Referenced by openDatabase(), rpmdbClose(), rpmsqExecve(), rpmsqFork(), rpmsqWaitUnregister(), and sigchld_cancel().

int rpmsqExecve const char **    argv
 

Execute a command, returning its status.

Definition at line 588 of file rpmsq.c.

References ADD_REF, alloca(), argv, CLEANUP_HANDLER, CLEANUP_RESET, DO_LOCK, DO_UNLOCK, environ, errno, INIT_LOCK, rpmsqEnable(), sigchld_cancel(), and SUB_REF.

pid_t rpmsqFork rpmsq    sq
 

Fork a child process.

Parameters:
sq  scriptlet queue element
Returns:
fork(2) pid

Definition at line 372 of file rpmsq.c.

References rpmsqElem::child, ME, rpmsqElem::pipes, rpmsqElem::reaper, rpmsqEnable(), and rpmsqInsert().

Referenced by runScript().

int rpmsqInsert void *    elem,
void *    prev
 

Insert node into from queue.

Parameters:
elem  node to link
prev  previous node from queue
Returns:
0 on success

Definition at line 189 of file rpmsq.c.

References rpmsqElem::child, rpmsqElem::cond, rpmsqElem::id, ME, rpmsqElem::mutex, rpmsqElem::pipes, rpmsqElem::reaped, rpmsqElem::reaper, rpmsqQueue, and rpmsqElem::status.

Referenced by rpmsqFork().

int rpmsqJoin void *    thread
 

Wait for thread to terminate.

Parameters:
thread  thread
Returns:
0 on success

Definition at line 544 of file rpmsq.c.

int rpmsqRemove void *    elem
 

Remove node from queue.

Parameters:
elem  node to link
Returns:
0 on success

Definition at line 219 of file rpmsq.c.

References rpmsqElem::child, rpmsqElem::cond, rpmsqElem::id, ME, rpmsqElem::mutex, rpmsqElem::pipes, rpmsqElem::reaped, rpmsqElem::reaper, and rpmsqElem::status.

Referenced by rpmsqWaitUnregister().

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

Call a function in a thread.

Parameters:
start  function
arg  function argument
Returns:
thread pointer (NULL on error)

Definition at line 535 of file rpmsq.c.

int rpmsqThreadEqual void *    thread
 

Compare thread with current thread.

Parameters:
thread  thread
Returns:
0 if not equal

Definition at line 552 of file rpmsq.c.

pid_t rpmsqWait rpmsq    sq
 

Wait for child process to be reaped.

Parameters:
sq  scriptlet queue element
Returns:
reaped child pid

Definition at line 503 of file rpmsq.c.

References rpmsqElem::child, ME, rpmsqElem::reaped, rpmsqElem::reaper, rpmsqWaitUnregister(), and rpmsqElem::status.

Referenced by psmWait().


Variable Documentation

int _rpmsq_debug
 

Definition at line 30 of file rpmsq.h.

sigset_t rpmsqCaught
 

Definition at line 58 of file rpmsq.h.

Referenced by rpmsqAction(), and rpmsqEnable().

rpmsq rpmsqQueue
 

Definition at line 54 of file rpmsq.h.

Referenced by rpmsqAction(), rpmsqEnable(), and rpmsqInsert().


Generated on Wed May 12 21:10:00 2004 for rpm by doxygen1.2.18