From debdea29071d60cc9f338f1eaa2de6d84505961c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 9 Feb 2024 16:46:21 +0000 Subject: [PATCH] missing: Add a wrapper for close_range() This is not the same as systemd's, because systemd's disagrees with glibc on the signedness of the arguments (https://github.com/systemd/systemd/issues/31270). Signed-off-by: Simon McVittie --- glnx-missing-syscall.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/glnx-missing-syscall.h b/glnx-missing-syscall.h index 51e28fd7..c32a3f73 100644 --- a/glnx-missing-syscall.h +++ b/glnx-missing-syscall.h @@ -224,3 +224,15 @@ G_STATIC_ASSERT(__NR_close_range == systemd_NR_close_range); # endif # endif #endif + +#if !defined(HAVE_CLOSE_RANGE) && defined(__NR_close_range) +static inline int +inline_close_range (unsigned int low, + unsigned int high, + int flags) +{ + return syscall (__NR_close_range, low, high, flags); +} +#define close_range(low, high, flags) inline_close_range(low, high, flags) +#define HAVE_CLOSE_RANGE +#endif