From 1d5136a6bb25090d3db6e439228ec7889f3039fd Mon Sep 17 00:00:00 2001 From: Victor Polevoy Date: Sat, 9 Apr 2022 18:23:35 +0200 Subject: [PATCH] Add pthread_set/get schedparam functions to FreeBSD. FreeBSD has these functions and this provides an interface to use them. --- libc-test/semver/freebsd.txt | 2 ++ src/unix/bsd/freebsdlike/mod.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 581a651f70f3..acff9013865f 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1724,6 +1724,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 d9380bdc45f8..4300c5280916 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1594,6 +1594,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;