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

Use rustix instead of calling libc directly. #21

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

sunfishcode
Copy link
Collaborator

Use rustix instead of calling libc directly, which factors out several
unsafe blocks and simplifies error handling.

There is still one unsafe block needed, to dereference raw file
descriptors passed in from the user, since the crate still uses
AsRawFd. Once I/O safety is stablized in std, this crate can switch
to using AsFd, which will eliminate the last unsafe block.

This splits out just the API-compatible parts of #14. It does not include
the changes to use the AsFd trait in the public API, so it's not an
API-breaking change.

@sunfishcode sunfishcode force-pushed the sunfishcode/rustix branch 2 times, most recently from 9dacfd8 to 3bc0dcd Compare January 14, 2022 21:46
Use rustix instead of calling libc directly, which factors out several
unsafe blocks and simplifies error handling.

There is still one `unsafe` block needed, to dereference raw file
descriptors passed in from the user, since the crate still uses
`AsRawFd`. Once I/O safety is stablized in std, this crate can switch
to using `AsFd`, which will eliminate the last `unsafe` block.

This splits out just the API-compatible parts of yoshuawuyts#14. It does not include
the changes to use the `AsFd` trait in the public API, so it's not an
API-breaking change.
Copy link
Owner

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

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

Looks good! Feel free to merge and/or publish this once you're comfortable with it!

@sunfishcode sunfishcode merged commit 195f719 into yoshuawuyts:master Jan 20, 2022
@sunfishcode sunfishcode deleted the sunfishcode/rustix branch January 20, 2022 23:54
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.

2 participants