Blame lib/sys_wait.in.h

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