Skip to content

Commit

Permalink
Expose more thread bindings for NetBSD-like OSes.
Browse files Browse the repository at this point in the history
  • Loading branch information
iddm committed Mar 26, 2022
1 parent f00ea00 commit 0254cec
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2405,6 +2405,16 @@ extern "C" {
size: ::size_t,
set: *mut cpuset_t,
) -> ::c_int;
pub fn pthread_setschedparam(
native: ::pthread_t,
policy: ::c_int,
param: *const ::sched_param,
) -> ::c_int;
pub fn pthread_getschedparam(
native: ::pthread_t,
policy: *mut ::c_int,
param: *mut ::sched_param,
) -> ::c_int;

pub fn _cpuset_create() -> *mut cpuset_t;
pub fn _cpuset_destroy(set: *mut cpuset_t);
Expand Down
22 changes: 22 additions & 0 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ s! {
pub s_addr: ::in_addr_t,
}

pub struct sched_param {
pub sched_priority: ::c_int,
}

pub struct sockaddr_in {
pub sin_len: u8,
pub sin_family: ::sa_family_t,
Expand Down Expand Up @@ -1604,6 +1608,24 @@ extern "C" {
pub fn pthread_get_name_np(tid: ::pthread_t, name: *mut ::c_char, len: ::size_t);
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
pub fn pthread_stackseg_np(thread: ::pthread_t, sinfo: *mut ::stack_t) -> ::c_int;
pub fn pthread_setschedparam(
native: ::pthread_t,
policy: ::c_int,
param: *const ::sched_param,
) -> ::c_int;
pub fn pthread_getschedparam(
native: ::pthread_t,
policy: *mut ::c_int,
param: *mut ::sched_param,
) -> ::c_int;
pub fn sched_setparam(pid: ::pid_t, param: *const sched_param) -> ::c_int;
pub fn sched_getparam(pid: ::pid_t, param: *mut sched_param) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
pub fn sched_setscheduler(
pid: ::pid_t,
policy: ::c_int,
param: *const ::sched_param,
) -> ::c_int;

pub fn sysctl(
name: *const ::c_int,
Expand Down

0 comments on commit 0254cec

Please sign in to comment.