Getting descriptor of std::fs::File

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

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

1 Like

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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.