117721Speter/* wait.h -- POSIX macros for evaluating exit statuses 217721Speter Copyright (C) 1990 Free Software Foundation, Inc. 317721Speter 417721Speter This program is free software; you can redistribute it and/or modify 517721Speter it under the terms of the GNU General Public License as published by 617721Speter the Free Software Foundation; either version 2, or (at your option) 717721Speter any later version. 817721Speter 917721Speter This program is distributed in the hope that it will be useful, 1017721Speter but WITHOUT ANY WARRANTY; without even the implied warranty of 1117721Speter MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1225839Speter GNU General Public License for more details. */ 1317721Speter 1417721Speter#ifdef HAVE_SYS_WAIT_H 1517721Speter#include <sys/types.h> /* For pid_t. */ 1617721Speter#ifdef HAVE_SYS_RESOURCE_H 1717721Speter#include <sys/resource.h> /* for rusage */ 1817721Speter#endif 1917721Speter#include <sys/wait.h> 2025839Speter#endif 2125839Speter#ifndef WIFSTOPPED 2217721Speter#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) 2325839Speter#endif 2425839Speter#ifndef WIFSIGNALED 2517721Speter#define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0) 2625839Speter#endif 2725839Speter#ifndef WIFEXITED 2817721Speter#define WIFEXITED(w) (((w) & 0xff) == 0) 2925839Speter#endif 30128266Speter#ifndef WCOREDUMP /* not POSIX, but common and useful */ 31128266Speter#define WCOREDUMP(w) (((w) & 0x80) != 0) 32128266Speter#endif 3317721Speter 3425839Speter#ifndef WSTOPSIG 3517721Speter#define WSTOPSIG(w) (((w) >> 8) & 0xff) 3625839Speter#endif 3725839Speter#ifndef WTERMSIG 3817721Speter#define WTERMSIG(w) ((w) & 0x7f) 3925839Speter#endif 4025839Speter#ifndef WEXITSTATUS 4117721Speter#define WEXITSTATUS(w) (((w) >> 8) & 0xff) 4217721Speter#endif 43