nuttx/sched/pthread
yushuailong 4a34293263 sched: Centralize sporadic parameter validation
Sporadic scheduling parameters are processed independently by sched_setparam(), sched_setscheduler(), and pthread_create(). The three paths currently validate different subsets of the parameters.

In particular, pthread_create() does not validate sched_ss_max_repl and only requires the replenishment period to be greater than the budget, while the scheduler interfaces enforce the implementation's 50 percent duty-cycle limit.

Add nxsched_validate_sporadic() to validate the common parameters and convert the replenishment period and budget to ticks. Use it from all paths that directly initialize or update sporadic scheduler state.

Express the duty-cycle check using division to avoid overflow when doubling a clock_t value.

Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
2026-09-13 10:29:49 +08:00
..
CMakeLists.txt pthread: move pthread_cond to userspace 2026-01-26 16:26:39 +08:00
Make.defs pthread: move pthread_cond to userspace 2026-01-26 16:26:39 +08:00
pthread.h pthread: move pthread_cond to userspace 2026-01-26 16:26:39 +08:00
pthread_cancel.c pthread_cleanup: move clenup down to tls 2024-09-14 20:15:12 +08:00
pthread_completejoin.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_create.c sched: Centralize sporadic parameter validation 2026-09-13 10:29:49 +08:00
pthread_detach.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_exit.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_findjoininfo.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_getaffinity.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_getschedparam.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_join.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_release.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_setaffinity.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_setschedparam.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pthread_setschedprio.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
pthread_sigmask.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00