[master] 31baed29c Revert "On linux, use close_range() if available and prefer it over closefrom()"
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Wed Feb 8 14:14:05 UTC 2023
commit 31baed29c5e77bafe8850d935240acefdb33cd4c
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Wed Feb 8 15:02:06 2023 +0100
Revert "On linux, use close_range() if available and prefer it over closefrom()"
This reverts commit 0c1aef58e57a5935116bf55176cbf48aad3d3a08.
The close_range(2) system call is too recent and not recognized by the
host system on CircleCI, so the fedora-latest container detects it but
is denied execution (EPERM) from the host's libseccomp.
Also, on platforms with neither close_range(2) nor closefrom(2) we ended
up not including <dirent.h> and failing virtually everywhere in our CI.
The ifdef dance could have looked like this:
#ifdef HAVE_LINUX_CLOSE_RANGE_H
# include <linux/close_range.h>
#elif HAVE_CLOSEFROM
#else
# include <dirent.h>
#endif
Note the extra #else missing from the original patch.
This is reverted for now because we need to check that close_range(2)
works at configure time to circumvent the host mismatch problem.
diff --git a/configure.ac b/configure.ac
index e5b4a188a..dc0153c50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,7 +227,6 @@ AC_CHECK_HEADERS([sys/vfs.h])
AC_CHECK_HEADERS([endian.h])
AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
AC_CHECK_HEADERS([priv.h])
-AC_CHECK_HEADERS([linux/close_range.h])
AC_CHECK_HEADERS([fnmatch.h], [], [AC_MSG_ERROR([fnmatch.h is required])])
# Checks for library functions.
diff --git a/lib/libvarnish/vsub.c b/lib/libvarnish/vsub.c
index 0cdac7364..b528c12c4 100644
--- a/lib/libvarnish/vsub.c
+++ b/lib/libvarnish/vsub.c
@@ -38,9 +38,7 @@
#include <stdlib.h> // Solaris closefrom(3c)
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_LINUX_CLOSE_RANGE_H
-# include <linux/close_range.h>
-#elif HAVE_CLOSEFROM
+#ifndef HAVE_CLOSEFROM
# include <dirent.h>
#endif
@@ -67,10 +65,7 @@ VSUB_closefrom(int fd)
assert(fd >= 0);
-#ifdef HAVE_LINUX_CLOSE_RANGE_H
- AZ(close_range(fd, ~0U, 0));
- return;
-#elif HAVE_CLOSEFROM
+#ifdef HAVE_CLOSEFROM
closefrom(fd);
return;
#else
More information about the varnish-commit
mailing list