Skip to content

Commit bcc77f9

Browse files
devnexentgross35
authored andcommitted
adding a handful of linux fanotify data types.
close #3688 (backport <#3695>) (cherry picked from commit 7b338f9)
1 parent a5adc5f commit bcc77f9

File tree

5 files changed

+51
-2
lines changed

5 files changed

+51
-2
lines changed

libc-test/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3746,6 +3746,9 @@ fn test_linux(target: &str) {
37463746
if musl && ty == "fanout_args" {
37473747
return true;
37483748
}
3749+
if sparc64 && ty == "fanotify_event_info_error" {
3750+
return true;
3751+
}
37493752

37503753
match ty {
37513754
// These cannot be tested when "resolv.h" is included and are tested
@@ -4490,7 +4493,11 @@ fn test_linux(target: &str) {
44904493
// the `tcpi_delivery_rate_app_limited` field is a bitfield on musl
44914494
(musl && struct_ == "tcp_info" && field == "tcpi_delivery_rate_app_limited") ||
44924495
// the `tcpi_fast_open_client_fail` field is a bitfield on musl
4493-
(musl && struct_ == "tcp_info" && field == "tcpi_fast_open_client_fail")
4496+
(musl && struct_ == "tcp_info" && field == "tcpi_fast_open_client_fail") ||
4497+
// either fsid_t or int[2] type
4498+
(struct_ == "fanotify_event_info_fid" && field == "fsid") ||
4499+
// `handle` is a VLA
4500+
(struct_ == "fanotify_event_info_fid" && field == "handle")
44944501
});
44954502

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

libc-test/semver/linux-gnu.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,15 @@ dlinfo
628628
dlmopen
629629
endutxent
630630
explicit_bzero
631+
fanotify_event_info_error
632+
fanotify_event_info_header
633+
fanotify_event_info_pidfd
634+
fgetgrent_r
631635
fgetspent_r
632636
futimes
633637
getauxval
634638
getentropy
635639
getgrent_r
636-
fgetgrent_r
637640
getloadavg
638641
getpt
639642
getpwent_r

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3497,6 +3497,7 @@ execvpe
34973497
faccessat
34983498
fallocate
34993499
fallocate64
3500+
fanotify_event_info_fid
35003501
fanotify_event_metadata
35013502
fanotify_init
35023503
fanotify_mark

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,17 @@ s! {
492492
pub tcpi_rcv_space: u32,
493493
pub tcpi_total_retrans: u32,
494494
}
495+
496+
pub struct fanotify_event_info_pidfd {
497+
pub hdr: ::fanotify_event_info_header,
498+
pub pidfd: ::__s32,
499+
}
500+
501+
pub struct fanotify_event_info_error {
502+
pub hdr: ::fanotify_event_info_header,
503+
pub error: ::__s32,
504+
pub error_count: ::__u32,
505+
}
495506
}
496507

497508
impl siginfo_t {

src/unix/linux_like/linux/mod.rs

Lines changed: 27 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;
@@ -548,6 +549,20 @@ s! {
548549
pub sh_entsize: Elf64_Xword,
549550
}
550551

552+
pub struct __c_anonymous_elf32_rel {
553+
pub r_offset: Elf32_Addr,
554+
pub r_info: Elf32_Word,
555+
}
556+
557+
pub struct __c_anonymous_elf64_rel {
558+
pub r_offset: Elf64_Addr,
559+
pub r_info: Elf64_Xword,
560+
}
561+
562+
pub struct __c_anonymous__kernel_fsid_t {
563+
pub val: [::c_int; 2],
564+
}
565+
551566
pub struct ucred {
552567
pub pid: ::pid_t,
553568
pub uid: ::uid_t,
@@ -615,6 +630,18 @@ s! {
615630
pub response: __u32,
616631
}
617632

633+
pub struct fanotify_event_info_header {
634+
pub info_type: __u8,
635+
pub pad: __u8,
636+
pub len: __u16,
637+
}
638+
639+
pub struct fanotify_event_info_fid {
640+
pub hdr: fanotify_event_info_header,
641+
pub fsid: ::__kernel_fsid_t,
642+
pub handle: [::c_uchar; 0],
643+
}
644+
618645
pub struct sockaddr_vm {
619646
pub svm_family: ::sa_family_t,
620647
pub svm_reserved1: ::c_ushort,

0 commit comments

Comments
 (0)