Skip to content

Commit d9c6f5a

Browse files
committed
adding a handful of linux fanotify data types.
close #3688
1 parent 8b9d1fe commit d9c6f5a

File tree

6 files changed

+37
-1
lines changed

6 files changed

+37
-1
lines changed

libc-test/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4324,7 +4324,11 @@ fn test_linux(target: &str) {
43244324
// the `ifr_ifrn` field is an anonymous union
43254325
(struct_ == "iwreq" && field == "ifr_ifrn") ||
43264326
// the `key` field is a zero-sized array
4327-
(struct_ == "iw_encode_ext" && field == "key")
4327+
(struct_ == "iw_encode_ext" && field == "key") ||
4328+
// either fsid_t or int[2] type
4329+
(struct_ == "fanotify_event_info_fid" && field == "fsid")
4330+
// `handle` is a VLA
4331+
(struct_ == "fanotify_event_info_fid" && field == "handle")
43284332
});
43294333

43304334
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
@@ -617,6 +617,8 @@ dlinfo
617617
dlmopen
618618
endutxent
619619
explicit_bzero
620+
fanotify_event_info_error
621+
fanotify_event_info_pidfd
620622
fgetgrent_r
621623
fgetspent_r
622624
futimes

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,6 +3509,7 @@ execvpe
35093509
faccessat
35103510
fallocate
35113511
fallocate64
3512+
fanotify_event_info_fid
35123513
fanotify_event_metadata
35133514
fanotify_init
35143515
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;
@@ -589,6 +590,10 @@ s! {
589590
pub r_info: Elf64_Xword,
590591
}
591592

593+
pub struct __c_anonymous__kernel_fsid_t {
594+
pub val: [::c_int; 2],
595+
}
596+
592597
pub struct ucred {
593598
pub pid: ::pid_t,
594599
pub uid: ::uid_t,
@@ -656,6 +661,12 @@ s! {
656661
pub response: __u32,
657662
}
658663

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

0 commit comments

Comments
 (0)