Blame lib/sys_wait.in.h

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