summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fifo.c16
-rw-r--r--src/meson.build4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/fifo.c b/src/fifo.c
new file mode 100644
index 0000000..f2da11e
--- /dev/null
+++ b/src/fifo.c
@@ -0,0 +1,16 @@
+#include "fifo.h"
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#ifdef HASMKFIFO
+int fifo_make(char *fn, int mode)
+{
+ return mkfifo(fn, mode);
+}
+#else
+int fifo_make(char *fn, int mode)
+{
+ return mknod(fn, S_IFIFO | mode, 0);
+}
+#endif
diff --git a/src/meson.build b/src/meson.build
index c3593f4..5df7840 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -35,6 +35,7 @@ other_srcs = files(
'case.c',
'env.c',
'fd.c',
+ 'fifo.c',
'getln.c',
'getoptb.c',
'lock.c',
@@ -64,6 +65,9 @@ qlibs_c_args = []
if cc.has_header_symbol('sys/file.h', 'flock')
qlibs_c_args += '-DHASFLOCK'
endif
+if cc.has_header_symbol('sys/stat.h', 'mkfifo')
+ qlibs_c_args += '-DHASMKFIFO'
+endif
qlibs_lib = library(
'qlibs',