Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


waitstatus.h
001: /* Definitions of status bits for `wait' et al.
002:    Copyright (C) 1992,1994,1996,1997,2000,2004 Free Software Foundation, Inc.
003:    This file is part of the GNU C Library.
004: 
005:    The GNU C Library is free software; you can redistribute it and/or
006:    modify it under the terms of the GNU Lesser General Public
007:    License as published by the Free Software Foundation; either
008:    version 2.1 of the License, or (at your option) any later version.
009: 
010:    The GNU C Library is distributed in the hope that it will be useful,
011:    but WITHOUT ANY WARRANTY; without even the implied warranty of
012:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:    Lesser General Public License for more details.
014: 
015:    You should have received a copy of the GNU Lesser General Public
016:    License along with the GNU C Library; if not, write to the Free
017:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
018:    02111-1307 USA.  */
019: 
020: #if !defined _SYS_WAIT_H && !defined _STDLIB_H
021: # error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
022: #endif
023: 
024: 
025: /* Everything extant so far uses these same bits.  */
026: 
027: 
028: /* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
029: #define __WEXITSTATUS(status)   (((status) & 0xff00) >> 8)
030: 
031: /* If WIFSIGNALED(STATUS), the terminating signal.  */
032: #define __WTERMSIG(status)      ((status) & 0x7f)
033: 
034: /* If WIFSTOPPED(STATUS), the signal that stopped the child.  */
035: #define __WSTOPSIG(status)      __WEXITSTATUS(status)
036: 
037: /* Nonzero if STATUS indicates normal termination.  */
038: #define __WIFEXITED(status)     (__WTERMSIG(status) == 0)
039: 
040: /* Nonzero if STATUS indicates termination by a signal.  */
041: #define __WIFSIGNALED(status) \
042:   (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
043: 
044: /* Nonzero if STATUS indicates the child is stopped.  */
045: #define __WIFSTOPPED(status)    (((status) & 0xff) == 0x7f)
046: 
047: /* Nonzero if STATUS indicates the child continued after a stop.  We only
048:    define this if <bits/waitflags.h> provides the WCONTINUED flag bit.  */
049: #ifdef WCONTINUED
050: # define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
051: #endif
052: 
053: /* Nonzero if STATUS indicates the child dumped core.  */
054: #define __WCOREDUMP(status)     ((status) & __WCOREFLAG)
055: 
056: /* Macros for constructing status values.  */
057: #define __W_EXITCODE(ret, sig)  ((ret) << 8 | (sig))
058: #define __W_STOPCODE(sig)       ((sig) << 8 | 0x7f)
059: #define __W_CONTINUED           0xffff
060: #define __WCOREFLAG             0x80
061: 
062: 
063: #ifdef  __USE_BSD
064: 
065: # include <endian.h>
066: 
067: union wait
068:   {
069:     int w_status;
070:     struct
071:       {
072: # if    __BYTE_ORDER == __LITTLE_ENDIAN
073:         unsigned int __w_termsig:7; /* Terminating signal.  */
074:         unsigned int __w_coredump:1; /* Set if dumped core.  */
075:         unsigned int __w_retcode:8; /* Return code if exited normally.  */
076:         unsigned int:16;
077: # endif                         /* Little endian.  */
078: # if    __BYTE_ORDER == __BIG_ENDIAN
079:         unsigned int:16;
080:         unsigned int __w_retcode:8;
081:         unsigned int __w_coredump:1;
082:         unsigned int __w_termsig:7;
083: # endif                         /* Big endian.  */
084:       } __wait_terminated;
085:     struct
086:       {
087: # if    __BYTE_ORDER == __LITTLE_ENDIAN
088:         unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
089:         unsigned int __w_stopsig:8; /* Stopping signal.  */
090:         unsigned int:16;
091: # endif                         /* Little endian.  */
092: # if    __BYTE_ORDER == __BIG_ENDIAN
093:         unsigned int:16;
094:         unsigned int __w_stopsig:8; /* Stopping signal.  */
095:         unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
096: # endif                         /* Big endian.  */
097:       } __wait_stopped;
098:   };
099: 
100: # define w_termsig      __wait_terminated.__w_termsig
101: # define w_coredump     __wait_terminated.__w_coredump
102: # define w_retcode      __wait_terminated.__w_retcode
103: # define w_stopsig      __wait_stopped.__w_stopsig
104: # define w_stopval      __wait_stopped.__w_stopval
105: 
106: #endif  /* Use BSD.  */
107: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/