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 a readlinkat_raw function. #923

Merged
merged 6 commits into from
Nov 7, 2023
Merged

Conversation

sunfishcode
Copy link
Member

This is similar to readlinkat, but instead of returning an owned and allocated CString, takes a &mut [MaybeUninit<u8>] and returns a &mut [u8] containing the written bytes, which may have been truncated. This is trickier to use, and most users should still just use readlinkat, but it is usable in contexts that can't do dynamic allocation.

This is similar to `readlinkat`, but instead of returning an owned and
allocated `CString`, takes a `&mut [MaybeUninit<u8>]` and returns a
`&mut [u8]` containing the written bytes, which may have been truncated.
This is trickier to use, and most users should still just use
`readlinkat`, but it is usable in contexts that can't do dynamic
allocation.
@sunfishcode sunfishcode force-pushed the sunfishcode/readlinkat-raw branch from 5fd852d to d3a70e5 Compare November 7, 2023 20:42
On some architectures, there is a `getcpu` entry in the vDSO, so use
that if available, and use the syscall otherwise.
@sunfishcode sunfishcode merged commit 1edcdfe into main Nov 7, 2023
@sunfishcode sunfishcode deleted the sunfishcode/readlinkat-raw branch November 7, 2023 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant