Back to index

courier  0.68.2
Defines | Functions
waitlib.c File Reference
#include <signal.h>
#include <stdio.h>
#include "waitlib.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define HOLD_CHILDREN   sigblock(sigmask(SIGCHLD))
#define RELEASE_CHILDREN   sigsetmask(0)

Functions

void wait_block ()
void wait_clear (RETSIGTYPE(*func)(int))
void wait_restore ()
void wait_reap (void(*func)(pid_t, int), RETSIGTYPE(*handler)(int))
void wait_forchild (void(*reap)(pid_t, int), RETSIGTYPE(*func)(int))

Define Documentation

#define HOLD_CHILDREN   sigblock(sigmask(SIGCHLD))

Definition at line 33 of file waitlib.c.

#define RELEASE_CHILDREN   sigsetmask(0)

Definition at line 34 of file waitlib.c.


Function Documentation

void wait_block ( )

Definition at line 59 of file waitlib.c.

{
       signal(SIGCHLD, SIG_DFL);
}

Here is the caller graph for this function:

void wait_clear ( RETSIGTYPE(*)(int)  func)

Definition at line 64 of file waitlib.c.

{
       signal(SIGCHLD, func);
}

Here is the caller graph for this function:

void wait_forchild ( void(*)(pid_t, int)  reap,
RETSIGTYPE(*)(int)  func 
)

Definition at line 101 of file waitlib.c.

{
pid_t  p;
int    wait_stat;

       signal(SIGCHLD, SIG_DFL);
       p=wait(&wait_stat);
       signal(SIGCHLD, func);
       (*reap)(p, wait_stat);
}

Here is the caller graph for this function:

void wait_reap ( void(*)(pid_t, int)  func,
RETSIGTYPE(*)(int)  handler 
)

Definition at line 76 of file waitlib.c.

{
int    dummy;
pid_t  p;

#if    USE_WAIT3

       HOLD_CHILDREN;

       while ((p=wait3(&dummy, WNOHANG, 0)) > 0)
#else
       if ((p=wait(&dummy)) > 0)
#endif
       {
              (*func)(p, dummy);
       }

       signal(SIGCHLD, handler);

#if    USE_WAIT3
       RELEASE_CHILDREN;
#endif

}

Here is the caller graph for this function:

void wait_restore ( )

Definition at line 69 of file waitlib.c.

{
       signal(SIGCHLD, SIG_DFL);
}

Here is the caller graph for this function: