-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomfork.h
More file actions
33 lines (29 loc) · 798 Bytes
/
comfork.h
File metadata and controls
33 lines (29 loc) · 798 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
30
31
32
33
#ifndef COMFORK_H
#define COMFORK_H
#ifndef _WIN32
#include <unistd.h>
#include <sys/wait.h>
#else
#ifndef pid_t
typedef int pid_t;
#endif
#define WNOHANG 1
#define WUNTRACED 2
#define WEXITSTATUS(status) (((status) >> 8) & 0xFF)
#define WSTOPSIG(stat) ((status) & 0x7F)
#define WIFEXITED(status) (((status) & 0xFF) == 0)
// Some Windows have issues with using exit and _exit, replace them with proper Nt API
#define exit(status) (ntExit((status)))
#define _exit(status) (ntExit((status)))
#ifdef __cplusplus
extern "C" {
#endif
pid_t waitpid(pid_t pid, int* status, int options);
pid_t wait(int* status);
pid_t fork();
void ntExit(int status);
#ifdef __cplusplus
}
#endif
#endif
#endif