summaryrefslogtreecommitdiff
path: root/src/wait.c
blob: 0888df2c5d318df040eba7fcf8d8a4bbda1c6437 (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
  @source 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;
}