minix/include/sys/wait.h
Ben Gras 2fe8fb192f Full switch to clang/ELF. Drop ack. Simplify.
There is important information about booting non-ack images in
docs/UPDATING. ack/aout-format images can't be built any more, and
booting clang/ELF-format ones is a little different. Updating to the
new boot monitor is recommended.

Changes in this commit:

	. drop boot monitor -> allowing dropping ack support
	. facility to copy ELF boot files to /boot so that old boot monitor
	  can still boot fairly easily, see UPDATING
	. no more ack-format libraries -> single-case libraries
	. some cleanup of OBJECT_FMT, COMPILER_TYPE, etc cases
	. drop several ack toolchain commands, but not all support
	  commands (e.g. aal is gone but acksize is not yet).
	. a few libc files moved to netbsd libc dir
	. new /bin/date as minix date used code in libc/
	. test compile fix
	. harmonize includes
	. /usr/lib is no longer special: without ack, /usr/lib plays no
	  kind of special bootstrapping role any more and bootstrapping
	  is done exclusively through packages, so releases depend even
	  less on the state of the machine making them now.
	. rename nbsd_lib* to lib*
	. reduce mtree
2012-02-14 14:52:02 +01:00

64 lines
2.1 KiB
C

#ifndef _SYS_WAIT_H_
#define _SYS_WAIT_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/featuretest.h>
/* The <sys/wait.h> header contains macros related to wait(). The value
* returned by wait() and waitpid() depends on whether the process
* terminated by an exit() call, was killed by a signal, or was stopped
* due to job control, as follows:
*
* High byte Low byte
* +---------------------+
* exit(status) | status | 0 |
* +---------------------+
* killed by signal | 0 | signal |
* +---------------------+
* stopped (job control) | signal | 0177 |
* +---------------------+
*/
/*
* Macros to test the exit status returned by wait
* and extract the relevant values.
*/
#define _LOW(v) ( (v) & 0377)
#define _HIGH(v) ( ((v) >> 8) & 0377)
#define WIFEXITED(s) (_LOW(s) == 0) /* normal exit */
#define WEXITSTATUS(s) (_HIGH(s)) /* exit status */
#define WTERMSIG(s) (_LOW(s) & 0177) /* sig value */
#define WIFSIGNALED(s) ((((unsigned int)(s)-1) & 0xFFFFU) < 0xFFU) /* signaled */
#define WIFSTOPPED(s) (_LOW(s) == 0177) /* stopped */
#define WSTOPSIG(s) (_HIGH(s) & 0377) /* stop signal */
/*
* Option bits for the third argument of waitpid. WNOHANG causes the
* wait to not hang if there are no stopped or terminated processes, rather
* returning an error indication in this case (pid==0). WUNTRACED
* indicates that the caller should receive status about untraced children
* which stop due to signals. If children are stopped and a wait without
* this option is done, it is as though they were still running... nothing
* about them is returned.
*/
#define WNOHANG 0x00000001 /* don't hang in wait */
#define WUNTRACED 0x00000002 /* tell about stopped,
untraced children */
/* POSIX extensions and 4.2/4.3 compatibility: */
/*
* Tokens for special values of the "pid" parameter to waitpid.
*/
#define WAIT_ANY (-1) /* any process */
#define WAIT_MYPGRP 0 /* any process in my process group */
__BEGIN_DECLS
pid_t wait(int *);
pid_t waitpid(pid_t, int *, int);
__END_DECLS
#endif /* !_SYS_WAIT_H_ */