Skip to content

Tag: rust

How to use SIGALARM in rust?

I have a problem using alarm from nix library in rust. I am trying to communicate two child process with alarms, the exercise consist in send a signal to child process to other every two seconds, and retun it with pipe. When I run the code it still waiting and I can’t see the message. This is my code: T…

How do I get the filename of an open std::fs::File in Rust?

I have an open std::fs::File, and I want to get it’s filename, e.g. as a PathBuf. How do I do that? The simple solution would be to just save the path used in the call to File::open. Unfortunately, this does not work for me. I am trying to write a program that reads log files, and the program that write…

How to use nix’s ioctl?

I want to call ioctl from Rust. I know that I should use the nix crate, but how exactly? From the documentation it’s not clear. I have this C: How would I do that same thing using the nix crate? There are no TUN* constants in the nix crate and it isn’t clear how to use the ioctl macro. Answer

How to solve librustdoc.so missing when using rustbook tool?

I’ve used to install rustbook successfully, but when I run rustbook I get an error: But I can find out this .so file. How can I let rustbook know the path to librustdoc-c0dcaea09a16c7ec.so? rustc 1.16.0-nightly (4ecc85beb 2016-12-28) rustdoc 1.16.0-nightly (4ecc85beb 2016-12-28) rustup show: Answer This…

Safe global state for signal handling

I am toying around with Rust and various UNIX libraries. A use-case that I have right now is that I want to react to POSIX signals. To keep things reasonable I want to create an abstraction over the signal handling so that the rest of my program doesn’t have to worry about them as much. Let’s call…