Skip to content

Commit a79788f

Browse files
committed
Auto merge of #2627 - devnexen:audit_fbsd_intro, r=Amanieu
freebsd audit api introduction.
2 parents 526cb13 + d00987d commit a79788f

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

libc-test/build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,7 @@ fn test_freebsd(target: &str) {
18021802
headers! { cfg:
18031803
"aio.h",
18041804
"arpa/inet.h",
1805+
"bsm/audit.h",
18051806
"ctype.h",
18061807
"dirent.h",
18071808
"dlfcn.h",

libc-test/semver/freebsd.txt

+6
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,11 @@ arc4random_buf
14161416
arc4random_uniform
14171417
arphdr
14181418
atof
1419+
au_asid_t
1420+
au_id_t
1421+
au_mask_t
1422+
au_tid_t
1423+
auditinfo_t
14191424
backtrace
14201425
backtrace_symbols
14211426
backtrace_symbols_fd
@@ -1754,6 +1759,7 @@ semop
17541759
sendfile
17551760
sendmmsg
17561761
sendmsg
1762+
setaudit
17571763
setdomainname
17581764
setgrent
17591765
setgroups

src/unix/bsd/freebsdlike/freebsd/mod.rs

+20
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ pub type caddr_t = *mut ::c_char;
4141

4242
pub type fhandle_t = fhandle;
4343

44+
pub type au_id_t = ::uid_t;
45+
pub type au_asid_t = ::pid_t;
46+
4447
// It's an alias over "struct __kvm_t". However, its fields aren't supposed to be used directly,
4548
// making the type definition system dependent. Better not bind it exactly.
4649
pub type kvm_t = ::c_void;
@@ -967,6 +970,22 @@ s! {
967970
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
968971
}
969972

973+
pub struct au_mask_t {
974+
pub am_success: ::c_uint,
975+
pub am_failure: ::c_uint,
976+
}
977+
978+
pub struct au_tid_t {
979+
pub port: u32,
980+
pub machine: u32,
981+
}
982+
983+
pub struct auditinfo_t {
984+
pub ai_auid: ::au_id_t,
985+
pub ai_mask: ::au_mask_t,
986+
pub ai_termid: au_tid_t,
987+
pub ai_asid: ::au_asid_t,
988+
}
970989
}
971990

972991
s_no_extra_traits! {
@@ -4182,6 +4201,7 @@ extern "C" {
41824201
flags: ::c_int,
41834202
) -> ::c_int;
41844203
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
4204+
pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int;
41854205
}
41864206

41874207
#[link(name = "kvm")]

0 commit comments

Comments
 (0)