]> sourceware.org Git - newlib-cygwin.git/blob - winsup/cygwin/include/cygwin/wait.h
Throughout, update copyrights to reflect dates which correspond to main-branch
[newlib-cygwin.git] / winsup / cygwin / include / cygwin / wait.h
1 /* cygwin/wait.h
2
3 Copyright 2006, 2009, 2011, 2012 Red Hat, Inc.
4
5 This file is part of Cygwin.
6
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9 details. */
10
11 #ifndef _CYGWIN_WAIT_H
12 #define _CYGWIN_WAIT_H
13
14 #define WAIT_ANY (pid_t)-1
15 #define WAIT_MYPGRP (pid_t)0
16
17 #define WNOHANG 1
18 #define WUNTRACED 2
19 #define WCONTINUED 8
20 #define __W_CONTINUED 0xffff
21
22 /* Will be redefined in sys/wait.h. */
23 #define __wait_status_to_int(w) (w)
24
25 /* A status is 16 bits, and looks like:
26 <1 byte info> <1 byte code>
27
28 <code> == 0, child has exited, info is the exit value
29 <code> == 1..7e, child has exited, info is the signal number.
30 <code> == 7f, child has stopped, info was the signal number.
31 <code> == 80, there was a core dump.
32 */
33
34 #define WIFEXITED(w) ((__wait_status_to_int(w) & 0xff) == 0)
35 #define WIFSIGNALED(w) ((__wait_status_to_int(w) & 0x7f) > 0 \
36 && ((__wait_status_to_int(w) & 0x7f) < 0x7f))
37 #define WIFSTOPPED(w) ((__wait_status_to_int(w) & 0xff) == 0x7f)
38 #define WIFCONTINUED(w) ((__wait_status_to_int(w) & 0xffff) == __W_CONTINUED)
39 #define WEXITSTATUS(w) ((__wait_status_to_int(w) >> 8) & 0xff)
40 #define WTERMSIG(w) (__wait_status_to_int(w) & 0x7f)
41 #define WSTOPSIG WEXITSTATUS
42 #define WCOREDUMP(w) (WIFSIGNALED(w) && (__wait_status_to_int(w) & 0x80))
43
44 #endif /* _CYGWIN_WAIT_H */
This page took 0.034986 seconds and 5 git commands to generate.