From 348a48c80275445af03c893a955f29c3db0eb62d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 Jun 2024 11:10:13 +0200 Subject: executor: use close_range if available Close_range is faster. --- executor/common_linux.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'executor/common_linux.h') diff --git a/executor/common_linux.h b/executor/common_linux.h index 6b1826c65..f7f64a5c6 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -4818,12 +4818,17 @@ static void setup_test() #endif #if SYZ_EXECUTOR || SYZ_CLOSE_FDS +#include #define SYZ_HAVE_CLOSE_FDS 1 static void close_fds() { #if SYZ_EXECUTOR if (!flag_close_fds) return; +#endif +#ifdef SYS_close_range + if (!syscall(SYS_close_range, 3, MAX_FDS, 0)) + return; #endif // Keeping a 9p transport pipe open will hang the proccess dead, // so close all opened file descriptors. -- cgit mrf-deployment