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

Add POSIX confstr API #3771

Merged
merged 1 commit into from
Jul 13, 2024
Merged

Add POSIX confstr API #3771

merged 1 commit into from
Jul 13, 2024

Conversation

jgarzik
Copy link

@jgarzik jgarzik commented Jul 11, 2024

Fixes #3767

Some notes for reviewers:

  • This PR was successfully tested with my Rust getconf util implementation at /~https://github.com/rustcoreutils/posixutils-rs
  • It would be ideal, and seemingly appropriate, to add the confstr(3) API unix, because it is POSIX standard, just like sysconf(3), and originates from libc, just like sysconf(3). This failed to due a single platform, arm-android.
  • Therefore, an ideal future patch would populate other unix platforms with confstr.

This patch chooses the more limited path of focusing on linux-gnu, given that the symbols (not the function!) are glibc-specific.

@rustbot
Copy link
Collaborator

rustbot commented Jul 11, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@jgarzik
Copy link
Author

jgarzik commented Jul 11, 2024

Status: all tests except arm-linux-androidabi are passing. Unclear what is the best solution around this test failure.

@devnexen
Copy link
Contributor

Missing functions are either obsolete or explicitly disallowed by SELinux:

a64l/l64a
confstr
crypt/encrypt/setkey
gethostid
shm_open/shm_unlink
sockatmark
ualarm

source

@jgarzik jgarzik marked this pull request as ready for review July 11, 2024 18:17
@jgarzik
Copy link
Author

jgarzik commented Jul 11, 2024

Status: Narrowed to strictly gnu-linux, as the updated OP describes more fully.

Ready for merging, with an aspiration to see wider confstr beyond just linux-gnu and apple.

@devnexen
Copy link
Contributor

fair enough, even tough I believe musl for example has it too for example but that s fair as is :)

@jgarzik
Copy link
Author

jgarzik commented Jul 11, 2024

fair enough, even tough I believe musl for example has it too for example but that s fair as is :)

The Platonic ideal would seem to be "confstr on all unix except x, y, and z" but that is difficult to express in the semver tests, I'm guessing.

Further complicating the task is that value of _CS_PATH is not specified and may vary across confstr-supporting OS's. confstr is a POSIX-wide API with local-libc-specific values and symbology (thus the difference in Darwin and glibc symbols CS*)

@JohnTitor JohnTitor added this pull request to the merge queue Jul 13, 2024
Merged via the queue into rust-lang:main with commit 80a7d2e Jul 13, 2024
41 checks passed
@jgarzik jgarzik mentioned this pull request Jul 13, 2024
3 tasks
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Aug 13, 2024
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Aug 13, 2024
[fix conflicts - Trevor]
(backport <rust-lang#3771>)
(cherry picked from commit 31beed6)
Signed-off-by: Trevor Gross <tmgross@umich.edu>
@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 Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Missing POSIX confstr and _CS_* symbols on Linux.
5 participants