Auto merge of #2998 - devnexen:memstat_fbsd_api, r=JohnTitor

freebsd subset of memstat api addition
This commit is contained in:
bors 2022-11-19 10:13:14 +00:00
commit cea201b12f
3 changed files with 38 additions and 0 deletions

View file

@ -1897,6 +1897,7 @@ fn test_freebsd(target: &str) {
"machine/elf.h",
"machine/reg.h",
"malloc_np.h",
"memstat.h",
"mqueue.h",
"net/bpf.h",
"net/if.h",
@ -2256,6 +2257,10 @@ fn test_freebsd(target: &str) {
// `shm_largepage_conf` was introduced in FreeBSD 13.
"shm_largepage_conf" if Some(13) > freebsd_ver => true,
// Those are private types
"memory_type" => true,
"memory_type_list" => true,
_ => false,
}
});

View file

@ -1670,6 +1670,14 @@ mallocx
memmem
memrchr
memset_s
memstat_get_name
memstat_mtl_alloc
memstat_mtl_find
memstat_mtl_first
memstat_mtl_free
memstat_mtl_geterror
memstat_mtl_next
memstat_strerror
mincore
mkdirat
mkfifoat

View file

@ -998,6 +998,15 @@ s! {
pub alloc_policy: ::c_int,
__pad: [::c_int; 10],
}
pub struct memory_type {
__priva: [::uintptr_t; 32],
__privb: [::uintptr_t; 26],
}
pub struct memory_type_list {
__priv: [::uintptr_t; 2],
}
}
s_no_extra_traits! {
@ -4369,6 +4378,22 @@ extern "C" {
) -> ::c_int;
}
#[link(name = "memstat")]
extern "C" {
pub fn memstat_strerror(error: ::c_int) -> *const ::c_char;
pub fn memstat_mtl_alloc() -> *mut memory_type_list;
pub fn memstat_mtl_first(list: *mut memory_type_list) -> *mut memory_type;
pub fn memstat_mtl_next(mtp: *mut memory_type) -> *mut memory_type;
pub fn memstat_mtl_find(
list: *mut memory_type_list,
allocator: ::c_int,
name: *const ::c_char,
) -> *mut memory_type;
pub fn memstat_mtl_free(list: *mut memory_type_list);
pub fn memstat_mtl_geterror(list: *mut memory_type_list) -> ::c_int;
pub fn memstat_get_name(mtp: *const memory_type) -> *const ::c_char;
}
#[link(name = "kvm")]
extern "C" {
pub fn kvm_dpcpu_setcpu(kd: *mut ::kvm_t, cpu: ::c_uint) -> ::c_int;