rust-lang / rust-lang/libc

The `libc::sigaction` struct doesn't contain any way to access the underlying `sa_handler` field.

Open
#3,111 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

breakage-candidate C-bug E-easy
Dominant language
Rust
Stars
2.6k
Forks
1.3k
Avg merge
1d 22h
Merged PRs (30d)
69

Description

Per https://pubs.opengroup.org/onlinepubs/007904875/functions/sigaction.html and https://man7.org/linux/man-pages/man2/sigaction.2.html, there's an sa_handler field for the sigaction struct. On Linux with some architectures, it may be aliased to sa_sigaction, but it's always there.

This is required in order to know what the previous signal handler was, and more importantly, whether it was previously ignored (.sa_handler == SIG_IGN) or set to the default disposition (.sa_handler == SIG_DFL).

Also, this allows omitting the SA_SIGINFO property of sa_flags, offering a simpler API for most common cases as it's just one (commonly-ignored) argument, not three.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the platform-specific libc::sigaction definitions with the POSIX and Linux sigaction documentation linked in the issue, paying attention to architectures where sa_handler is aliased to sa_sigaction. The work is done when callers can inspect the previous handler, including SIG_IGN and SIG_DFL, without requiring SA_SIGINFO.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.