From 3d0a7aad4d83823cb8bbfc8fd22e64694f9aacb0 Mon Sep 17 00:00:00 2001 From: auronandace Date: Sun, 10 May 2026 15:21:19 +0100 Subject: [PATCH] remove sys_types from sched header --- src/header/sched/cbindgen.toml | 14 ++++++++++---- src/header/sched/mod.rs | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/header/sched/cbindgen.toml b/src/header/sched/cbindgen.toml index b361fa4531..f238b93f25 100644 --- a/src/header/sched/cbindgen.toml +++ b/src/header/sched/cbindgen.toml @@ -1,14 +1,17 @@ # POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sched.h.html # # Spec quotations relating to includes: -# - "[PS] The header shall define the pid_t type as described in ." -# - "[SS|TSP] The header shall define the time_t type as described in ." +# - "The header shall define the pid_t type as described in ." +# - "The header shall define the time_t type as described in ." # - "The header shall define the timespec structure as described in ." # - "Inclusion of the header may make visible all symbols from the header." -sys_includes = ["sys/types.h"] +# +# bits/timespec.h brings in time_t +sys_includes = [] include_guard = "_RELIBC_SCHED_H" after_includes = """ -#include // for timespec +#include // for pid_t from sys/types +#include // for timespec from time.h """ language = "C" style = "Tag" @@ -18,5 +21,8 @@ cpp_compat = true [enum] prefix_with_name = true +[export] +include = ["sched_param"] + [export.rename] "timespec" = "struct timespec" diff --git a/src/header/sched/mod.rs b/src/header/sched/mod.rs index f72f213791..4923498f96 100644 --- a/src/header/sched/mod.rs +++ b/src/header/sched/mod.rs @@ -13,17 +13,27 @@ use crate::{ // TODO: There are extensions, but adding more member is breaking ABI for pthread_attr_t /// See . +/// +/// Scheduling parameters required for each supported scheduling policy. +#[allow(non_camel_case_types)] #[repr(C)] #[derive(Clone, Copy, Debug)] pub struct sched_param { + /// Process or thread execution scheduling priority. pub sched_priority: c_int, } /// See . +/// +/// First in first out (FIFO) scheduling policy. pub const SCHED_FIFO: c_int = 0; /// See . +/// +/// Round robin scheduling policy. pub const SCHED_RR: c_int = 1; /// See . +/// +/// Another scheduling policy. pub const SCHED_OTHER: c_int = 2; /// See . @@ -67,10 +77,10 @@ pub extern "C" fn sched_setscheduler( } /// See . +/// +/// Force the running thread to relinquish the processor until it again +/// becomes the head of its thread list. #[unsafe(no_mangle)] pub extern "C" fn sched_yield() -> c_int { Sys::sched_yield().map(|()| 0).or_minus_one_errno() } - -#[unsafe(no_mangle)] -pub unsafe extern "C" fn cbindgen_stupid_struct_user_for_sched_param(_: sched_param) {}