Skip to content

linux: complete siginfo_t definition - #5345

Open
dybucc wants to merge 6 commits into
rust-lang:mainfrom
dybucc:linux-siginfo_t-tweaks
Open

linux: complete siginfo_t definition#5345
dybucc wants to merge 6 commits into
rust-lang:mainfrom
dybucc:linux-siginfo_t-tweaks

Conversation

@dybucc

@dybucc dybucc commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

Completes the siginfo_t definition under Linux targets to attempt closing
#716.

See the patch messages for details on each of the GNU targets, uClibc targets
and musl targets.

Checklist

  • Relevant tests in libc-test/semver have been updated
  • Commit messages permalink to headers for added or changed API
  • Placeholder or unstable values like *LAST or *MAX have the standard
    doc comment
  • Tested locally (cargo test -p libc-test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

dybucc added 3 commits July 31, 2026 17:24
Replace padding and alignment fields with a mirrored definition of all
fields upstream. The effective sizes and alignment are the same except
in RISCV-32, where the alignment in Rust was 8-bytes while in glibc it's
4 bytes. M68K is also affected in that the order of its `si_code` and
`si_errno` fields has been switched. See [^1] for general details on
this record, and the following list for architecture-specific overrides:

- `mips`:
<https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h;h=cd3af7db06ba425373ee68ec302e7ea2b5e6ac01;hb=HEAD>
- `sparc`:
<https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h;h=4dd35237f67a63c555becffdf038e489558564e6;hb=HEAD>
- `x86`:
<https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h;h=7688a8d66d6e6ea790a54414500774664fa28e0a;hb=HEAD>

[^1]:
<https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/types/siginfo_t.h;h=43c4e009a44faef57558093d248a715f75759f89;hb=HEAD>
Replace dummy padding/alignment fields with a proper definition of all
fields as seen upstream. This patch should be harmless in that no
supported target should see a difference; A padding field that had been
public without need has been made private. Certain uClibc targets for
which we provide bindings, such as x86_64, have no supported Rust
target. Those have been left unmodified, to be removed in a separate
patch. See [^1] for details on the Arm definition and [^2] for details
on the MIPS32 definition.

[^1]:
<https://github.com/wbx-github/uclibc-ng/blob/50c470ef4e688e6eea6fd1eff13083e4fd7b7c95/libc/sysdeps/linux/common/bits/siginfo.h#L115>
[^2]:
<https://github.com/wbx-github/uclibc-ng/blob/50c470ef4e688e6eea6fd1eff13083e4fd7b7c95/libc/sysdeps/linux/mips/bits/siginfo.h#L120>
Replace dummy padding/alignment fields with a definition that mirrors
that of upstream. No target should be affected in terms of size and
alignment, but one previously public field has been made private. This
had been deprecated and hidden from the docs for seven years, so it
should be fine to get rid of it. See [^1] for details.

[^1]: <https://github.com/kraj/musl/blob/a42e9dee266f398026a33d0793c66225c7997755/include/signal.h#L99-L147>
@dybucc dybucc changed the title Linux: complete siginfo_t definition linux: complete siginfo_t definition Jul 31, 2026
@xtqqczze

xtqqczze commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@tgross35

tgross35 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Would you mind using this as an opportunity to move signifo_t to src/new? At least on glibc, that should make things a lot easier with less duplication. No need to be perfect with siginfo-arch.h since that's tricky to replicate in Rust, cfg is fine.

Also fyi, @xtqqczze found https://github.com/sailfishos-mirror/glibc as a mirror for glibc that's much easier to search and less flaky, that's fine to link (as is sourceware, of course).

@tgross35

tgross35 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

There will be quite a bit less to review after that, so will hold off taking a closer look. Let me know if you need help figuring out the module structure.

@rustbot author

@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

dybucc added 3 commits August 4, 2026 17:26
Add links and update existing links to headers in the non-archived
GitHub mirror kept by the Sailfish OS project at [^1]. The bminor fork
has been archived for some time now.

[^1]: https://github.com/sailfishos-mirror/glibc/
Replace alignment/padding fields with a one-to-one definition as that
used upstream. These have been incorporated as definitions in the `new`
module to avoid huge repetition across target triples without overrides.
The glibc definitions are mostly the same across target architectures
except for MIPS, SPARC and x86. x86 is confusing because there's only an
override when running under x86_64 and compiling for x32. I'm not sure
how Rust handles this, so the `#[path]`-redirected files for that
architecture are the same as the generic ones. See [^1] for the generic
file and the following list for the architecture-specific overrides.

- `mips`: <https://github.com/sailfishos-mirror/glibc/blob/4a07bb292f921c10e71fbf48c4a7f44391feb06c/sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h>
- `sparc`: <https://github.com/sailfishos-mirror/glibc/blob/4a07bb292f921c10e71fbf48c4a7f44391feb06c/sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h>
- `x86`: <https://github.com/sailfishos-mirror/glibc/blob/4a07bb292f921c10e71fbf48c4a7f44391feb06c/sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h>

[^1]: <https://github.com/sailfishos-mirror/glibc/blob/4a07bb292f921c10e71fbf48c4a7f44391feb06c/sysdeps/unix/sysv/linux/bits/types/siginfo_t.h>
@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants