Skip to content

Use OwnedFd instead of RawFd #104

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

Merged
merged 1 commit into from
Apr 28, 2025
Merged

Use OwnedFd instead of RawFd #104

merged 1 commit into from
Apr 28, 2025

Conversation

l0kod
Copy link
Member

@l0kod l0kod commented Apr 28, 2025

Improve consistency by delegating lifetime management to OwnedFd. The only visible change would be that with latest Rust versions, the duplicated file descriptor will be greater than 2 (not with Rust 1.63). See https://doc.rust-lang.org/1.63.0/std/os/unix/io/struct.OwnedFd.html

Remove the explicit RulesetCreated's Drop implementation which is now handled by its inner OwnedFd.

Replate IntoRawFd with the safer Into<Option<OwnedFd>> for RulesetCreated. The former is implemented for OwnedFd. This is not a breaking change because the IntoRawFd implementation was never released.

Add tests leveraging RulesetCreated::try_clone().

See #85

@l0kod l0kod force-pushed the ownedfd branch 6 times, most recently from 3d839ee to aed4d81 Compare April 28, 2025 15:46
Improve consistency by delegating lifetime management to OwnedFd.  The
only visible change would be that with latest Rust versions, the
duplicated file descriptor will be greater than 2 (not with Rust 1.63).
See https://doc.rust-lang.org/1.63.0/std/os/unix/io/struct.OwnedFd.html

Remove the explicit RulesetCreated's Drop implementation which is now
handled by its inner OwnedFd.

Replate IntoRawFd with the safer Into<Option<OwnedFd>> for
RulesetCreated.  The former is implemented for OwnedFd.  This is not a
breaking change because the IntoRawFd implementation was never released.

Add tests leveraging RulesetCreated::try_clone().

Signed-off-by: Mickaël Salaün <mic@digikod.net>
@l0kod l0kod merged commit c9834cf into landlock-lsm:main Apr 28, 2025
19 checks passed
@l0kod l0kod deleted the ownedfd branch April 28, 2025 16:16
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