Getting descriptor of std::fs::File


#1

Hi !
I’ve been looking forward to make a crate wrapping capsicum for FreeBSD (even though technically there’s https://github.com/google/capsicum-linux too), and I couldn’t find a way to extract the file descriptor off a std::fs::File or any struct that encapsulates that kind of data.

I’ve searched and found about a native crate, or about using libc, etc. But the idea is not to have to use raw syscalls, but rather remain compatible with the standard interfaces with the chance to “attach hints” to the descriptors to allow certain actions or not (letting Result do his normal thing)

¿Is there any chance?

Thanks for reading !
Regards


#2

You mean std::os::unix::io::{ AsRawFd , IntoRawFd } ?


#3

Amazing, thanks !! I’ll investigate those :smiley: