summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-03-01 19:33:06 +0000
committerSimon McVittie <smcv@collabora.com>2022-04-21 11:02:14 +0100
commitee694ade6199932bc9e7ae40f7202c9426599c72 (patch)
treed25cb4df217f8c35d37859bb8855313b05f3b973 /cmake
parentfaa3b2ef4a4807c8a99f8050f733fd82db9f9ce3 (diff)
downloaddbus-ee694ade6199932bc9e7ae40f7202c9426599c72.tar.gz
sysdeps: Use close_range() if available
The version with no flags set, which is a slight generalization of closefrom(), is available on recent Linux and FreeBSD. The version with CLOSE_RANGE_CLOEXEC is Linux-specific. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ConfigureChecks.cmake1
-rw-r--r--cmake/config.h.cmake3
2 files changed, 4 insertions, 0 deletions
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
index 78b0fa95..f2ca64c7 100644
--- a/cmake/ConfigureChecks.cmake
+++ b/cmake/ConfigureChecks.cmake
@@ -53,6 +53,7 @@ check_symbol_exists(setenv "stdlib.h" HAVE_SETENV) #
check_symbol_exists(unsetenv "stdlib.h" HAVE_UNSETENV) # dbus-sysdeps.c
check_symbol_exists(clearenv "stdlib.h" HAVE_CLEARENV) # dbus-sysdeps.c
check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) # dbus-sysdeps-unix.c
+check_symbol_exists(close_range "unistd.h" HAVE_CLOSE_RANGE) # dbus-sysdeps-unix.c
check_symbol_exists(writev "sys/uio.h" HAVE_WRITEV) # dbus-sysdeps.c, dbus-sysdeps-win.c
check_symbol_exists(setrlimit "sys/resource.h" HAVE_SETRLIMIT) # dbus-sysdeps.c, dbus-sysdeps-win.c, test/test-segfault.c
check_symbol_exists(socketpair "sys/socket.h" HAVE_SOCKETPAIR) # dbus-sysdeps.c
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index 48c5db43..74299d1e 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -204,6 +204,9 @@
/* Define to 1 if you have closefrom */
#cmakedefine HAVE_CLOSEFROM 1
+/* Define to 1 if you have close_range */
+#cmakedefine HAVE_CLOSE_RANGE 1
+
/* Define to 1 if you have writev */
#cmakedefine HAVE_WRITEV 1