Skip to content

Commit

Permalink
freebsd audit api introduction.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Jan 26, 2022
1 parent 526cb13 commit d00987d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1802,6 +1802,7 @@ fn test_freebsd(target: &str) {
headers! { cfg:
"aio.h",
"arpa/inet.h",
"bsm/audit.h",
"ctype.h",
"dirent.h",
"dlfcn.h",
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,11 @@ arc4random_buf
arc4random_uniform
arphdr
atof
au_asid_t
au_id_t
au_mask_t
au_tid_t
auditinfo_t
backtrace
backtrace_symbols
backtrace_symbols_fd
Expand Down Expand Up @@ -1754,6 +1759,7 @@ semop
sendfile
sendmmsg
sendmsg
setaudit
setdomainname
setgrent
setgroups
Expand Down
20 changes: 20 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ pub type caddr_t = *mut ::c_char;

pub type fhandle_t = fhandle;

pub type au_id_t = ::uid_t;
pub type au_asid_t = ::pid_t;

// It's an alias over "struct __kvm_t". However, its fields aren't supposed to be used directly,
// making the type definition system dependent. Better not bind it exactly.
pub type kvm_t = ::c_void;
Expand Down Expand Up @@ -967,6 +970,22 @@ s! {
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
}

pub struct au_mask_t {
pub am_success: ::c_uint,
pub am_failure: ::c_uint,
}

pub struct au_tid_t {
pub port: u32,
pub machine: u32,
}

pub struct auditinfo_t {
pub ai_auid: ::au_id_t,
pub ai_mask: ::au_mask_t,
pub ai_termid: au_tid_t,
pub ai_asid: ::au_asid_t,
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -4182,6 +4201,7 @@ extern "C" {
flags: ::c_int,
) -> ::c_int;
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int;
}

#[link(name = "kvm")]
Expand Down

0 comments on commit d00987d

Please sign in to comment.