yushuailong opened a new pull request, #20084:
URL: https://github.com/apache/nuttx/pull/20084
## Summary
- Fix the inverted replenishment period validation in sched_setparam().
- Validate sched_priority before modifying sporadic scheduler state.
- Centralize sporadic parameter validation and tick conversion.
- Apply consistent validation to sched_setparam(), sched_setscheduler(),
and pthread_create().
- Propagate scheduler setup failures from the spawn path.
The sched_setparam() validation condition was inverted during an earlier
refactoring, causing valid sporadic parameters to be rejected and invalid
parameters to be applied.
The sporadic parameter checks were also duplicated across several paths
and were inconsistent. In particular, pthread_create() did not validate
sched_ss_max_repl and did not enforce the scheduler implementation's 50 percent
duty-cycle restriction.
This change introduces nxsched_validate_sporadic() as the common
validation path. It also performs validation before modifying sporadic state,
preventing failed calls from leaving partially updated scheduling parameters or
timers.
## Impact
Bug fix only; no new features.
## Testing
- Host: macOS 26.6.2 ARM64, Apple Clang 21.0.0.
- Target: `sim:ostest` with `CONFIG_SCHED_SPORADIC=y`,
`CONFIG_SCHED_SPORADIC_MAXREPL=3`, and `CONFIG_PRIORITY_INHERITANCE=y`.
- Build: `make` completes successfully with `LD: nuttx`.
- Runtime: ran `./nuttx`; all enabled OSTest subtests completed without
assertions or unexpected errors.
- Static checks: `nxstyle`, `checkpatch`, and commit-message checks pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]