From 46431553180ab33fc57bc1bf1d5315c9c3b5ba18 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 3 Aug 2020 18:25:46 +0800 Subject: [PATCH] cross-platform: fix building on native and hosted This makes some minor changes to get builds working on both platforms. Signed-off-by: Sean Cross --- xous-rs/src/arch/hosted.rs | 12 +++++------- xous-rs/src/arch/native.rs | 9 ++++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/xous-rs/src/arch/hosted.rs b/xous-rs/src/arch/hosted.rs index f5ac45ff2..08d96d786 100644 --- a/xous-rs/src/arch/hosted.rs +++ b/xous-rs/src/arch/hosted.rs @@ -168,7 +168,7 @@ pub fn create_process_post( }; // println!("Launching process..."); - let result = Command::new(shell) + Command::new(shell) .args(&args) .env("XOUS_SERVER", server_env) .env("XOUS_PID", pid_env) @@ -176,12 +176,10 @@ pub fn create_process_post( .env("XOUS_PROCESS_KEY", process_key_env) .spawn() .map(ProcessHandle) - .map_err(|e| { + .map_err(|_| { // eprintln!("couldn't start command: {}", e); crate::Error::InternalError - }); - // println!("Process result: {:?}", result); - result + }) } pub fn wait_process(mut joiner: ProcessHandle) -> crate::SysCallResult { @@ -407,8 +405,8 @@ fn xous_connect_impl( mailbox: Arc::new(Mutex::new(HashMap::new())), }) } - Err(e) => { - // eprintln!("Unable to connect to Xous server: {}", e); + Err(_e) => { + // eprintln!("Unable to connect to Xous server: {}", _e); // eprintln!( // "Ensure Xous is running, or specify this process as an argument to the kernel" // ); diff --git a/xous-rs/src/arch/native.rs b/xous-rs/src/arch/native.rs index 8294162ab..875dd2e45 100644 --- a/xous-rs/src/arch/native.rs +++ b/xous-rs/src/arch/native.rs @@ -1,6 +1,9 @@ use crate::{MemoryAddress, PID, TID}; use core::convert::TryInto; +mod mem; +pub use mem::*; + #[derive(Debug, Clone, Copy, PartialEq)] pub struct ProcessArgs { name: [u8; 16], @@ -30,7 +33,7 @@ pub struct ProcessInit { pub struct WaitHandle(core::marker::PhantomData); pub struct ProcessHandle(()); -pub fn thread_to_args(call: usize, init: ThreadInit) -> [usize; 8] { +pub fn thread_to_args(call: usize, init: &ThreadInit) -> [usize; 8] { [ call as usize, init.call as usize, @@ -151,8 +154,8 @@ where pub fn create_thread_simple_post( _f: fn(T) -> U, _arg: T, - thread_id: TID, -) -> core::result::Result, crate::Error> + _thread_id: TID, +) -> core::result::Result, crate::Error> where T: Send + 'static, U: Send + 'static,