Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3671,6 +3671,7 @@ fn test_linux(target: &str) {
}

let arm = target.contains("arm");
let eabihf = target.contains("eabihf");
let aarch64 = target.contains("aarch64");
let i686 = target.contains("i686");
let ppc = target.contains("powerpc");
Expand Down Expand Up @@ -4487,6 +4488,16 @@ fn test_linux(target: &str) {
// FIXME(linux): Requires >= 6.16 kernel headers.
"PTRACE_SET_SYSCALL_INFO" => true,

// FIXME(linux): Requires >= 6.13 kernel headers.
"AT_HANDLE_CONNECTABLE" => true,

// FIXME(linux): Requires >= 6.12 kernel headers.
"AT_HANDLE_MNT_ID_UNIQUE" => true,

// FIXME(musl): This value is not yet in musl.
// eabihf targets are tested using an older version of glibc
"AT_HANDLE_FID" if musl || eabihf => true,

_ => false,
}
});
Expand Down Expand Up @@ -4734,6 +4745,7 @@ fn test_linux(target: &str) {
("bcm_msg_head", "frames") => true,
// FAM
("af_alg_iv", "iv") => true,
("file_handle", "f_handle") if musl => true,
// FIXME(ctest): ctest does not translate the rust code which computes the padding size
("pthread_cond_t", "__padding") if l4re => true,
_ => false,
Expand Down
7 changes: 7 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ AT_EXECVE_CHECK
AT_FDCWD
AT_FLAGS
AT_GID
AT_HANDLE_CONNECTABLE
AT_HANDLE_FID
AT_HANDLE_MNT_ID_UNIQUE
AT_HWCAP
AT_HWCAP2
AT_HWCAP3
Expand Down Expand Up @@ -1705,6 +1708,7 @@ MAP_STACK
MAP_TYPE
MAXTTL
MAX_ADDR_LEN
MAX_HANDLE_SZ
MAX_IPOPTLEN
MAX_LINKS
MCAST_BLOCK_SOURCE
Expand Down Expand Up @@ -4026,6 +4030,7 @@ ff_trigger
fgetpos64
fgetxattr
file_clone_range
file_handle
flistxattr
fmemopen
fopen64
Expand Down Expand Up @@ -4189,6 +4194,7 @@ msgrcv
msgsnd
msqid_ds
name_t
name_to_handle_at
newlocale
nice
nl_item
Expand All @@ -4203,6 +4209,7 @@ nlmsghdr
nrand48
off64_t
open64
open_by_handle_at
open_how
open_memstream
openat
Expand Down
22 changes: 22 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,14 @@ s! {
pub sched_deadline: crate::__u64,
pub sched_period: crate::__u64,
}

// linux/fcntl.h

pub struct file_handle {
pub handle_bytes: c_uint,
pub handle_type: c_int,
pub f_handle: [c_uchar; 0],
}
}

cfg_if! {
Expand Down Expand Up @@ -1398,6 +1406,11 @@ pub const IFF_ECHO: c_int = 0x40000;
// linux/fcntl.h
pub const AT_EXECVE_CHECK: c_int = 0x10000;

pub const MAX_HANDLE_SZ: c_int = 128;
pub const AT_HANDLE_FID: c_int = 0x200;
pub const AT_HANDLE_MNT_ID_UNIQUE: c_int = 0x001;
pub const AT_HANDLE_CONNECTABLE: c_int = 0x002;

// linux/if_addr.h
pub const IFA_UNSPEC: c_ushort = 0;
pub const IFA_ADDRESS: c_ushort = 1;
Expand Down Expand Up @@ -4366,6 +4379,15 @@ extern "C" {
pub fn gethostid() -> c_long;

pub fn klogctl(syslog_type: c_int, bufp: *mut c_char, len: c_int) -> c_int;

pub fn name_to_handle_at(
dirfd: c_int,
path: *const c_char,
handle: *mut file_handle,
mount_id: *mut c_int,
flags: c_int,
) -> c_int;
pub fn open_by_handle_at(mount_fd: c_int, handle: *mut file_handle, flags: c_int) -> c_int;
}

// LFS64 extensions
Expand Down