Skip to content

Commit

Permalink
feat: add new struct definitions from fanotify linux api
Browse files Browse the repository at this point in the history
  • Loading branch information
ad0 committed Nov 20, 2023
1 parent 4ac74f5 commit 6337752
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ MAP_STACK
MAP_TYPE
MAXTTL
MAX_ADDR_LEN
MAX_HANDLE_SZ
MAX_IPOPTLEN
MCAST_BLOCK_SOURCE
MCAST_EXCLUDE
Expand Down Expand Up @@ -3435,10 +3436,16 @@ execvpe
faccessat
fallocate
fallocate64
fanotify_event_info_error
fanotify_event_info_fid
fanotify_event_info_header
fanotify_event_info_pidfd
fanotify_event_metadata
fanotify_init
fanotify_mark
fanotify_response
fanotify_response_info_header
fanotify_response_info_audit_rule
fchdir
fdatasync
fdopendir
Expand Down
41 changes: 40 additions & 1 deletion src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,45 @@ s! {
pub len: u32
}

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

pub struct fanotify_event_info_fid {
pub hdr: fanotify_event_info_header,
pub fsid: ::fsid_t,
pub handle: [::c_uchar; ::MAX_HANDLE_SZ],
}

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,
}

pub struct fanotify_response {
pub fd: ::c_int,
pub response: __u32,
pub response: ::__u32,
}

pub struct fanotify_response_info_header {
pub type_: ::__u8,
pub pad: ::__u8,
pub len: ::__u16,
}

pub struct fanotify_response_info_audit_rule {
pub hdr: fanotify_response_info_header,
pub rule_number: ::__u32,
pub subj_trust: ::__u32,
pub obj_trust: ::__u32,
}

pub struct sockaddr_vm {
Expand Down Expand Up @@ -3958,6 +3994,9 @@ pub const SND_CNT: usize = SND_MAX as usize + 1;
pub const UINPUT_VERSION: ::c_uint = 5;
pub const UINPUT_MAX_NAME_SIZE: usize = 80;

// linux/exportfs.h
pub const MAX_HANDLE_SZ: usize = 128;

// uapi/linux/fanotify.h
pub const FAN_ACCESS: u64 = 0x0000_0001;
pub const FAN_MODIFY: u64 = 0x0000_0002;
Expand Down

0 comments on commit 6337752

Please sign in to comment.