Skip to content

Commit 0118fe4

Browse files
committed
linux: Add missing Linux-specific fcntls
Also move F_DUPFD_CLOEXEC up a level as it is available on Android.
1 parent fa161ae commit 0118fe4

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

libc-test/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,15 @@ fn main() {
315315
"QFMT_VFS_OLD" |
316316
"QFMT_VFS_V0" if mips && linux => true,
317317

318+
// File sealing is available as of Linux 3.17, but the test infrastructure lacks these
319+
// constants.
320+
"F_ADD_SEALS" |
321+
"F_GET_SEALS" |
322+
"F_SEAL_SEAL" |
323+
"F_SEAL_SHRINK" |
324+
"F_SEAL_GROW" |
325+
"F_SEAL_WRITE" if linux || android => true,
326+
318327
_ => false,
319328
}
320329
});

src/unix/notbsd/linux/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,6 @@ pub const RTLD_NOW: ::c_int = 0x2;
315315

316316
pub const TCP_MD5SIG: ::c_int = 14;
317317

318-
pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
319-
320318
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
321319
__align: [],
322320
size: [0; __SIZEOF_PTHREAD_MUTEX_T],

src/unix/notbsd/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ pub const F_SETFD: ::c_int = 2;
161161
pub const F_GETFL: ::c_int = 3;
162162
pub const F_SETFL: ::c_int = 4;
163163

164+
// Linux-specific fcntls
165+
pub const F_SETLEASE: ::c_int = 1024;
166+
pub const F_GETLEASE: ::c_int = 1025;
167+
pub const F_NOTIFY: ::c_int = 1026;
168+
pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
169+
pub const F_SETPIPE_SZ: ::c_int = 1031;
170+
pub const F_GETPIPE_SZ: ::c_int = 1032;
171+
pub const F_ADD_SEALS: ::c_int = 1033;
172+
pub const F_GET_SEALS: ::c_int = 1034;
173+
174+
pub const F_SEAL_SEAL: ::c_int = 0x0001;
175+
pub const F_SEAL_SHRINK: ::c_int = 0x0002;
176+
pub const F_SEAL_GROW: ::c_int = 0x0004;
177+
pub const F_SEAL_WRITE: ::c_int = 0x0008;
178+
164179
pub const SIGTRAP: ::c_int = 5;
165180

166181
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;

0 commit comments

Comments
 (0)