Skip to content

Commit bda908f

Browse files
add missing POSIX mandated macros
1 parent c52b9ec commit bda908f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

libc/include/llvm-libc-macros/linux/sys-wait-macros.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,28 @@
1212
#include <linux/wait.h>
1313

1414
// Wait status info macros
15-
#define __WEXITSTATUS(status) (((status)&0xff00) >> 8)
16-
#define __WTERMSIG(status) ((status)&0x7f)
15+
#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
16+
#define __WTERMSIG(status) ((status) & 0x7f)
1717
#define __WIFEXITED(status) (__WTERMSIG(status) == 0)
18+
#define __WIFSIGNALED(status) ((__WTERMSIG(status) + 1) >= 2)
19+
#define __WIFSTOPPED(status) (__WTERMSIG(status) == 0x7f)
20+
#define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
21+
#define __WCOREDUMP(status) ((status) & __WCOREFLAG)
1822

1923
// Macros for constructing status values.
2024
#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
2125
#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f)
2226
#define __W_CONTINUED 0xffff
2327
#define __WCOREFLAG 0x80
2428

29+
#define WCOREDUMP(status) ((status) & __WCOREFLAG)
2530
#define WEXITSTATUS(status) __WEXITSTATUS(status)
26-
#define WTERMSIG(status) __WTERMSIG(status)
31+
#define WIFCONTINUED(status) __WIFCONTINUED(status)
2732
#define WIFEXITED(status) __WIFEXITED(status)
33+
#define WIFSIGNALED(status) __WIFSIGNALED(status)
34+
#define WIFSTOPPED(status) __WIFSTOPPED(status)
35+
#define WSTOPSIG(status) WEXITSTATUS(status)
36+
#define WTERMSIG(status) __WTERMSIG(status)
2837

2938
#define WCOREFLAG __WCOREFLAG
3039
#define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig)

0 commit comments

Comments
 (0)