summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2021-11-11 16:46:56 +0000
committerDavid Carlier <devnexen@gmail.com>2021-11-15 17:49:39 +0000
commit8bcbec216d0423e1f06e355bf3b10384a8e0bdc9 (patch)
treeb606460210c6d0a5aa820319f6f5448eaa9b747d
parent4f74e6eb8f6c638fd5500409b3e99b46a2e93b86 (diff)
downloadrust-libc-8bcbec216d0423e1f06e355bf3b10384a8e0bdc9.tar.gz
freebsd add vmtotal sysctl query
-rw-r--r--libc-test/build.rs6
-rw-r--r--libc-test/semver/freebsd.txt2
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs20
3 files changed, 28 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 832e9b83b9..34a7261104 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1865,6 +1865,7 @@ fn test_freebsd(target: &str) {
"sys/user.h",
"sys/utsname.h",
"sys/uuid.h",
+ "sys/vmmeter.h",
"sys/wait.h",
"libprocstat.h",
"syslog.h",
@@ -2053,6 +2054,8 @@ fn test_freebsd(target: &str) {
// Added in in FreeBSD 13.0 (r367776 and r367287)
"SCM_CREDS2" | "LOCAL_CREDS_PERSISTENT" if Some(13) > freebsd_ver => true,
+ "VM_TOTAL" if Some(11) == freebsd_ver => true,
+
_ => false,
}
});
@@ -2084,6 +2087,9 @@ fn test_freebsd(target: &str) {
// `ptrace_sc_ret` is not available in FreeBSD 11
"ptrace_sc_ret" if Some(11) == freebsd_ver => true,
+ // obsolete version
+ "vmtotal" if Some(11) == freebsd_ver => true,
+
_ => false,
}
});
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index e2b9aa8315..ba95e035c3 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -1249,6 +1249,7 @@ VDISCARD
VDSUSP
VERASE2
VLNEXT
+VM_TOTAL
VSTATUS
VREPRINT
VWERASE
@@ -1808,6 +1809,7 @@ utimensat
utmpx
utrace
vm_size_t
+vmtotal
wait4
waitid
xallocx
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 0374ff5edc..3f255ec524 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -462,6 +462,24 @@ s! {
pub sem_otime: ::time_t,
pub sem_ctime: ::time_t,
}
+
+ pub struct vmtotal {
+ pub t_vm: u64,
+ pub t_avm: u64,
+ pub t_rm: u64,
+ pub t_arm: u64,
+ pub t_vmshr: u64,
+ pub t_avmshr: u64,
+ pub t_rmshr: u64,
+ pub t_armshr: u64,
+ pub t_free: u64,
+ pub t_rq: i16,
+ pub t_dw: i16,
+ pub t_pw: i16,
+ pub t_sl: i16,
+ pub t_sw: i16,
+ pub t_pad: [u16; 3],
+ }
}
s_no_extra_traits! {
@@ -1080,6 +1098,8 @@ pub const TIOCSIG: ::c_uint = 0x2004745f;
pub const TIOCM_DCD: ::c_int = 0x40;
pub const H4DISC: ::c_int = 0x7;
+pub const VM_TOTAL: ::c_int = 1;
+
pub const BIOCSETFNR: ::c_ulong = 0x80104282;
pub const FIODGNAME: ::c_ulong = 0x80106678;