Skip to content
Advertisement

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: Thanks!!!

Rust: View entire Command::New command arguement structs as its passed to terminal / correct my arguements

I am not getting the correct response from the server running the following However…. the following works fine if I run it in terminal. I form the following using let line = “curl -X POST –header “Authorization: Bearer “.to_owned() + &return_token(“auth”) + “” –header “Content-Type: application/json” -d ” + parameters + ” “https://api.tdameritrade.com/v1/accounts/CORRECT_ACCOUNT_#/orders””; “parameters” can be seen above in JSON.

Error: “linker ‘cc’ not found” when cross compiling a rust project from windows to linux using cargo

I have a basic rust/cargo project with a single main file and some basic dependencies. The cargo build command works fine when the target is not specified (I am using windows so it builds to windows), but when I try to cross compile the program to linux using cargo build –target=x86_64-unknown-linux-gnu or cargo build –target=x86_64-unknown-linux-musl, the process fails with the

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 writes

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 appears to be a known issue with rustup (#350, #765), specifically around cargo-installed binaries that

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 the abstraction SignalHandler:

Advertisement