xref: /openbsd-src/gnu/usr.bin/cvs/lib/wait.h (revision 780d15dfff9934c79e6717020f46114c9b7d7d04)
11e72d8d2Sderaadt /* wait.h -- POSIX macros for evaluating exit statuses
21e72d8d2Sderaadt    Copyright (C) 1990 Free Software Foundation, Inc.
31e72d8d2Sderaadt 
41e72d8d2Sderaadt    This program is free software; you can redistribute it and/or modify
51e72d8d2Sderaadt    it under the terms of the GNU General Public License as published by
61e72d8d2Sderaadt    the Free Software Foundation; either version 2, or (at your option)
71e72d8d2Sderaadt    any later version.
81e72d8d2Sderaadt 
91e72d8d2Sderaadt    This program is distributed in the hope that it will be useful,
101e72d8d2Sderaadt    but WITHOUT ANY WARRANTY; without even the implied warranty of
111e72d8d2Sderaadt    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12461cc63eStholo    GNU General Public License for more details.  */
131e72d8d2Sderaadt 
141e72d8d2Sderaadt #ifdef HAVE_SYS_WAIT_H
151e72d8d2Sderaadt #include <sys/types.h>		/* For pid_t. */
1613571821Stholo #ifdef HAVE_SYS_RESOURCE_H
1713571821Stholo #include <sys/resource.h>	/* for rusage */
1813571821Stholo #endif
191e72d8d2Sderaadt #include <sys/wait.h>
20*780d15dfStholo #endif
21*780d15dfStholo #ifndef WIFSTOPPED
221e72d8d2Sderaadt #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
23*780d15dfStholo #endif
24*780d15dfStholo #ifndef WIFSIGNALED
251e72d8d2Sderaadt #define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
26*780d15dfStholo #endif
27*780d15dfStholo #ifndef WIFEXITED
281e72d8d2Sderaadt #define WIFEXITED(w) (((w) & 0xff) == 0)
29*780d15dfStholo #endif
301e72d8d2Sderaadt 
31*780d15dfStholo #ifndef WSTOPSIG
321e72d8d2Sderaadt #define WSTOPSIG(w) (((w) >> 8) & 0xff)
33*780d15dfStholo #endif
34*780d15dfStholo #ifndef WTERMSIG
351e72d8d2Sderaadt #define WTERMSIG(w) ((w) & 0x7f)
36*780d15dfStholo #endif
37*780d15dfStholo #ifndef WEXITSTATUS
381e72d8d2Sderaadt #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
391e72d8d2Sderaadt #endif
40