sys_wait: implement C macros properly

Remove the broken Rust functions and instead provide C macros in a
`include/bits` header. The C macros were taken from musl.
This commit is contained in:
Jasen Borisov
2018-06-20 19:36:36 +01:00
parent 895e250564
commit 06a8d5d89d
3 changed files with 14 additions and 41 deletions
+13
View File
@@ -0,0 +1,13 @@
#ifndef _BITS_SYS_WAIT_H
#define _BITS_SYS_WAIT_H
#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
#define WTERMSIG(s) ((s) & 0x7f)
#define WSTOPSIG(s) WEXITSTATUS(s)
#define WCOREDUMP(s) ((s) & 0x80)
#define WIFEXITED(s) (!WTERMSIG(s))
#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
#define WIFCONTINUED(s) ((s) == 0xffff)
#endif /* _BITS_SYS_WAIT_H */