Stub out system functions for testing (WIP).
[oweals/dinit.git] / src / tests / test-includes / baseproc-sys.h
diff --git a/src/tests/test-includes/baseproc-sys.h b/src/tests/test-includes/baseproc-sys.h
new file mode 100644 (file)
index 0000000..b12c495
--- /dev/null
@@ -0,0 +1,31 @@
+#include <sys/types.h>
+
+// Mock system functions for testing.
+
+namespace bp_sys {
+
+inline int pipe2(int pipefd[2], int flags)
+{
+    abort();
+    return 0;
+}
+
+inline int fcntl(int fd, int cmd, ...)
+{
+    // This is used for setting the CLOEXEC flag, we can just return 0:
+    return 0;
+}
+
+inline int close(int fd)
+{
+    abort();
+    return 0;
+}
+
+inline int kill(pid_t pid, int sig)
+{
+    abort();
+    return 0;
+}
+
+}