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