2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 /* @(#)waitdefs.h 1.10 03/02/25 Copyright 1995-2003 J. Schilling */
15 * Definitions to deal with various kinds of wait flavour
17 * Copyright (c) 1995-2003 J. Schilling
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License version 2
22 * as published by the Free Software Foundation.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License along with
30 * this program; see the file COPYING. If not, write to the Free Software
31 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
44 #ifndef _INCL_SYS_TYPES_H
45 #include <sys/types.h>
46 #define _INCL_SYS_TYPES_H
49 #if defined(HAVE_WAIT_H)
56 * K&R Compiler doesn't like #elif
58 # if defined(HAVE_SYS_WAIT_H) /* POSIX.1 compl. sys/wait.h */
59 # undef HAVE_UNION_WAIT /* POSIX.1 doesn't use U_W */
60 # ifndef _INCL_SYS_WAIT_H
61 # include <sys/wait.h>
62 # define _INCL_SYS_WAIT_H
65 # if defined(HAVE_UNION_WAIT) /* Pure BSD U_W / sys/wait.h */
66 # ifndef _INCL_SYS_WAIT_H
67 # include <sys/wait.h>
68 # define _INCL_SYS_WAIT_H
78 #ifdef HAVE_UNION_WAIT
79 # define WAIT_T union wait
81 # define WSTOPPED 0x7F
84 # define WTERMSIG(status) ((status).w_termsig)
87 # define WCOREDUMP(status) ((status).w_coredump)
90 # define WEXITSTATUS(status) ((status).w_retcode)
93 # define WSTOPSIG(status) ((status).w_stopsig)
96 # define WIFSTOPPED(status) ((status).w_stopval == \
100 # define WIFSIGNALED(status) ((status).w_stopval != \
102 (status).w_termsig != 0)
105 # define WIFEXITED(status) ((status).w_stopval != \
107 (status).w_termsig == 0)
112 # define WTERMSIG(status) ((status) & 0x7F)
115 # define WCOREDUMP(status) ((status) & 0x80)
118 # define WEXITSTATUS(status) (((status) >> 8) & 0xFF)
121 # define WSTOPSIG(status) (((status) >> 8) & 0xFF)
124 # define WIFSTOPPED(status) (((status) & 0xFF) == 0x7F)
127 # define WIFSIGNALED(status) (((status) & 0xFF) != 0x7F && \
128 WTERMSIG(status) != 0)
131 # define WIFEXITED(status) (((status) & 0xFF) == 0)
137 #define WCOREFLG 0x80
141 #define WSTOPFLG 0x7F
145 #define WCONTFLG 0xFFFF
152 #endif /* _WAITDEFS_H */