From 0e5a4fb302aafc1b1a0677b7ffb7eb57d8cea9ab Mon Sep 17 00:00:00 2001 From: joboet Date: Sat, 3 Jan 2026 11:46:06 +0100 Subject: [PATCH] std: remove manual bindings on NetBSD --- .../std/src/sys/pal/unix/thread_parking.rs | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/library/std/src/sys/pal/unix/thread_parking.rs b/library/std/src/sys/pal/unix/thread_parking.rs index bef8b4fb36391..6c3d04ceab213 100644 --- a/library/std/src/sys/pal/unix/thread_parking.rs +++ b/library/std/src/sys/pal/unix/thread_parking.rs @@ -2,24 +2,11 @@ // separate modules for each platform. #![cfg(target_os = "netbsd")] -use libc::{_lwp_self, CLOCK_MONOTONIC, c_long, clockid_t, lwpid_t, time_t, timespec}; +use libc::{_lwp_park, _lwp_self, _lwp_unpark, CLOCK_MONOTONIC, c_long, lwpid_t, time_t, timespec}; -use crate::ffi::{c_int, c_void}; use crate::ptr; use crate::time::Duration; -unsafe extern "C" { - fn ___lwp_park60( - clock_id: clockid_t, - flags: c_int, - ts: *mut timespec, - unpark: lwpid_t, - hint: *const c_void, - unparkhint: *const c_void, - ) -> c_int; - fn _lwp_unpark(lwp: lwpid_t, hint: *const c_void) -> c_int; -} - pub type ThreadId = lwpid_t; #[inline] @@ -30,7 +17,7 @@ pub fn current() -> ThreadId { #[inline] pub fn park(hint: usize) { unsafe { - ___lwp_park60(0, 0, ptr::null_mut(), 0, ptr::without_provenance(hint), ptr::null()); + _lwp_park(0, 0, ptr::null_mut(), 0, ptr::without_provenance(hint), ptr::null_mut()); } } @@ -45,13 +32,13 @@ pub fn park_timeout(dur: Duration, hint: usize) { // Timeout needs to be mutable since it is modified on NetBSD 9.0 and // above. unsafe { - ___lwp_park60( + _lwp_park( CLOCK_MONOTONIC, 0, &mut timeout, 0, ptr::without_provenance(hint), - ptr::null(), + ptr::null_mut(), ); } }