-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathproc.h
More file actions
29 lines (23 loc) · 877 Bytes
/
Copy pathproc.h
File metadata and controls
29 lines (23 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <bits/signal.h>
#include <syscall.h>
#define WNOHANG 1 /* Don't block waiting. */
#define WUNTRACED 2 /* Report stopped child. */
#define WCONTINUED 8 /* Report continued child. */
#define WEXITSTATUS(status) (((status) & 0xFF00) >> 8)
#define WTERMSIG(status) ((status) & 0x7F)
#define WIFEXITED(status) (WTERMSIG(status) == 0)
#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
#define WIFSTOPPED(status) (((status) & 0xFF) == 0x7F)
#define WIFCONTINUED(status) ((status) == 0xFFFF)
inline static long sys_fork(void)
{
return syscall5(NR_clone, SIGCHLD, 0, 0, 0, 0);
}
inline static long sys_execve(const char* exe, char** argv, char** envp)
{
return syscall3(NR_execve, (long)exe, (long)argv, (long)envp);
}
inline static long sys_waitpid(int pid, int* status, int flags)
{
return syscall4(NR_wait4, pid, (long)status, flags, 0);
}