Hi Nikos, std::sys is private and only for internal use in libstd as of now. It was broken in the course of the Great Runtime Overhaul https://github.com/rust-lang/rust/pull/18557
Stay tuned for updates from aturon... Regards, Kai 野田 開 <noda...@gmail.com> 2014-11-19 7:13 GMT+08:00 Nikos Vasilakis <ni...@vasilak.is>: > Hi everyone, > > (I apologize if this is not the right mailing list for this; if not, > please point me to the right direction). > > At a high level, I am trying to get the file descriptor for a file I > am opening -- the reason for this is I want to pass it on to ioctl > later on. I am trying two approaches here: > > 1. Use libc FFI, and create and pass around a sys::fs::FileDesc. This > worked until today, when I updated to latest rustc (using rustup). > Now, trying to compile, gives me "unresolved import > `sys::fs::FileDesc`. Maybe a missing `extern crate sys`?". (and extern > does not work, can't find crate). > > Looking in the rust-lang source, however, I see it being used (and > being imported) exactly as I do above (e.g., > libstd/sys/unix/{helper_signal.rs, process.rs}). So, what's going on? > > 2. (Try to) Use regular, rust-y std::io::{File, Open, ReadWrite}, and > try to use the `as_fd()` method on the `File` result I get from open. > This is somewhat undocumented, but I came across the method in fs.rs > source [1] (I think I intuitively understand what > `sys_common::AsFileDesc` means in `impl sys_common::AsFileDesc for > File`), and I then saw that process.rs actually uses it, of course > after doing `use sys_common::{AsFileDesc}` at the beginning, as my > intuition suggested. Still though, I get a similar error to (1) above, > i.e., `unresolved import `sys_common::AsFileDesc`. Maybe a missing > `extern crate sys_common`?` What's going on here? > > What doesn't any of these imports work? Also, where is the > `sys_common` documented? And, most importantly, how do I get to play > with file descriptors, without implementing the abstraction myself (in > the case of (1), for instance)? > > Thanks! > Nikos > > > [1] > http://doc.rust-lang.org/src/std/home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libstd/io/fs.rs.html#91-95 > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev