aboutsummaryrefslogtreecommitdiff
path: root/src/self_pipe.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-18 09:42:45 +0000
committer_ov4 <ov4@ov4.org>2026-10-18 09:42:45 +0000
commitc8479ceff6aea37def538c902324c68930947f21 (patch)
tree815cbb6043da08495c51e5ad30c7238c6f5573be /src/self_pipe.cc
parent53784946192225525a269423a3bdf65d1e9ea326 (diff)
add self pipe, and non-block-input
Diffstat (limited to 'src/self_pipe.cc')
-rw-r--r--src/self_pipe.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/self_pipe.cc b/src/self_pipe.cc
new file mode 100644
index 0000000..42e61d8
--- /dev/null
+++ b/src/self_pipe.cc
@@ -0,0 +1,21 @@
+#include "pipe.h"
+
+#include <unistd.h>
+#include <cstdlib>
+#include <fcntl.h>
+
+#include "error.h"
+
+namespace ov4
+{
+
+void self_pipe_init()
+{
+ int ret = pipe2(self_pipe_fd, O_NONBLOCK);
+ if (ret != 0)
+ {
+ throw T_error(error_code::FAIL_TO_OPEN_PIPE, "Fail to open self pipe");
+ }
+}
+
+} \ No newline at end of file