summaryrefslogtreecommitdiff
path: root/src/libunixonacid
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/libunixonacid
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/libunixonacid')
-rw-r--r--src/libunixonacid/access_at.c2
-rw-r--r--src/libunixonacid/open2_at.c7
-rw-r--r--src/libunixonacid/open3_at.c7
-rw-r--r--src/libunixonacid/open_appendat.c3
-rw-r--r--src/libunixonacid/open_readat.c2
-rw-r--r--src/libunixonacid/open_truncat.c2
-rw-r--r--src/libunixonacid/open_writeat.c2
-rw-r--r--src/libunixonacid/openc_appendat.c2
-rw-r--r--src/libunixonacid/openc_readat.c3
-rw-r--r--src/libunixonacid/openc_truncat.c3
-rw-r--r--src/libunixonacid/openc_writeat.c3
-rw-r--r--src/libunixonacid/stat_at.c8
-rw-r--r--src/libunixonacid/textclient_server_init_frompipe.c2
13 files changed, 25 insertions, 21 deletions
diff --git a/src/libunixonacid/access_at.c b/src/libunixonacid/access_at.c
index 69fdce4..e7f988c 100644
--- a/src/libunixonacid/access_at.c
+++ b/src/libunixonacid/access_at.c
@@ -10,9 +10,9 @@
#include <skalibs/nonposix.h>
-#include <fcntl.h>
#include <unistd.h>
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int access_at (int dirfd, char const *file, int amode, unsigned int flag)
diff --git a/src/libunixonacid/open2_at.c b/src/libunixonacid/open2_at.c
index 76d79cc..d96c0b7 100644
--- a/src/libunixonacid/open2_at.c
+++ b/src/libunixonacid/open2_at.c
@@ -11,14 +11,14 @@
#include <skalibs/nonposix.h>
#include <errno.h>
-#include <fcntl.h>
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int open2_at (int dirfd, char const *file, int flags)
{
int fd ;
- do fd = openat(dirfd, file, flags) ;
+ do fd = openat(dirfd, file, flags) ; /* all systems supporting openat() have O_CLOEXEC */
while (fd == -1 && errno == EINTR) ;
return fd ;
}
@@ -26,8 +26,9 @@ int open2_at (int dirfd, char const *file, int flags)
#else
#include <sys/stat.h>
-#include <fcntl.h>
#include <errno.h>
+
+#include <skalibs/fcntl.h>
#include <skalibs/djbunix.h>
#include <skalibs/unix-transactional.h>
diff --git a/src/libunixonacid/open3_at.c b/src/libunixonacid/open3_at.c
index 063092d..742a579 100644
--- a/src/libunixonacid/open3_at.c
+++ b/src/libunixonacid/open3_at.c
@@ -11,14 +11,14 @@
#include <skalibs/nonposix.h>
#include <errno.h>
-#include <fcntl.h>
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int open3_at (int dirfd, char const *file, int flags, unsigned int mode)
{
int fd ;
- do fd = openat(dirfd, file, flags, mode) ;
+ do fd = openat(dirfd, file, flags, mode) ; /* all systems that support openat() have O_CLOEXEC */
while (fd == -1 && errno == EINTR) ;
return fd ;
}
@@ -26,8 +26,9 @@ int open3_at (int dirfd, char const *file, int flags, unsigned int mode)
#else
#include <sys/stat.h>
-#include <fcntl.h>
#include <errno.h>
+
+#include <skalibs/fcntl.h>
#include <skalibs/djbunix.h>
#include <skalibs/unix-transactional.h>
diff --git a/src/libunixonacid/open_appendat.c b/src/libunixonacid/open_appendat.c
index 5ad73d1..66a3cb4 100644
--- a/src/libunixonacid/open_appendat.c
+++ b/src/libunixonacid/open_appendat.c
@@ -1,7 +1,8 @@
/* ISC license. */
#include <sys/stat.h>
-#include <fcntl.h>
+
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int open_appendat (int fd, char const *name)
diff --git a/src/libunixonacid/open_readat.c b/src/libunixonacid/open_readat.c
index 05f6926..7149329 100644
--- a/src/libunixonacid/open_readat.c
+++ b/src/libunixonacid/open_readat.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <fcntl.h>
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int open_readat (int fd, char const *name)
diff --git a/src/libunixonacid/open_truncat.c b/src/libunixonacid/open_truncat.c
index ce4f132..d7c61bf 100644
--- a/src/libunixonacid/open_truncat.c
+++ b/src/libunixonacid/open_truncat.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <fcntl.h>
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int open_truncat (int fd, char const *name)
diff --git a/src/libunixonacid/open_writeat.c b/src/libunixonacid/open_writeat.c
index 695e343..9206f08 100644
--- a/src/libunixonacid/open_writeat.c
+++ b/src/libunixonacid/open_writeat.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <fcntl.h>
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int open_writeat (int fd, char const *name)
diff --git a/src/libunixonacid/openc_appendat.c b/src/libunixonacid/openc_appendat.c
index 70b6df7..88228c5 100644
--- a/src/libunixonacid/openc_appendat.c
+++ b/src/libunixonacid/openc_appendat.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <sys/stat.h>
-#include <fcntl.h>
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int openc_appendat (int fd, char const *name)
diff --git a/src/libunixonacid/openc_readat.c b/src/libunixonacid/openc_readat.c
index dc092b6..3284977 100644
--- a/src/libunixonacid/openc_readat.c
+++ b/src/libunixonacid/openc_readat.c
@@ -1,7 +1,6 @@
/* ISC license. */
-#include <fcntl.h>
-
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int openc_readat (int fd, char const *name)
diff --git a/src/libunixonacid/openc_truncat.c b/src/libunixonacid/openc_truncat.c
index 8ce50d2..55d1123 100644
--- a/src/libunixonacid/openc_truncat.c
+++ b/src/libunixonacid/openc_truncat.c
@@ -1,7 +1,6 @@
/* ISC license. */
-#include <fcntl.h>
-
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int openc_truncat (int fd, char const *name)
diff --git a/src/libunixonacid/openc_writeat.c b/src/libunixonacid/openc_writeat.c
index e584e57..c79c652 100644
--- a/src/libunixonacid/openc_writeat.c
+++ b/src/libunixonacid/openc_writeat.c
@@ -1,7 +1,6 @@
/* ISC license. */
-#include <fcntl.h>
-
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int openc_writeat (int fd, char const *name)
diff --git a/src/libunixonacid/stat_at.c b/src/libunixonacid/stat_at.c
index 2d04d57..e4040d5 100644
--- a/src/libunixonacid/stat_at.c
+++ b/src/libunixonacid/stat_at.c
@@ -9,8 +9,10 @@
#endif
#include <skalibs/nonposix.h>
+
#include <sys/stat.h>
-#include <fcntl.h>
+
+#include <skalibs/fcntl.h>
#include <skalibs/unix-transactional.h>
int stat_at (int dirfd, char const *file, struct stat *st)
@@ -27,9 +29,11 @@ int lstat_at (int dirfd, char const *file, struct stat *st)
/* OpenBSD plz. lstat() is POSIX. */
#include <skalibs/nonposix.h>
+
#include <sys/stat.h>
-#include <fcntl.h>
#include <errno.h>
+
+#include <skalibs/fcntl.h>
#include <skalibs/djbunix.h>
#include <skalibs/unix-transactional.h>
diff --git a/src/libunixonacid/textclient_server_init_frompipe.c b/src/libunixonacid/textclient_server_init_frompipe.c
index d5d9d97..3909deb 100644
--- a/src/libunixonacid/textclient_server_init_frompipe.c
+++ b/src/libunixonacid/textclient_server_init_frompipe.c
@@ -2,9 +2,9 @@
#include <sys/uio.h>
#include <stdlib.h>
-#include <fcntl.h>
#include <errno.h>
+#include <skalibs/fcntl.h>
#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/cspawn.h>