summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2022-01-14 15:36:21 +0000
committerDavid CARLIER <devnexen@gmail.com>2022-01-26 16:12:41 +0000
commitd00987d3a6926615ddf6e65f9e1ea9f28595691f (patch)
tree5f2fc1d6deb7322d963fb90dd1bd3c596b8193f9
parent526cb13a673aa90e1575b4aa5c49bc91957bc0d1 (diff)
downloadrust-libc-d00987d3a6926615ddf6e65f9e1ea9f28595691f.tar.gz
freebsd audit api introduction.
-rw-r--r--libc-test/build.rs1
-rw-r--r--libc-test/semver/freebsd.txt6
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs20
3 files changed, 27 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 4fd9e8b7f3..ec063e9bf9 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -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",
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index 4772415cda..06878e8577 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -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
@@ -1754,6 +1759,7 @@ semop
sendfile
sendmmsg
sendmsg
+setaudit
setdomainname
setgrent
setgroups
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 251f236c58..a0074468c6 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -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;
@@ -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! {
@@ -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")]