Skip to content

Make Flock implement AsRawFd #2571

Closed
Closed
@redactedontop

Description

@redactedontop

Hello. I'm currently trying to put a flock inside a mmap, and as it doesn't implement AsRawFd, memmap2 doesn't allow it. I have to do these shenanigans:

let mut file = unsafe { File::from_raw_fd(Flock::lock(file, FlockArg::LockExclusive).ok()?.as_raw_fd()) }; // SAFETY: Raw FD is copied from an existing file

Could AsRawFd be implemented into Flock?
Thank you,
Alex <3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions