summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-10 20:43:22 +0000
committerbors <bors@rust-lang.org>2022-04-10 20:43:22 +0000
commitc25369946c6dd0db4052dfeec8add37c1015236d (patch)
tree8f2eb0b5fd20420344a0a5d11f4e53fe743274c0
parent5987128633b6a74c8bcf9cb407864e374143e6aa (diff)
parent1d5136a6bb25090d3db6e439228ec7889f3039fd (diff)
downloadrust-libc-c25369946c6dd0db4052dfeec8add37c1015236d.tar.gz
Auto merge of #2744 - vityafx:add-pthread-functions-to-freebsd, r=Amanieu
Add pthread_set/get schedparam functions to FreeBSD. FreeBSD has these functions and this provides an interface to use them. In particular, the [`thread-priority`](https://github.com/vityafx/thread-priority/runs/5881232298) crate can't be built without those.
-rw-r--r--libc-test/semver/freebsd.txt2
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs10
2 files changed, 12 insertions, 0 deletions
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index 14f8aa7d7f..49a7df2e71 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -1726,6 +1726,8 @@ pthread_rwlockattr_getpshared
pthread_rwlockattr_setpshared
pthread_setaffinity_np
pthread_set_name_np
+pthread_getschedparam
+pthread_setschedparam
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 95774d7121..b27a48448c 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -1595,6 +1595,16 @@ extern "C" {
pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int;
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_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 ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_char, data: ::c_int) -> ::c_int;
pub fn utrace(addr: *const ::c_void, len: ::size_t) -> ::c_int;
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;