Skip to content

Commit ed98881

Browse files
committed
adding a handful of linux fanotify data types.
close #3688
1 parent cdf6896 commit ed98881

File tree

5 files changed

+40
-1
lines changed

5 files changed

+40
-1
lines changed

libc-test/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3682,6 +3682,9 @@ fn test_linux(target: &str) {
36823682
if musl && ty == "fanout_args" {
36833683
return true;
36843684
}
3685+
if sparc64 && ty == "fanotify_event_info_error" {
3686+
return true;
3687+
}
36853688

36863689
match ty {
36873690
// These cannot be tested when "resolv.h" is included and are tested
@@ -4425,7 +4428,11 @@ fn test_linux(target: &str) {
44254428
// the `ifr_ifrn` field is an anonymous union
44264429
(struct_ == "iwreq" && field == "ifr_ifrn") ||
44274430
// the `key` field is a zero-sized array
4428-
(struct_ == "iw_encode_ext" && field == "key")
4431+
(struct_ == "iw_encode_ext" && field == "key") ||
4432+
// either fsid_t or int[2] type
4433+
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
4434+
// `handle` is a VLA
4435+
(struct_ == "fanotify_event_info_fid" && field == "handle")
44294436
});
44304437

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

libc-test/semver/linux-gnu.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,9 @@ dlinfo
628628
dlmopen
629629
endutxent
630630
explicit_bzero
631+
fanotify_event_info_error
632+
fanotify_event_info_header
633+
fanotify_event_info_pidfd
631634
fgetgrent_r
632635
fgetspent_r
633636
futimes

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,6 +3540,7 @@ execvpe
35403540
faccessat
35413541
fallocate
35423542
fallocate64
3543+
fanotify_event_info_fid
35433544
fanotify_event_metadata
35443545
fanotify_init
35453546
fanotify_mark

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: 17 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,18 @@ s! {
657662
pub response: __u32,
658663
}
659664

665+
pub struct fanotify_event_info_header {
666+
pub info_type: __u8,
667+
pub pad: __u8,
668+
pub len: __u16,
669+
}
670+
671+
pub struct fanotify_event_info_fid {
672+
pub hdr: fanotify_event_info_header,
673+
pub fsid: ::__kernel_fsid_t,
674+
pub handle: [::c_uchar; 0],
675+
}
676+
660677
pub struct sockaddr_vm {
661678
pub svm_family: ::sa_family_t,
662679
pub svm_reserved1: ::c_ushort,

0 commit comments

Comments
 (0)