Repository navigation
syscall: Add pthread_sigqueue() to the system call table. - #21070
Merged
Merged
Conversation
pthread_sigqueue() is implemented in sched/pthread/pthread_sigqueue.c, but it has no system call entry: only libs/libc/libc.csv lists it. In a protected or kernel build, user programs that call pthread_sigqueue() fail to link. Add it to syscall.csv and syscall_lookup.h, and remove the libc.csv entry. The condition also needs !CONFIG_DISABLE_ALL_SIGNALS, because the implementation calls nxsig_dispatch(), which is built only with signals. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]>
casaroli
requested review from
Donny9,
pussuw,
xiaoxiang781216 and
yamt
as code owners
October 28, 2026 08:26
|
jerpelea
approved these changes
Oct 28, 2026
xiaoxiang781216
approved these changes
Oct 28, 2026
acassis
approved these changes
Oct 28, 2026
Swatantra-66
added a commit
to Swatantra-66/nuttx-apps
that referenced
this pull request
Oct 29, 2026
Add automated unit test for pthread_sigqueue() in ostest to verify signal and payload delivery to a target pthread. Tests error handling for invalid signal numbers and non-existent thread IDs, as well as successful signal dispatch and reception with SA_SIGINFO and SI_QUEUE. Now that pthread_sigqueue() is implemented as a system call (apache/nuttx#21070), the test runs across flat, protected, and kernel builds. Configurable via CONFIG_TESTING_OSTEST_PTHREAD_SIGQUEUE, enabled by default for non-small builds (!DEFAULT_SMALL) and gated by ENABLE_ALL_SIGNALS and !DISABLE_PTHREAD. Progress output and error messages are streamlined to minimize the flash footprint. Signed-off-by: Swatantra Yadav <[email protected]>
Swatantra-66
added a commit
to Swatantra-66/nuttx-apps
that referenced
this pull request
Oct 30, 2026
Add automated unit test for pthread_sigqueue() in ostest to verify signal and payload delivery to a target pthread. Tests error handling for invalid signal numbers and non-existent thread IDs, as well as successful signal dispatch and reception with SA_SIGINFO and SI_QUEUE. Now that pthread_sigqueue() is implemented as a system call (apache/nuttx#21070), the test runs across flat, protected, and kernel builds. Configurable via CONFIG_TESTING_OSTEST_PTHREAD_SIGQUEUE, enabled by default for non-small builds (!DEFAULT_SMALL) and gated by ENABLE_ALL_SIGNALS and !DISABLE_PTHREAD. Progress output and error messages are streamlined to minimize the flash footprint. Signed-off-by: Swatantra Yadav <[email protected]>
Swatantra-66
added a commit
to Swatantra-66/nuttx-apps
that referenced
this pull request
Nov 1, 2026
Add automated unit test for pthread_sigqueue() in ostest to verify signal and payload delivery to a target pthread. Tests error handling for invalid signal numbers and non-existent thread IDs, as well as successful signal dispatch and reception with SA_SIGINFO and SI_QUEUE. Now that pthread_sigqueue() is implemented as a system call (apache/nuttx#21070), the test runs across flat, protected, and kernel builds. Configurable via CONFIG_TESTING_OSTEST_PTHREAD_SIGQUEUE, enabled by default for non-small builds (!DEFAULT_SMALL) and gated by ENABLE_ALL_SIGNALS and !DISABLE_PTHREAD. Progress output and error messages are streamlined to minimize the flash footprint. Signed-off-by: Swatantra Yadav <[email protected]>
xiaoxiang781216
pushed a commit
to apache/nuttx-apps
that referenced
this pull request
Nov 3, 2026
Add automated unit test for pthread_sigqueue() in ostest to verify signal and payload delivery to a target pthread. Tests error handling for invalid signal numbers and non-existent thread IDs, as well as successful signal dispatch and reception with SA_SIGINFO and SI_QUEUE. Now that pthread_sigqueue() is implemented as a system call (apache/nuttx#21070), the test runs across flat, protected, and kernel builds. Configurable via CONFIG_TESTING_OSTEST_PTHREAD_SIGQUEUE, enabled by default for non-small builds (!DEFAULT_SMALL) and gated by ENABLE_ALL_SIGNALS and !DISABLE_PTHREAD. Progress output and error messages are streamlined to minimize the flash footprint. Signed-off-by: Swatantra Yadav <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pthread_sigqueue()is implemented in the kernel (sched/pthread/pthread_sigqueue.c), but it has no entry in the system call table: onlylibs/libc/libc.csvlists it. So in a protected or kernel build a user program that callspthread_sigqueue()does not link. The CI of apache/nuttx-apps#3931 shows it:undefined reference to 'pthread_sigqueue'innuttx_user.elfofsmartl-c906:knsh.This PR adds
pthread_sigqueuetosyscall/syscall.csv(in alphabetical order; theunion sigvalargument is passed as forsigqueue) and toinclude/sys/syscall_lookup.h, next topthread_sigmask. It removes thelibc.csventry, because the function is not in libc. The condition is!defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_DISABLE_ALL_SIGNALS):pthread_sigqueue.cis built with pthreads, and it callsnxsig_dispatch(), which is built only with signals.Impact
pthread_sigqueue()is available to user programs in protected and kernel builds. Adding a system call changes the numbers of the calls after it, as for any new system call; programs of a kernel build must be built again. Flat builds call the same function as before; the system symbol table now takes the entry fromsyscall.csv.Testing
A test program (a thread waits in
sigwaitinfo(); the main thread sendsSIGUSR1withpthread_sigqueue(), first with asival_int, then with asival_ptr, and then with signal 1000):qemu-armv8a:knsh(kernel build, QEMU 11 with HVF on an Apple M4):undefined references: pthread_sigqueue).si_code == SI_QUEUEand the sent value; signal 1000 givesEINVAL.mps2-an500:knsh(protected build, QEMU TCG), this PR: the same output.ostestonqemu-armv8a:knshandqemu-armv8a:nshends withostest_main: Exiting with status 0. WithCONFIG_DISABLE_ALL_SIGNALS=ythe generatedSTUB_pthread_sigqueue.cis under the same#if, so no stub is built (the full build ofmps2-an500:knshwith that option fails on master too, inboards/arm/mps/mps2-an500/kernel/mps_userspace.c:113, for another reason).tools/checkpatch.sh -c -u -m -gpasses.