summaryrefslogtreecommitdiff
path: root/src/wait.c
blob: 4043a4fc2d58f74c9e34c787874d769e1a626653 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <sys/types.h>
#include <sys/wait.h>
#include "logmsg.h"

/**
  * @file wait.c
  * @author djb
  * @ref qmail
  * @brief wait for forked processes
  */

int wait_nohang(int *wstat)
{
  return waitpid(-1,wstat,WNOHANG);
}

int wait_pid(int *wstat,int pid)
{
  int r;

  do
    r = waitpid(pid,wstat,0);
  while ((r == -1) && (errno == EINTR));
  return r;
}