Skip to content

Commit 473e8de

Browse files
committed
Auto merge of #2471 - NeoRaider:close_range, r=JohnTitor
linux: Add CLOSE_RANGE_* flags Flags for the SYS_close_range syscall from <linux/close_range.h>.
2 parents 21ad06f + 157ca89 commit 473e8de

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

libc-test/build.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2924,6 +2924,10 @@ fn test_linux(target: &str) {
29242924
| "SW_CNT"
29252925
if mips || ppc64 || riscv64 || sparc64 => true,
29262926

2927+
// FIXME: Requires more recent kernel headers (5.9 / 5.11):
2928+
| "CLOSE_RANGE_UNSHARE"
2929+
| "CLOSE_RANGE_CLOEXEC" => true,
2930+
29272931
// kernel constants not available in uclibc 1.0.34
29282932
| "ADDR_COMPAT_LAYOUT"
29292933
| "ADDR_LIMIT_3GB"

libc-test/semver/linux.txt

+2
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ CLONE_THREAD
265265
CLONE_UNTRACED
266266
CLONE_VFORK
267267
CLONE_VM
268+
CLOSE_RANGE_CLOEXEC
269+
CLOSE_RANGE_UNSHARE
268270
CMSG_DATA
269271
CMSG_FIRSTHDR
270272
CMSG_LEN

src/unix/linux_like/linux/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,10 @@ pub const MFD_CLOEXEC: ::c_uint = 0x0001;
18181818
pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
18191819
pub const MFD_HUGETLB: ::c_uint = 0x0004;
18201820

1821+
// linux/close_range.h
1822+
pub const CLOSE_RANGE_UNSHARE: ::c_uint = 1 << 1;
1823+
pub const CLOSE_RANGE_CLOEXEC: ::c_uint = 1 << 2;
1824+
18211825
// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
18221826
// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32
18231827
// so we can use that type here to avoid having to cast.

0 commit comments

Comments
 (0)