summaryrefslogtreecommitdiff
path: root/src/wait.c
blob: 748dca3b6be31e7026589d155046f9858489663e (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
26
27
#include "wait.h"

#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;
}