From 825b80eaa311b0aec4c00614f38f3eb63949d5a7 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 16 Apr 2024 12:57:52 +0000 Subject: Tentative support for old MacOS with no O_CLOEXEC Also add a prototype for gol, not finished yet. Signed-off-by: Laurent Bercot --- src/include/skalibs/djbunix.h | 2 +- src/include/skalibs/fcntl.h | 20 ++++++++++++++++++++ src/include/skalibs/gol.h | 32 ++++++++++++++++++++++++++++++++ src/include/skalibs/socket.h | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 src/include/skalibs/fcntl.h create mode 100644 src/include/skalibs/gol.h (limited to 'src/include') 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 #include #include -#include #include #include #include +#include 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 + + /* + 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 + +#include + +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 #include -#include #include #include #include +#include typedef ssize_t socket_io_func (int, char *, size_t, char *, uint16_t *) ; typedef socket_io_func *socket_io_func_ref ; -- cgit v1.3.1