1
0
Fork 0
mirror of https://gitlab.redox-os.org/CoffeeCode/redox-ssh.git synced 2025-12-28 15:02:18 +01:00

Fix compilation on Redox

This commit is contained in:
Jeremy Soller 2018-05-02 19:28:04 -06:00
parent fa05c15359
commit 8cf8b6073f
2 changed files with 21 additions and 14 deletions

26
Cargo.lock generated
View file

@ -1,16 +1,3 @@
[root]
name = "redox-ssh"
version = "0.1.0"
dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num-bigint 0.1.39 (git+https://github.com/rust-num/num)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "byteorder"
version = "1.1.0"
@ -72,6 +59,19 @@ dependencies = [
"libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox-ssh"
version = "0.1.0"
dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"num-bigint 0.1.39 (git+https://github.com/rust-num/num)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.26"

View file

@ -86,10 +86,17 @@ impl Channel {
);
self.read_thread = Some(thread::spawn(move || {
#[cfg(target_os = "redox")]
use syscall::dup;
#[cfg(target_os = "redox")]
let master2 = unsafe { dup(master_fd, &[]).unwrap_or(!0) };
#[cfg(not(target_os = "redox"))]
use libc::dup;
#[cfg(not(target_os = "redox"))]
let master2 = unsafe { dup(master_fd) };
println!("dup result: {}", dup as u32);
println!("dup result: {}", master2 as u32);
let mut master = unsafe { File::from_raw_fd(master2) };
loop {
use std::str::from_utf8_unchecked;