modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/i386-linux-gnu/bits/waitstatus.h (about)

     1  /* Definitions of status bits for `wait' et al.
     2     Copyright (C) 1992-2018 Free Software Foundation, Inc.
     3     This file is part of the GNU C Library.
     4  
     5     The GNU C Library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9  
    10     The GNU C Library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14  
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with the GNU C Library; if not, see
    17     <http://www.gnu.org/licenses/>.  */
    18  
    19  #if !defined _SYS_WAIT_H && !defined _STDLIB_H
    20  # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
    21  #endif
    22  
    23  /* Everything extant so far uses these same bits.  */
    24  
    25  /* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
    26  #define	__WEXITSTATUS(status)	(((status) & 0xff00) >> 8)
    27  
    28  /* If WIFSIGNALED(STATUS), the terminating signal.  */
    29  #define	__WTERMSIG(status)	((status) & 0x7f)
    30  
    31  /* If WIFSTOPPED(STATUS), the signal that stopped the child.  */
    32  #define	__WSTOPSIG(status)	__WEXITSTATUS(status)
    33  
    34  /* Nonzero if STATUS indicates normal termination.  */
    35  #define	__WIFEXITED(status)	(__WTERMSIG(status) == 0)
    36  
    37  /* Nonzero if STATUS indicates termination by a signal.  */
    38  #define __WIFSIGNALED(status) \
    39    (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
    40  
    41  /* Nonzero if STATUS indicates the child is stopped.  */
    42  #define	__WIFSTOPPED(status)	(((status) & 0xff) == 0x7f)
    43  
    44  /* Nonzero if STATUS indicates the child continued after a stop.  We only
    45     define this if <bits/waitflags.h> provides the WCONTINUED flag bit.  */
    46  #ifdef WCONTINUED
    47  # define __WIFCONTINUED(status)	((status) == __W_CONTINUED)
    48  #endif
    49  
    50  /* Nonzero if STATUS indicates the child dumped core.  */
    51  #define	__WCOREDUMP(status)	((status) & __WCOREFLAG)
    52  
    53  /* Macros for constructing status values.  */
    54  #define	__W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
    55  #define	__W_STOPCODE(sig)	((sig) << 8 | 0x7f)
    56  #define __W_CONTINUED		0xffff
    57  #define	__WCOREFLAG		0x80