1/* wait.h -- POSIX macros for evaluating exit statuses
2   Copyright (C) 1990 Free Software Foundation, Inc.
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2, or (at your option)
7   any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.  */
13
14#ifdef HAVE_SYS_WAIT_H
15#include <sys/types.h>		/* For pid_t. */
16#ifdef HAVE_SYS_RESOURCE_H
17#include <sys/resource.h>	/* for rusage */
18#endif
19#include <sys/wait.h>
20#endif
21#ifndef WIFSTOPPED
22#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
23#endif
24#ifndef WIFSIGNALED
25#define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
26#endif
27#ifndef WIFEXITED
28#define WIFEXITED(w) (((w) & 0xff) == 0)
29#endif
30#ifndef WCOREDUMP	/* not POSIX, but common and useful */
31#define WCOREDUMP(w) (((w) & 0x80) != 0)
32#endif
33
34#ifndef WSTOPSIG
35#define WSTOPSIG(w) (((w) >> 8) & 0xff)
36#endif
37#ifndef WTERMSIG
38#define WTERMSIG(w) ((w) & 0x7f)
39#endif
40#ifndef WEXITSTATUS
41#define WEXITSTATUS(w) (((w) >> 8) & 0xff)
42#endif
43