summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2024-04-16 12:57:52 +0000
committerLaurent Bercot <ska@appnovation.com>2024-04-16 12:57:52 +0000
commit825b80eaa311b0aec4c00614f38f3eb63949d5a7 (patch)
tree624f702487d9acdd3cc85060cfe2edc388cf7096 /src/include
parentbfc53cfde4fdda343647678fcd21b38a44f2de08 (diff)
downloadskalibs-825b80eaa311b0aec4c00614f38f3eb63949d5a7.tar.xz
Tentative support for old MacOS with no O_CLOEXEC
Also add a prototype for gol, not finished yet. Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/skalibs/djbunix.h2
-rw-r--r--src/include/skalibs/fcntl.h20
-rw-r--r--src/include/skalibs/gol.h32
-rw-r--r--src/include/skalibs/socket.h2
4 files changed, 54 insertions, 2 deletions
diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h
index 68ec3b7..5bef6ec 100644
--- a/src/include/skalibs/djbunix.h
+++ b/src/include/skalibs/djbunix.h
@@ -6,11 +6,11 @@
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/wait.h>
-#include <fcntl.h>
#include <skalibs/gccattributes.h>
#include <skalibs/stralloc.h>
#include <skalibs/devino.h>
+#include <skalibs/fcntl.h>
extern int coe (int) ;
extern int uncoe (int) ;
diff --git a/src/include/skalibs/fcntl.h b/src/include/skalibs/fcntl.h
new file mode 100644
index 0000000..fa91343
--- /dev/null
+++ b/src/include/skalibs/fcntl.h
@@ -0,0 +1,20 @@
+/* ISC license. */
+
+#ifndef SKALIBS_FCNTL_H
+#define SKALIBS_FCNTL_H
+
+#include <fcntl.h>
+
+ /*
+ Old MacOS X doesn't have O_CLOEXEC.
+ We define it to something completely out of the way so we
+ can still use it in userspace.
+ Workarounds in syscalls will be enabled via the
+ SKALIBS_HASOCLOEXEC sysdep.
+ */
+
+#ifndef O_CLOEXEC
+#define O_CLOEXEC 0x40000000
+#endif
+
+#endif
diff --git a/src/include/skalibs/gol.h b/src/include/skalibs/gol.h
new file mode 100644
index 0000000..bcab96c
--- /dev/null
+++ b/src/include/skalibs/gol.h
@@ -0,0 +1,32 @@
+/* ISC license. */
+
+#ifndef SKALIBS_GOL_H
+#define SKALIBS_GOL_H
+
+ /* Parsing of long (and short) options. */
+
+#include <stdint.h>
+
+#include <skalibs/uint64.h>
+
+typedef struct gol_bool_s gol_bool, gol_bool ;
+struct gol_bool_s
+{
+ char const *lo ;
+ uint8_t so : 7 ;
+ uint8_t set : 1 ;
+ uint64_t mask ;
+} ;
+
+typedef struct gol_arg_s gol_arg, gol_arg_ref ;
+struct gol_arg_s
+{
+ char const *lo ;
+ uint8_t so : 7 ;
+ unsigned int i ;
+} ;
+
+extern int gol (char const *const *, unsigned int, gol_bool const *, unsigned int, gol_arg const *a, unsigned int, uint64_t *, char const **, int *) ;
+extern unsigned int gol_argv (int, char const *const *, gol_bool const *, unsigned int, gol_arg const *a, unsigned int, uint64_t *, char const **) ;
+
+#endif
diff --git a/src/include/skalibs/socket.h b/src/include/skalibs/socket.h
index 85340bb..f13b2ee 100644
--- a/src/include/skalibs/socket.h
+++ b/src/include/skalibs/socket.h
@@ -5,11 +5,11 @@
#include <stddef.h>
#include <stdint.h>
-#include <fcntl.h>
#include <skalibs/gccattributes.h>
#include <skalibs/posixplz.h>
#include <skalibs/tai.h>
+#include <skalibs/fcntl.h>
typedef ssize_t socket_io_func (int, char *, size_t, char *, uint16_t *) ;
typedef socket_io_func *socket_io_func_ref ;