Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closefrom: add NetBSD, OpenBSD, DragonflyBSD #4290

Merged
merged 1 commit into from
Mar 2, 2025

Conversation

tobhe
Copy link
Contributor

@tobhe tobhe commented Mar 2, 2025

Description

closefrom is actually widely adopted in *BSD. The only one that seems to not support it at this point is macOS.
This effectively adds closefrom for NetBSD, OpenBSD and DragonFly.

Sources

https://leaf.dragonflybsd.org/cgi/web-man?command=closefrom
https://man.netbsd.org/closefrom.3
https://man.openbsd.org/closefrom.2

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 2, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Mar 2, 2025

Some changes occurred in OpenBSD module

cc @semarie

@semarie
Copy link
Contributor

semarie commented Mar 2, 2025

the return type of closefrom is c_int on OpenBSD, NetBSD and DragonflyBSD (it is void only on FreeBSD).

so the tests are failing on OpenBSD :

  cargo:warning=/data/semarie/repos/rust/build-libc/build/x86_64-unknown-openbsd/debug/build/libc-test-6990a9227fb77c31/out/main.c:16166:24: error: incompatible function pointer types returning 'int (int)' from a function with result type
'void (*)(int)' [-Werror,-Wincompatible-function-pointer-types]
  cargo:warning=                return closefrom;
  cargo:warning=                       ^~~~~~~~~
  cargo:warning=1 error generated.

NetBSD, OpenBSD and DragonFly return c_int, FreeBSD returns void,
so we can't just add it in freebsdlike.
Apple doesn't seem to support closefrom at all at this point.
@tobhe
Copy link
Contributor Author

tobhe commented Mar 2, 2025

Absolutely correct @semarie, thanks! No idea how i didn't catch that but it should be fixed now.

@semarie
Copy link
Contributor

semarie commented Mar 2, 2025

thanks, it passes the test now. the i686-linux-android fails seems unrelated.

Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

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

Thanks! Yeah, android CI is very flaky.

@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Mar 2, 2025
@tgross35 tgross35 enabled auto-merge March 2, 2025 23:12
@tgross35 tgross35 added this pull request to the merge queue Mar 2, 2025
Merged via the queue into rust-lang:main with commit d0a4bb1 Mar 2, 2025
44 checks passed
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Mar 10, 2025
NetBSD, OpenBSD and DragonFly return c_int, FreeBSD returns void,
so we can't just add it in freebsdlike.
Apple doesn't seem to support closefrom at all at this point.

(backport <rust-lang#4290>)
(cherry picked from commit 8512ab4)
@tgross35 tgross35 mentioned this pull request Mar 10, 2025
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Mar 10, 2025
NetBSD, OpenBSD and DragonFly return c_int, FreeBSD returns void,
so we can't just add it in freebsdlike.
Apple doesn't seem to support closefrom at all at this point.

(backport <rust-lang#4290>)
(cherry picked from commit 8512ab4)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Mar 10, 2025
NetBSD, OpenBSD and DragonFly return c_int, FreeBSD returns void,
so we can't just add it in freebsdlike.
Apple doesn't seem to support closefrom at all at this point.

(backport <rust-lang#4290>)
(cherry picked from commit 8512ab4)
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Mar 10, 2025
NetBSD, OpenBSD and DragonFly return c_int, FreeBSD returns void,
so we can't just add it in freebsdlike.
Apple doesn't seem to support closefrom at all at this point.

(backport <rust-lang#4290>)
(cherry picked from commit 8512ab4)
@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 Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-dragonfly O-unix S-waiting-on-review stable-applied This PR has been cherry-picked to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants