diff options
author | bors <bors@rust-lang.org> | 2021-06-07 23:39:24 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2021-06-07 23:39:24 +0000 |
commit | 0cffbc1bdf62671c1576696a5475d87a37371d82 (patch) | |
tree | 9957d2ba4a66e04efde3edd3994764625a87ed81 | |
parent | 858d54794163083d98f33f442d726e646969f756 (diff) | |
parent | 473ddd5ab831cf2afcd6303edf619b6daaf30c82 (diff) | |
download | rust-libc-0cffbc1bdf62671c1576696a5475d87a37371d82.tar.gz |
Auto merge of #2222 - devnexen:pthread_affinity_netbsd, r=JohnTitor
netbsd cpu affinity api
-rw-r--r-- | libc-test/semver/netbsd.txt | 8 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/mod.rs | 23 |
2 files changed, 31 insertions, 0 deletions
diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 408cd9cb4c..987813465d 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1009,6 +1009,12 @@ _UTX_USERSIZE __cpu_simple_lock_nv_t __errno __exit_status +_cpuset_clr +_cpuset_create +_cpuset_destroy +_cpuset_isset +_cpuset_set +_cpuset_zero _lwp_self abs accept4 @@ -1195,8 +1201,10 @@ pthread_attr_getstack pthread_cancel pthread_condattr_setclock pthread_getattr_np +pthread_getaffinity_np pthread_kill pthread_mutex_timedlock +pthread_setaffinity_np pthread_setname_np ptrace ptrace_io_desc diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 626b2cafd3..fdbd64aa76 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -10,6 +10,8 @@ type __pthread_spin_t = __cpu_simple_lock_nv_t; pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time pub type lwpid_t = ::c_uint; pub type shmatt_t = ::c_uint; +pub type cpuid_t = u64; +pub type cpuset_t = _cpuset; // elf.h @@ -429,6 +431,10 @@ s! { pub dlpi_tls_modid: usize, pub dlpi_tls_data: *mut ::c_void, } + + pub struct _cpuset { + bits: [u32; 0] + } } s_no_extra_traits! { @@ -2046,6 +2052,23 @@ extern "C" { stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t, ) -> ::c_int; + pub fn pthread_getaffinity_np( + thread: ::pthread_t, + size: ::size_t, + set: *mut cpuset_t, + ) -> ::c_int; + pub fn pthread_setaffinity_np( + thread: ::pthread_t, + size: ::size_t, + set: *mut cpuset_t, + ) -> ::c_int; + pub fn _cpuset_create() -> *mut cpuset_t; + pub fn _cpuset_destroy(set: *mut cpuset_t); + pub fn _cpuset_clr(cpu: cpuid_t, set: *mut cpuset_t) -> ::c_int; + pub fn _cpuset_set(cpu: cpuid_t, set: *mut cpuset_t) -> ::c_int; + pub fn _cpuset_isset(cpu: cpuid_t, set: *const cpuset_t) -> ::c_int; + pub fn _cpuset_size(set: *const cpuset_t) -> ::size_t; + pub fn _cpuset_zero(set: *mut cpuset_t); #[link_name = "__sigtimedwait50"] pub fn sigtimedwait( set: *const sigset_t, |