1
/* -*- buffer-read-only: t -*- vi: set ro: */
2
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
/* A POSIX-like <sys/wait.h>.
4
Copyright (C) 2001-2003, 2005-2011 Free Software Foundation, Inc.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 3, or (at your option)
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software Foundation,
18
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21
#ifndef _@GUARD_PREFIX@_SYS_WAIT_H
24
@PRAGMA_SYSTEM_HEADER@
28
/* The include_next requires a split double-inclusion guard. */
29
#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
30
# @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@
33
#ifndef _@GUARD_PREFIX@_SYS_WAIT_H
34
#define _@GUARD_PREFIX@_SYS_WAIT_H
37
#include <sys/types.h>
40
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
42
/* The definition of _GL_WARN_ON_USE is copied here. */
45
#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
48
/* The following macros apply to an argument x, that is a status of a process,
49
as returned by waitpid().
50
On nearly all systems, including Linux/x86, WEXITSTATUS are bits 15..8 and
51
WTERMSIG are bits 7..0, while BeOS uses the opposite. Therefore programs
52
have to use the abstract macros. */
54
/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
57
# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f)
60
# define WIFEXITED(x) (WTERMSIG (x) == 0)
63
# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f)
66
/* The termination signal. Only to be accessed if WIFSIGNALED(x) is true. */
68
# define WTERMSIG(x) ((x) & 0x7f)
71
/* The exit status. Only to be accessed if WIFEXITED(x) is true. */
73
# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
76
/* The stopping signal. Only to be accessed if WIFSTOPPED(x) is true. */
78
# define WSTOPSIG(x) (((x) >> 8) & 0x7f)
81
/* True if the process dumped core. Not standardized by POSIX. */
83
# define WCOREDUMP(x) ((x) & 0x80)
87
/* Native Windows API. */
89
# include <signal.h> /* for SIGTERM */
91
/* The following macros apply to an argument x, that is a status of a process,
92
as returned by waitpid() or, equivalently, _cwait() or GetExitCodeProcess().
93
This value is simply an 'int', not composed of bit fields. */
95
/* When an unhandled fatal signal terminates a process, the exit code is 3. */
96
# define WIFSIGNALED(x) ((x) == 3)
97
# define WIFEXITED(x) ((x) != 3)
98
# define WIFSTOPPED(x) 0
100
/* The signal that terminated a process is not known posthum. */
101
# define WTERMSIG(x) SIGTERM
103
# define WEXITSTATUS(x) (x)
105
/* There are no stopping signals. */
106
# define WSTOPSIG(x) 0
108
/* There are no core dumps. */
109
# define WCOREDUMP(x) 0
114
/* Declarations of functions. */
117
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
118
_GL_FUNCDECL_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
120
_GL_CXXALIAS_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
121
_GL_CXXALIASWARN (waitpid);
122
#elif defined GNULIB_POSIXCHECK
124
# if HAVE_RAW_DECL_WAITPID
125
_GL_WARN_ON_USE (waitpid, "waitpid is unportable - "
126
"use gnulib module sys_wait for portability");
131
#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
132
#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */