Skip to content

Commit

Permalink
Merge pull request #3695 from devnexen/gh3688
Browse files Browse the repository at this point in the history
adding a handful of linux fanotify data types.
  • Loading branch information
tgross35 authored Sep 3, 2024
2 parents 2899529 + 7b338f9 commit 72c4000
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3700,6 +3700,9 @@ fn test_linux(target: &str) {
if musl && ty == "fanout_args" {
return true;
}
if sparc64 && ty == "fanotify_event_info_error" {
return true;
}

match ty {
// These cannot be tested when "resolv.h" is included and are tested
Expand Down Expand Up @@ -4449,7 +4452,11 @@ fn test_linux(target: &str) {
// the `tcpi_delivery_rate_app_limited` field is a bitfield on musl
(musl && struct_ == "tcp_info" && field == "tcpi_delivery_rate_app_limited") ||
// the `tcpi_fast_open_client_fail` field is a bitfield on musl
(musl && struct_ == "tcp_info" && field == "tcpi_fast_open_client_fail")
(musl && struct_ == "tcp_info" && field == "tcpi_fast_open_client_fail") ||
// either fsid_t or int[2] type
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
// `handle` is a VLA
(struct_ == "fanotify_event_info_fid" && field == "handle")
});

cfg.skip_roundtrip(move |s| match s {
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ dlinfo
dlmopen
endutxent
explicit_bzero
fanotify_event_info_error
fanotify_event_info_header
fanotify_event_info_pidfd
fgetgrent_r
fgetspent_r
futimes
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3540,6 +3540,7 @@ execvpe
faccessat
fallocate
fallocate64
fanotify_event_info_fid
fanotify_event_metadata
fanotify_init
fanotify_mark
Expand Down
11 changes: 11 additions & 0 deletions src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,17 @@ s! {
pub tcpi_rcv_space: u32,
pub tcpi_total_retrans: u32,
}

pub struct fanotify_event_info_pidfd {
pub hdr: ::fanotify_event_info_header,
pub pidfd: ::__s32,
}

pub struct fanotify_event_info_error {
pub hdr: ::fanotify_event_info_header,
pub error: ::__s32,
pub error_count: ::__u32,
}
}

impl siginfo_t {
Expand Down
17 changes: 17 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub type loff_t = ::c_longlong;
pub type pthread_key_t = ::c_uint;
pub type pthread_once_t = ::c_int;
pub type pthread_spinlock_t = ::c_int;
pub type __kernel_fsid_t = __c_anonymous__kernel_fsid_t;

pub type __u8 = ::c_uchar;
pub type __u16 = ::c_ushort;
Expand Down Expand Up @@ -590,6 +591,10 @@ s! {
pub r_info: Elf64_Xword,
}

pub struct __c_anonymous__kernel_fsid_t {
pub val: [::c_int; 2],
}

pub struct ucred {
pub pid: ::pid_t,
pub uid: ::uid_t,
Expand Down Expand Up @@ -657,6 +662,18 @@ s! {
pub response: __u32,
}

pub struct fanotify_event_info_header {
pub info_type: __u8,
pub pad: __u8,
pub len: __u16,
}

pub struct fanotify_event_info_fid {
pub hdr: fanotify_event_info_header,
pub fsid: ::__kernel_fsid_t,
pub handle: [::c_uchar; 0],
}

pub struct sockaddr_vm {
pub svm_family: ::sa_family_t,
pub svm_reserved1: ::c_ushort,
Expand Down

0 comments on commit 72c4000

Please sign in to comment.