Add getpgid stub to bp_sys namespace.
[oweals/dinit.git] / src / tests / test-includes / baseproc-sys.h
1 #include <sys/types.h>
2 #include <iostream>
3
4 // Mock system functions for testing.
5
6 namespace bp_sys {
7
8 int pipe2(int pipefd[2], int flags);
9 int close(int fd);
10
11 inline int fcntl(int fd, int cmd, ...)
12 {
13     // This is used for setting the CLOEXEC flag, we can just return 0:
14     return 0;
15 }
16
17 inline int kill(pid_t pid, int sig)
18 {
19     // No proper mock implemented yet:
20     std::cout << "(kill; aborting)" << std::endl;
21     abort();
22     return 0;
23 }
24
25 inline pid_t getpgid(pid_t pid)
26 {
27     return pid;
28 }
29
30 }