[all-commits] [llvm/llvm-project] 8d7ca0: [libc] Update siginfo_t to match kernel definition...

Mikhail R. Gadelha via All-commits all-commits at lists.llvm.org
Thu Sep 21 07:59:16 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d7ca08b9f5bf5ab6c5a0c5e68dd5643036544cb
  Author: Mikhail R. Gadelha <mikhail at igalia.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M libc/include/llvm-libc-types/CMakeLists.txt
    M libc/include/llvm-libc-types/siginfo_t.h

  Log Message:
  [libc] Update siginfo_t to match kernel definition (#66560)

This patch updates the siginfo_t struct definition to match the
definition from the kernel here:


In particular, there are two main changes:

1. swap position of si_code and si_errno: si_code show come after
si_errno in all systems except MIPS. Since we don't MIPS, the order is
fixed for now, but can be easily \#ifdef'd if MIPS support is
implemented in the future.

2. We add a union of structs that are filled depending on the signal

This change was required for the fork and spawn integration tests in
rv32, since they fork/clone the running process, call
wait/waitid/waitpid, and read the status, which was wrong in rv32
because wait/waitid/waitpid are implemented in rv32 using SYS_waitid.

SYS_waitid takes a pointer to a siginfo_t and fills the proper fields in
the struct. The previous siginfo_t definition was being incorrectly
filled due to not taking into account the signal raised.

More information about the All-commits mailing list