Skip to content

Fix: Replace sighandler_t with sig_t for Apple and BSDs#5008

Open
chengr4 wants to merge 2 commits intorust-lang:mainfrom
chengr4:sig_t
Open

Fix: Replace sighandler_t with sig_t for Apple and BSDs#5008
chengr4 wants to merge 2 commits intorust-lang:mainfrom
chengr4:sig_t

Conversation

@chengr4
Copy link

@chengr4 chengr4 commented Mar 9, 2026

Description

This PR tries to fix #1273.

I am not able to evaluate whether #[deprecated] should be added.

Sources

Apple I checked at my local (Aarch MacOS 26.3.1)

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2026

Some changes occurred in a NetBSD-like module

cc @semarie

Some changes occurred in an OpenBSD module

cc @semarie

@chengr4 chengr4 changed the title Sig t Fix: Replace sighandler_t with sig_t for Apple and BSDs Mar 9, 2026
chengr4 added 2 commits March 8, 2026 21:53
    Expected Error:

    error[E0432]: unresolved import `libc::sig_t`
         |
    3108 |     sig_t,
         |     ^^^^^ no `sig_t` in the root
    - Result: Tests pass
    - Check Apple type at local
        ```bash
        grep -r "sig_t" /usr/include /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include 2>/dev/null
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/kern/kcdata.h:	uint8_t   ceri_page_codesig_tainted;
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:typedef void (*sig_t)(int);     /* type of signal function */
        ```
        > Aarch MacOS 26.3.1
    - Check Other OS from the Internet

    Source:

        - (Freebsd) https://github.com/freebsd/freebsd-src/blob/016570c4463d5908953355ee1cf9a385ad9601b4/sys/sys/signal.h
        - (Dragonfly) https://github.com/DragonFlyBSD/DragonFlyBSD/blob/51591aff67978c86de99839e31d8c8fcc54bc316/sys/sys/signal.h
        - https://www.gnu.org/software/gnulib/manual/html_node/signal_002eh.html
            - The type sighandler_t (a GNU extension) is not defined on most non-glibc platforms: macOS 11.1, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 5.1, HP-UX 11, Solaris 11.4, Cygwin, mingw, MSVC 14.
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.

Incorrect type name sighandler_t should be sig_t on apple targets

2 participants