From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4957 invoked from network); 1 Sep 2023 14:59:56 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 1 Sep 2023 14:59:56 -0000 Received: (qmail 8145 invoked by uid 550); 1 Sep 2023 14:59:53 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 8110 invoked from network); 1 Sep 2023 14:59:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alpinelinux.org; s=smtp; t=1693580380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rRJh/T4l5tauPd+XhXIPIUhNzAEOKLplQRNA0vwbUFw=; b=qRSkqAWW3GNGRCp5gU52waAg3HyasbV9ju0yIea3jpGI/JX8/jQhITuXUZjNKUyYLgYPlD krL3sZrpqErAtW6g7kw0TjTlhs5xEg2K7SSU2+qxhWyRN1i3i/WBcC8tkKa0nFcJ8uKEAx lxiQQc8V1KhO7hGOLYypyu3nJ8+NYmE= From: Natanael Copa To: musl@lists.openwall.com Cc: Natanael Copa Date: Fri, 1 Sep 2023 16:58:48 +0200 Message-ID: <20230901145913.28307-1-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230901135733.GZ4163@brightrain.aerifal.cx> References: <20230901135733.GZ4163@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH v2] add close_range() syscall wrapper close_range() is a syscall present in FreeBSD 8.0 and Linux 5.9. glibc 2.34 added a wrapper. Expose it under _GNU_SOURCE similar to what GNU libc does. Also expose it under _BSD_SOURCE since it is also a FreeBSD function. --- v2: use syscall without __syscall_ret include/unistd.h | 3 +++ src/linux/close_range.c | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/linux/close_range.c diff --git a/include/unistd.h b/include/unistd.h index 5bc7f798..d89e3d4c 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -161,6 +161,9 @@ unsigned ualarm(unsigned, unsigned); #define L_INCR 1 #define L_XTND 2 int brk(void *); +#define CLOSE_RANGE_UNSHARE (1U << 1) +#define CLOSE_RANGE_CLOEXEC (1U << 2) +int close_range(unsigned int, unsigned int, int); void *sbrk(intptr_t); pid_t vfork(void); int vhangup(void); diff --git a/src/linux/close_range.c b/src/linux/close_range.c new file mode 100644 index 00000000..3f1378a0 --- /dev/null +++ b/src/linux/close_range.c @@ -0,0 +1,8 @@ +#define _GNU_SOURCE +#include +#include "syscall.h" + +int close_range(unsigned int first, unsigned int last, int flags) +{ + return syscall(SYS_close_range, first, last, flags); +} -- 2.42.0