* [rust-dev] File Descriptors
@ 2014-11-18 23:13 Nikos Vasilakis
2014-11-18 23:37 ` Steve Klabnik
2014-11-18 23:39 ` Kai Noda
0 siblings, 2 replies; 4+ messages in thread
From: Nikos Vasilakis @ 2014-11-18 23:13 UTC (permalink / raw)
To: rust-dev
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [rust-dev] File Descriptors
2014-11-18 23:13 [rust-dev] File Descriptors Nikos Vasilakis
@ 2014-11-18 23:37 ` Steve Klabnik
2014-11-18 23:39 ` Kai Noda
1 sibling, 0 replies; 4+ messages in thread
From: Steve Klabnik @ 2014-11-18 23:37 UTC (permalink / raw)
To: Nikos Vasilakis; +Cc: rust-dev
It's not the wrong list, but usually StackOverflow works better.
(Sorry I don't know more about file descriptors :/)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [rust-dev] File Descriptors
2014-11-18 23:13 [rust-dev] File Descriptors Nikos Vasilakis
2014-11-18 23:37 ` Steve Klabnik
@ 2014-11-18 23:39 ` Kai Noda
2014-11-19 20:27 ` Nikos Vasilakis
1 sibling, 1 reply; 4+ messages in thread
From: Kai Noda @ 2014-11-18 23:39 UTC (permalink / raw)
To: Nikos Vasilakis; +Cc: rust-dev
[-- Attachment #1: Type: text/plain, Size: 2417 bytes --]
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
野田 開 <nodakai@gmail.com>
2014-11-19 7:13 GMT+08:00 Nikos Vasilakis <nikos@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
>
[-- Attachment #2: Type: text/html, Size: 3602 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [rust-dev] File Descriptors
2014-11-18 23:39 ` Kai Noda
@ 2014-11-19 20:27 ` Nikos Vasilakis
0 siblings, 0 replies; 4+ messages in thread
From: Nikos Vasilakis @ 2014-11-19 20:27 UTC (permalink / raw)
To: Kai Noda; +Cc: rust-dev
Thank you both.
Kai, do you think I should open an issue on github?
Nikos
On Tue, Nov 18, 2014 at 6:39 PM, Kai Noda <nodakai@gmail.com> wrote:
> 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
>
> 野田 開 <nodakai@gmail.com>
>
> 2014-11-19 7:13 GMT+08:00 Nikos Vasilakis <nikos@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
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-11-19 20:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-18 23:13 [rust-dev] File Descriptors Nikos Vasilakis
2014-11-18 23:37 ` Steve Klabnik
2014-11-18 23:39 ` Kai Noda
2014-11-19 20:27 ` Nikos Vasilakis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox