Skip to content

Commit 96bb2f7

Browse files
committed
adding a handful of linux fanotify data types.
close #3688
1 parent bcd5546 commit 96bb2f7

File tree

6 files changed

+40
-2
lines changed

6 files changed

+40
-2
lines changed

libc-test/build.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3615,7 +3615,9 @@ fn test_linux(target: &str) {
36153615
return true;
36163616
}
36173617
// FIXME: sparc64 CI has old headers
3618-
if sparc64 && (ty == "uinput_ff_erase" || ty == "uinput_abs_setup") {
3618+
if sparc64
3619+
&& (ty == "uinput_ff_erase" || ty == "uinput_abs_setup" || "fanotify_event_info_error")
3620+
{
36193621
return true;
36203622
}
36213623
// FIXME(https://github.com/rust-lang/libc/issues/1558): passing by
@@ -4369,7 +4371,11 @@ fn test_linux(target: &str) {
43694371
// the `ifr_ifrn` field is an anonymous union
43704372
(struct_ == "iwreq" && field == "ifr_ifrn") ||
43714373
// the `key` field is a zero-sized array
4372-
(struct_ == "iw_encode_ext" && field == "key")
4374+
(struct_ == "iw_encode_ext" && field == "key") ||
4375+
// either fsid_t or int[2] type
4376+
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
4377+
// `handle` is a VLA
4378+
(struct_ == "fanotify_event_info_fid" && field == "handle")
43734379
});
43744380

43754381
cfg.skip_roundtrip(move |s| match s {

libc-test/semver/linux-gnu.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,8 @@ dlinfo
621621
dlmopen
622622
endutxent
623623
explicit_bzero
624+
fanotify_event_info_error
625+
fanotify_event_info_pidfd
624626
fgetgrent_r
625627
fgetspent_r
626628
futimes

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3537,6 +3537,7 @@ execvpe
35373537
faccessat
35383538
fallocate
35393539
fallocate64
3540+
fanotify_event_info_fid
35403541
fanotify_event_metadata
35413542
fanotify_init
35423543
fanotify_mark

src/unix/linux_like/linux/align.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ macro_rules! expand_align {
6363
pub fd: ::c_int,
6464
pub pid: ::c_int,
6565
}
66+
67+
#[repr(align(2))]
68+
pub struct fanotify_event_info_header {
69+
pub info_type: __u8,
70+
pub pad: __u8,
71+
pub len: __u16,
72+
}
6673
}
6774

6875
s_no_extra_traits! {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,17 @@ s! {
453453
pub aio_flags: ::__u32,
454454
pub aio_resfd: ::__u32,
455455
}
456+
457+
pub struct fanotify_event_info_pidfd {
458+
pub hdr: ::fanotify_event_info_header,
459+
pub pidfd: ::__s32,
460+
}
461+
462+
pub struct fanotify_event_info_error {
463+
pub hdr: ::fanotify_event_info_header,
464+
pub error: ::__s32,
465+
pub error_count: ::__u32,
466+
}
456467
}
457468

458469
impl siginfo_t {

src/unix/linux_like/linux/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub type loff_t = ::c_longlong;
1616
pub type pthread_key_t = ::c_uint;
1717
pub type pthread_once_t = ::c_int;
1818
pub type pthread_spinlock_t = ::c_int;
19+
pub type __kernel_fsid_t = __c_anonymous__kernel_fsid_t;
1920

2021
pub type __u8 = ::c_uchar;
2122
pub type __u16 = ::c_ushort;
@@ -590,6 +591,10 @@ s! {
590591
pub r_info: Elf64_Xword,
591592
}
592593

594+
pub struct __c_anonymous__kernel_fsid_t {
595+
pub val: [::c_int; 2],
596+
}
597+
593598
pub struct ucred {
594599
pub pid: ::pid_t,
595600
pub uid: ::uid_t,
@@ -657,6 +662,12 @@ s! {
657662
pub response: __u32,
658663
}
659664

665+
pub struct fanotify_event_info_fid {
666+
pub hdr: fanotify_event_info_header,
667+
pub fsid: ::__kernel_fsid_t,
668+
pub handle: [::c_uchar; 0],
669+
}
670+
660671
pub struct sockaddr_vm {
661672
pub svm_family: ::sa_family_t,
662673
pub svm_reserved1: ::c_ushort,

0 commit comments

Comments
 (0)