Dr Andrew Scott G7VAV

My photo
 
April 2024
Mo Tu We Th Fr Sa Su
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 7 8 9 10 11 12


wait.h
001: /* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009,2010,2011
002:    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: /*
021:  *      POSIX Standard: 3.2.1 Wait for Process Termination      <sys/wait.h>
022:  */
023: 
024: #ifndef _SYS_WAIT_H
025: #define _SYS_WAIT_H     1
026: 
027: #include <features.h>
028: 
029: __BEGIN_DECLS
030: 
031: #include <signal.h>
032: #include <sys/resource.h>
033: 
034: /* These macros could also be defined in <stdlib.h>.  */
035: #if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
036: /* This will define the `W*' macros for the flag
037:    bits to `waitpid', `wait3', and `wait4'.  */
038: # include <bits/waitflags.h>
039: 
040: # ifdef __USE_BSD
041: 
042: /* Lots of hair to allow traditional BSD use of `union wait'
043:    as well as POSIX.1 use of `int' for the status word.  */
044: 
045: #  if defined __GNUC__ && !defined __cplusplus
046: #   define __WAIT_INT(status) \
047:   (__extension__ (((union { __typeof(status) __in; int __i; }) \
048:                    { .__in = (status) }).__i))
049: #  else
050: #   define __WAIT_INT(status)   (*(__const int *) &(status))
051: #  endif
052: 
053: /* This is the type of the argument to `wait'.  The funky union
054:    causes redeclarations with either `int *' or `union wait *' to be
055:    allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
056:    the actual function definitions.  */
057: 
058: #  if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
059: #   define __WAIT_STATUS        void *
060: #   define __WAIT_STATUS_DEFN   void *
061: #  else
062: /* This works in GCC 2.6.1 and later.  */
063: typedef union
064:   {
065:     union wait *__uptr;
066:     int *__iptr;
067:   } __WAIT_STATUS __attribute__ ((__transparent_union__));
068: #   define __WAIT_STATUS_DEFN   int *
069: #  endif
070: 
071: # else /* Don't use BSD.  */
072: 
073: #  define __WAIT_INT(status)    (status)
074: #  define __WAIT_STATUS         int *
075: #  define __WAIT_STATUS_DEFN    int *
076: 
077: # endif /* Use BSD.  */
078: 
079: /* This will define all the `__W*' macros.  */
080: # include <bits/waitstatus.h>
081: 
082: # define WEXITSTATUS(status)    __WEXITSTATUS (__WAIT_INT (status))
083: # define WTERMSIG(status)       __WTERMSIG (__WAIT_INT (status))
084: # define WSTOPSIG(status)       __WSTOPSIG (__WAIT_INT (status))
085: # define WIFEXITED(status)      __WIFEXITED (__WAIT_INT (status))
086: # define WIFSIGNALED(status)    __WIFSIGNALED (__WAIT_INT (status))
087: # define WIFSTOPPED(status)     __WIFSTOPPED (__WAIT_INT (status))
088: # ifdef __WIFCONTINUED
089: #  define WIFCONTINUED(status)  __WIFCONTINUED (__WAIT_INT (status))
090: # endif
091: #endif  /* <stdlib.h> not included.  */
092: 
093: #ifdef  __USE_BSD
094: # define WCOREFLAG              __WCOREFLAG
095: # define WCOREDUMP(status)      __WCOREDUMP (__WAIT_INT (status))
096: # define W_EXITCODE(ret, sig)   __W_EXITCODE (ret, sig)
097: # define W_STOPCODE(sig)        __W_STOPCODE (sig)
098: #endif
099: 
100: /* The following values are used by the `waitid' function.  */
101: #if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
102: typedef enum
103: {
104:   P_ALL,                /* Wait for any child.  */
105:   P_PID,                /* Wait for specified process.  */
106:   P_PGID                /* Wait for members of process group.  */
107: } idtype_t;
108: #endif
109: 
110: 
111: /* Wait for a child to die.  When one does, put its status in *STAT_LOC
112:    and return its process ID.  For errors, return (pid_t) -1.
113: 
114:    This function is a cancellation point and therefore not marked with
115:    __THROW.  */
116: extern __pid_t wait (__WAIT_STATUS __stat_loc);
117: 
118: #ifdef  __USE_BSD
119: /* Special values for the PID argument to `waitpid' and `wait4'.  */
120: # define WAIT_ANY       (-1)    /* Any process.  */
121: # define WAIT_MYPGRP    0       /* Any process in my process group.  */
122: #endif
123: 
124: /* Wait for a child matching PID to die.
125:    If PID is greater than 0, match any process whose process ID is PID.
126:    If PID is (pid_t) -1, match any process.
127:    If PID is (pid_t) 0, match any process with the
128:    same process group as the current process.
129:    If PID is less than -1, match any process whose
130:    process group is the absolute value of PID.
131:    If the WNOHANG bit is set in OPTIONS, and that child
132:    is not already dead, return (pid_t) 0.  If successful,
133:    return PID and store the dead child's status in STAT_LOC.
134:    Return (pid_t) -1 for errors.  If the WUNTRACED bit is
135:    set in OPTIONS, return status for stopped children; otherwise don't.
136: 
137:    This function is a cancellation point and therefore not marked with
138:    __THROW.  */
139: extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
140: 
141: #if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
142: # define __need_siginfo_t
143: # include <bits/siginfo.h>
144: /* Wait for a childing matching IDTYPE and ID to change the status and
145:    place appropriate information in *INFOP.
146:    If IDTYPE is P_PID, match any process whose process ID is ID.
147:    If IDTYPE is P_PGID, match any process whose process group is ID.
148:    If IDTYPE is P_ALL, match any process.
149:    If the WNOHANG bit is set in OPTIONS, and that child
150:    is not already dead, clear *INFOP and return 0.  If successful, store
151:    exit code and status in *INFOP.
152: 
153:    This function is a cancellation point and therefore not marked with
154:    __THROW.  */
155: extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
156:                    int __options);
157: #endif
158: 
159: #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
160: /* This being here makes the prototypes valid whether or not
161:    we have already included <sys/resource.h> to define `struct rusage'.  */
162: struct rusage;
163: 
164: /* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
165:    return its process ID.  For errors return (pid_t) -1.  If USAGE is not
166:    nil, store information about the child's resource usage there.  If the
167:    WUNTRACED bit is set in OPTIONS, return status for stopped children;
168:    otherwise don't.  */
169: extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options,
170:                       struct rusage * __usage) __THROWNL;
171: #endif
172: 
173: #ifdef __USE_BSD
174: /* PID is like waitpid.  Other args are like wait3.  */
175: extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
176:                       struct rusage *__usage) __THROWNL;
177: #endif /* Use BSD.  */
178: 
179: 
180: __END_DECLS
181: 
182: #endif /* sys/wait.h  */
183: 


for client 52.14.150.55
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/