Skip to content

Commit 017bf5f

Browse files
committed
Auto merge of #3373 - SteveLauC:close_range, r=JohnTitor
feat: add close_range for glibc This PR adds [`close_range(2)`](https://man7.org/linux/man-pages/man2/close_range.2.html) for Linux/glibc: ```c #include <linux/close_range.h> int close_range(unsigned int first, unsigned int last, unsigned int flags); ``` musl and uClibc don't have wrappers for this syscall
2 parents 14ef2e5 + 7b9e367 commit 017bf5f

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3378,6 +3378,7 @@ fn test_linux(target: &str) {
33783378
"sys/fanotify.h",
33793379
// <sys/auxv.h> is not present on uclibc
33803380
[!uclibc]: "sys/auxv.h",
3381+
[gnu]: "linux/close_range.h",
33813382
}
33823383

33833384
// note: aio.h must be included before sys/mount.h

libc-test/semver/linux-gnu.txt

+1
Original file line numberDiff line numberDiff line change
@@ -665,3 +665,4 @@ getmntent_r
665665
putpwent
666666
putgrent
667667
execveat
668+
close_range

src/unix/linux_like/linux/gnu/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,9 @@ extern "C" {
13991399
envp: *const *mut c_char,
14001400
flags: ::c_int,
14011401
) -> ::c_int;
1402+
1403+
// Added in `glibc` 2.34
1404+
pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int;
14021405
}
14031406

14041407
cfg_if! {

0 commit comments

Comments
 (0)