Skip to content

Commit

Permalink
freebsd add numa domain api
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Oct 23, 2021
1 parent 71b2de4 commit 91810ce
Show file tree
Hide file tree
Showing 2 changed files with 30 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 @@ -1814,6 +1814,7 @@ fn test_freebsd(target: &str) {
"sys/capsicum.h",
[freebsdlast]:"sys/auxv.h",
"sys/cpuset.h",
[freebsdlast]:"sys/domainset.h",
"sys/event.h",
"sys/extattr.h",
"sys/file.h",
Expand Down
29 changes: 29 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub type ino_t = ::c_ulong;
pub type shmatt_t = ::c_uint;
pub type kpaddr_t = u64;
pub type kssize_t = i64;
pub type domainset_t = __c_anonymous_domainset;

s! {
pub struct shmid_ds {
Expand Down Expand Up @@ -49,6 +50,10 @@ s! {
pub kp_offset: ::off_t,
pub kp_len: ::size_t,
}

pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
}
}

s_no_extra_traits! {
Expand Down Expand Up @@ -222,6 +227,13 @@ pub const KF_TYPE_EVENTFD: ::c_int = 13;
pub const SPECNAMELEN: ::c_int = 255;
pub const KI_NSPARE_PTR: usize = 5;

/// domainset policies
pub const DOMAINSET_POLICY_INVALID: ::c_int = 0;
pub const DOMAINSET_POLICY_ROUNDROBIN: ::c_int = 1;
pub const DOMAINSET_POLICY_FIRSTTOUCH: ::c_int = 2;
pub const DOMAINSET_POLICY_PREFER: ::c_int = 3;
pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;

f! {
pub fn SOCKCRED2SIZE(ngrps: usize) -> usize {
let ngrps = if ngrps > 0 {
Expand Down Expand Up @@ -261,6 +273,23 @@ extern "C" {
pub fn setproctitle_fast(fmt: *const ::c_char, ...);
pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;

pub fn cpuset_getdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *mut ::domainset_t,
policy: *mut ::c_int,
) -> ::c_int;
pub fn cpuset_setdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *const ::domainset_t,
policy: ::c_int,
) -> ::c_int;
}

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

0 comments on commit 91810ce

Please sign in to comment.