1 /*
2 * Copyright (c) 2004-2021 The strace developers.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7
8 #ifndef STRACE_WAIT_H
9 # define STRACE_WAIT_H
10
11 # include "defs.h"
12
13 # include <sys/wait.h>
14
15 # include "static_assert.h"
16
17 /*
18 * On Linux, the "core dumped" flag is hard-coded to 0x80:
19 * fs/coredump.c:coredump_finish() after v3.10-rc1~143^2~41,
20 * fs/coredump.c:do_coredump() between v3.7-rc1~134^2~4 and v3.10-rc1~143^2~41,
21 * or fs/exec.c:do_coredump() before v3.7-rc1~134^2~4
22 */
23 # ifndef WCOREFLAG
24 # define WCOREFLAG 0x80
25 # else
26 static_assert((WCOREFLAG) == 0x80, "WCOREFLAG != 0x80");
27 # endif
28 # ifndef WCOREDUMP
29 # define WCOREDUMP(status) ((status) & (WCOREFLAG))
30 # endif
31
32 # ifndef W_STOPCODE
33 # define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
34 # endif
35 # ifndef W_EXITCODE
36 # define W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
37 # endif
38 # ifndef W_CONTINUED
39 # define W_CONTINUED 0xffff
40 # endif
41
42 #endif /* STRACE_WAIT_H */