[PATCH] Linux: Add missing si_code constants from Linux kernel
Carlos O'Donell
carlos@redhat.com
Wed Sep 3 15:34:59 GMT 2025
On 9/2/25 10:41 PM, Thiago Jung Bauermann wrote:
> This brings the si_codes listed in siginfo-consts.h up-to-date with
> Linux v6.16's include/uapi/asm-generic/siginfo.h.
>
> Tested on aarch64-linux-gnu and x86_64-linux-gnu.
Looking forward to v2.
This fails pre-commit CI:
https://patchwork.sourceware.org/project/glibc/patch/20250903024151.3030839-1-thiago.bauermann@linaro.org/
The header conformance tests are failing.
>
> Suggested-by: Carlos O'Donell <carlos@redhat.com>
> Signed-off-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Please drop the SOB since Linaro has copyright assignment, unless your contract
with Linaro ensure you retain copyright. If you retain your own copyright then
you should keep SOB and adjust siginfo-consts.h with the generalized
"Copyright The GNU Toolchain Authors."
Please see:
https://sourceware.org/glibc/wiki/Contribution%20checklist
> ---
> sysdeps/unix/sysv/linux/bits/siginfo-consts.h | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/bits/siginfo-consts.h b/sysdeps/unix/sysv/linux/bits/siginfo-consts.h
> index fd38bb3147f7..b14a61d63232 100644
> --- a/sysdeps/unix/sysv/linux/bits/siginfo-consts.h
> +++ b/sysdeps/unix/sysv/linux/bits/siginfo-consts.h
> @@ -168,8 +168,10 @@ enum
> # define TRAP_BRANCH TRAP_BRANCH
> TRAP_HWBKPT, /* Hardware breakpoint/watchpoint. */
> # define TRAP_HWBKPT TRAP_HWBKPT
> - TRAP_UNK /* Undiagnosed trap. */
> + TRAP_UNK, /* Undiagnosed trap. */
> # define TRAP_UNK TRAP_UNK
> + TRAP_PERF /* Perf event with sigtrap=1. */
> +# define TRAP_PERF TRAP_PERF
OK. This is OK and accounted for in the conformance data as TRAP_*.
> };
> # endif
>
> @@ -209,6 +211,15 @@ enum
> };
> # endif
>
> +/* `si_code' values for SIGSYS signal. */
> +enum
> +{
> + SYS_SECCOMP = 1, /* Seccomp triggered. */
> +# define SYS_SECCOMP SYS_SECCOMP
> + SYS_USER_DISPATCH /* Syscall user dispatch triggered. */
> +# define SYS_USER_DISPATCH SYS_USER_DISPATCH
> +};
These are not OK since they pollute the global namespace and cause conformance
test failures. No POSIX or ISO C standard defines them.
The fix for these is to wrap them e.g.
/* The Linux-specific SIGSYS values are all considered GNU extensions. */
#ifdef __USE_GNU
...
#endif
That way they are only defined when extensions to the standard are requested.
The same is already in effect for Linux-specific Architecture-specific signals.
Please make sure that the conform-* test pass with your change.
> +
> /* Architectures might also add architecture-specific constants.
> These are all considered GNU extensions. */
> #ifdef __USE_GNU
>
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list