summaryrefslogtreecommitdiff
path: root/src/sys-wait.h
blob: 435762c278f7d3488440f71d2a33f419e8c6f733 (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
28
29
30
31
32
33
34
35
36
/*
 * sys-wait.h - sys/wait.h wrapper
 *
 * Copyright(c) 2021 Glenn Strauss gstrauss()gluelogic.com  All rights reserved
 * License: BSD 3-clause (same as lighttpd)
 */
#ifndef INCLUDED_SYS_WAIT_H
#define INCLUDED_SYS_WAIT_H
#include "first.h"

#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif

#ifdef _WIN32

#ifndef WEXITSTATUS
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
#endif

#ifndef WIFEXITED
#define WIFEXITED(status)   (((status) & 0x7f) == 0)
#endif

#ifndef WIFSIGNALED
#define WIFSIGNALED(status) \
  (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
#endif

#ifndef WTERMSIG
#define WTERMSIG(status)    ((status) & 0x7f)
#endif

#endif /* _WIN32 */

#endif