yoshuawuyts / fd-lock

Advisory cross-platform file locks using file descriptors
Apache License 2.0
76 stars 18 forks source link

Rewrite using io_lifetimes crate / IO safety RFC #12

Closed yoshuawuyts closed 3 months ago

yoshuawuyts commented 3 years ago

https://io-experiment.sunfishcode.online/x86_64-unknown-linux-gnu/io_lifetimes/index.html now exists, which is an experimental implementation of the IO safety RFC. We should create a branch of this code which uses that instead of what we're currently doing. Not in the least to validate that the RFC enables what it promises to.

sunfishcode commented 3 years ago

At a quick look, this looks like it should be straightforward. It should work to replace T: AsRawFd with T: AsFd, and then either do .as_fd().as_raw_fd() to get a raw fd to pass to libc, or use posish, a libc wrapper crate using io-lifetimes, letting you call flock without the .as_raw_fd() or the syscall(unsafe { ... }). Either way, I'd be happy to answer any questions!

sunfishcode commented 3 years ago

If anyone wants to do this, I'm happy to help, but otherwise I may look into doing this myself as fd-lock looks like a nice real-world testcase.

yoshuawuyts commented 3 years ago

@sunfishcode I may not have the bandwidth to, so please feel free to!

WaffleLapkin commented 3 months ago

Since #14 was merged, should this be closed?