|
Packit Service |
a2ae7a |
/* A POSIX-like <sys/wait.h>.
|
|
Packit Service |
a2ae7a |
Copyright (C) 2001-2003, 2005-2019 Free Software Foundation, Inc.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
a2ae7a |
it under the terms of the GNU Lesser General Public License as published by
|
|
Packit Service |
a2ae7a |
the Free Software Foundation; either version 2.1, or (at your option)
|
|
Packit Service |
a2ae7a |
any later version.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
a2ae7a |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
a2ae7a |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
a2ae7a |
GNU Lesser General Public License for more details.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
a2ae7a |
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#ifndef _@GUARD_PREFIX@_SYS_WAIT_H
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#if __GNUC__ >= 3
|
|
Packit Service |
a2ae7a |
@PRAGMA_SYSTEM_HEADER@
|
|
Packit Service |
a2ae7a |
#endif
|
|
Packit Service |
a2ae7a |
@PRAGMA_COLUMNS@
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The include_next requires a split double-inclusion guard. */
|
|
Packit Service |
a2ae7a |
#if !(defined _WIN32 && ! defined __CYGWIN__)
|
|
Packit Service |
a2ae7a |
# @INCLUDE_NEXT@ @NEXT_SYS_WAIT_H@
|
|
Packit Service |
a2ae7a |
#endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#ifndef _@GUARD_PREFIX@_SYS_WAIT_H
|
|
Packit Service |
a2ae7a |
#define _@GUARD_PREFIX@_SYS_WAIT_H
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* Get pid_t. */
|
|
Packit Service |
a2ae7a |
#include <sys/types.h>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The definition of _GL_WARN_ON_USE is copied here. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#if !(defined _WIN32 && ! defined __CYGWIN__)
|
|
Packit Service |
a2ae7a |
/* Unix API. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The following macros apply to an argument x, that is a status of a process,
|
|
Packit Service |
a2ae7a |
as returned by waitpid().
|
|
Packit Service |
a2ae7a |
On nearly all systems, including Linux/x86, WEXITSTATUS are bits 15..8 and
|
|
Packit Service |
a2ae7a |
WTERMSIG are bits 7..0, while BeOS uses the opposite. Therefore programs
|
|
Packit Service |
a2ae7a |
have to use the abstract macros. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
|
|
Packit Service |
a2ae7a |
is true. */
|
|
Packit Service |
a2ae7a |
# ifndef WIFSIGNALED
|
|
Packit Service |
a2ae7a |
# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f)
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
# ifndef WIFEXITED
|
|
Packit Service |
a2ae7a |
# define WIFEXITED(x) (WTERMSIG (x) == 0)
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
# ifndef WIFSTOPPED
|
|
Packit Service |
a2ae7a |
# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f)
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The termination signal. Only to be accessed if WIFSIGNALED(x) is true. */
|
|
Packit Service |
a2ae7a |
# ifndef WTERMSIG
|
|
Packit Service |
a2ae7a |
# define WTERMSIG(x) ((x) & 0x7f)
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The exit status. Only to be accessed if WIFEXITED(x) is true. */
|
|
Packit Service |
a2ae7a |
# ifndef WEXITSTATUS
|
|
Packit Service |
a2ae7a |
# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The stopping signal. Only to be accessed if WIFSTOPPED(x) is true. */
|
|
Packit Service |
a2ae7a |
# ifndef WSTOPSIG
|
|
Packit Service |
a2ae7a |
# define WSTOPSIG(x) (((x) >> 8) & 0x7f)
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* True if the process dumped core. Not standardized by POSIX. */
|
|
Packit Service |
a2ae7a |
# ifndef WCOREDUMP
|
|
Packit Service |
a2ae7a |
# define WCOREDUMP(x) ((x) & 0x80)
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#else
|
|
Packit Service |
a2ae7a |
/* Native Windows API. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
# include <signal.h> /* for SIGTERM */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The following macros apply to an argument x, that is a status of a process,
|
|
Packit Service |
a2ae7a |
as returned by waitpid() or, equivalently, _cwait() or GetExitCodeProcess().
|
|
Packit Service |
a2ae7a |
This value is simply an 'int', not composed of bit fields. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* When an unhandled fatal signal terminates a process, the exit code is 3. */
|
|
Packit Service |
a2ae7a |
# define WIFSIGNALED(x) ((x) == 3)
|
|
Packit Service |
a2ae7a |
# define WIFEXITED(x) ((x) != 3)
|
|
Packit Service |
a2ae7a |
# define WIFSTOPPED(x) 0
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* The signal that terminated a process is not known posthum. */
|
|
Packit Service |
a2ae7a |
# define WTERMSIG(x) SIGTERM
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
# define WEXITSTATUS(x) (x)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* There are no stopping signals. */
|
|
Packit Service |
a2ae7a |
# define WSTOPSIG(x) 0
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* There are no core dumps. */
|
|
Packit Service |
a2ae7a |
# define WCOREDUMP(x) 0
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* Declarations of functions. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#if @GNULIB_WAITPID@
|
|
Packit Service |
a2ae7a |
# if defined _WIN32 && ! defined __CYGWIN__
|
|
Packit Service |
a2ae7a |
_GL_FUNCDECL_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
_GL_CXXALIAS_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
|
|
Packit Service |
a2ae7a |
_GL_CXXALIASWARN (waitpid);
|
|
Packit Service |
a2ae7a |
#elif defined GNULIB_POSIXCHECK
|
|
Packit Service |
a2ae7a |
# undef waitpid
|
|
Packit Service |
a2ae7a |
# if HAVE_RAW_DECL_WAITPID
|
|
Packit Service |
a2ae7a |
_GL_WARN_ON_USE (waitpid, "waitpid is unportable - "
|
|
Packit Service |
a2ae7a |
"use gnulib module sys_wait for portability");
|
|
Packit Service |
a2ae7a |
# endif
|
|
Packit Service |
a2ae7a |
#endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
|
|
Packit Service |
a2ae7a |
#endif /* _@GUARD_PREFIX@_SYS_WAIT_H */
|