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