Skip to content

linux: complete siginfo_t definition - #5345

Merged
tgross35 merged 7 commits into
rust-lang:mainfrom
dybucc:linux-siginfo_t-tweaks
Sep 3, 2026
Merged

linux: complete siginfo_t definition#5345
tgross35 merged 7 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. Closes #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 dybucc changed the title Linux: complete siginfo_t definition linux: complete siginfo_t definition Jul 31, 2026
@xtqqczze

This comment was marked as outdated.

@tgross35

tgross35 commented Aug 4, 2026

Copy link
Copy Markdown
Member

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
Member

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.

@rustbot

This comment has been minimized.

@dybucc
dybucc force-pushed the linux-siginfo_t-tweaks branch from a6ba6f4 to bd71182 Compare August 5, 2026 06:49
@rustbot

This comment has been minimized.

@dybucc
dybucc force-pushed the linux-siginfo_t-tweaks branch 7 times, most recently from b02986c to 08192fa Compare August 5, 2026 15:18
@dybucc
dybucc force-pushed the linux-siginfo_t-tweaks branch from 3b24df9 to 5a893ac Compare September 1, 2026 08:27
Replace references to `siginfo_t` in the regular repository layout with
a crate-relative path that uses the reexport from the `new` module. This
allows the next few patches to all work as individual revisions.
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>
Remove older bindings to `siginfo_t` using dummy fields instead of the
upstream `union`. This follows from the patch providing a full
definition for glibc bindings.

Add reexports for `siginfo_t` under the `new` module. This has required
renaming the reexport for the `nptl` module as it also contains a `bits`
module of the same name as the `bits::types::siginfo_t` module path
under `sysdeps`.
Replace alignment/padding fields with a mirrored definition of the
upstream `union`. See [^1] for details.

[^1]: <https://github.com/kraj/musl/blob/a42e9dee266f398026a33d0793c66225c7997755/include/signal.h>
Remove older bindings to `siginfo_t` using dummy fields instead of the
upstream `union`. This follows from the patch providing a full
definition for musl bindings.

Add modified bindings under `new`.
Replace alignment/padding dummy fields with a mirrored definition
fitting that of upstream's `union`. uClibc supports targets for which we
have no support in Rust. No architecture-specific definition has been
provided for those. See [^1] for details on the generic definition and
[^2] for details on the MIPS definition.

[^1]: <https://github.com/wbx-github/uclibc-ng/blob/60d8e8c0cb9be8a241f6f2645daba260c8aec33c/libc/sysdeps/linux/common/bits/siginfo.h>
[^2]: <https://github.com/wbx-github/uclibc-ng/blob/60d8e8c0cb9be8a241f6f2645daba260c8aec33c/libc/sysdeps/linux/mips/bits/siginfo.h>
Remove older bindings to `siginfo_t` using dummy fields instead of the
upstream `union`. This follows from the patch providing a full
definition for uClibc bindings.

Add modified bindings to `new` module.
@dybucc
dybucc force-pushed the linux-siginfo_t-tweaks branch from 5a893ac to c05354f Compare September 1, 2026 10:33
@rustbot

rustbot commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@dybucc
dybucc force-pushed the linux-siginfo_t-tweaks branch from c05354f to 627a3e4 Compare September 1, 2026 10:33
@dybucc

dybucc commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

Happy to merge this now since it's an improvement, but would you be able to do a followup removing siginfo_t skips in libc-test/build/main.rs? I don't know that all can be removed but looks like possibly a couple.

View changes since this review

@tgross35
tgross35 added this pull request to the merge queue Sep 3, 2026
Merged via the queue into rust-lang:main with commit ae20d43 Sep 3, 2026
58 checks passed
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
Replace references to `siginfo_t` in the regular repository layout with
a crate-relative path that uses the reexport from the `new` module. This
allows the next few patches to all work as individual revisions.

(backport <rust-lang#5345>)
(cherry picked from commit aa478e6)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
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>

(backport <rust-lang#5345>)
(cherry picked from commit 4b355bd)
[ Needed to adjust the body of si_int for the cherry pick since on
  libc-0.2, sigval is still a struct - Trevor ]
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
Remove older bindings to `siginfo_t` using dummy fields instead of the
upstream `union`. This follows from the patch providing a full
definition for glibc bindings.

Add reexports for `siginfo_t` under the `new` module. This has required
renaming the reexport for the `nptl` module as it also contains a `bits`
module of the same name as the `bits::types::siginfo_t` module path
under `sysdeps`.

(backport <rust-lang#5345>)
(cherry picked from commit 404da0e)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
Replace alignment/padding fields with a mirrored definition of the
upstream `union`. See [^1] for details.

[^1]: <https://github.com/kraj/musl/blob/a42e9dee266f398026a33d0793c66225c7997755/include/signal.h>

(backport <rust-lang#5345>)
(cherry picked from commit 5bea5fb)
[ Needed to adjust the body of si_int for the cherry pick since on
  libc-0.2, sigval is still a struct - Trevor ]
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
Remove older bindings to `siginfo_t` using dummy fields instead of the
upstream `union`. This follows from the patch providing a full
definition for musl bindings.

Add modified bindings under `new`.

(backport <rust-lang#5345>)
(cherry picked from commit 539ecdd)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
Replace alignment/padding dummy fields with a mirrored definition
fitting that of upstream's `union`. uClibc supports targets for which we
have no support in Rust. No architecture-specific definition has been
provided for those. See [^1] for details on the generic definition and
[^2] for details on the MIPS definition.

[^1]: <https://github.com/wbx-github/uclibc-ng/blob/60d8e8c0cb9be8a241f6f2645daba260c8aec33c/libc/sysdeps/linux/common/bits/siginfo.h>
[^2]: <https://github.com/wbx-github/uclibc-ng/blob/60d8e8c0cb9be8a241f6f2645daba260c8aec33c/libc/sysdeps/linux/mips/bits/siginfo.h>

(backport <rust-lang#5345>)
(cherry picked from commit 11a1a64)
[ Needed to adjust the body of si_int for the cherry pick since on
  libc-0.2, sigval is still a struct - Trevor ]
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
Remove older bindings to `siginfo_t` using dummy fields instead of the
upstream `union`. This follows from the patch providing a full
definition for uClibc bindings.

Add modified bindings to `new` module.

(backport <rust-lang#5345>)
(cherry picked from commit ae20d43)
@tgross35 tgross35 mentioned this pull request Sep 4, 2026
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Sep 4, 2026
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.

Problem in implementing siginfo_t for Linux

4 participants