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 <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-08-03 18:25:46 +08:00
parent 285b92401e
commit 4643155318
2 changed files with 11 additions and 10 deletions

View file

@ -168,7 +168,7 @@ pub fn create_process_post(
}; };
// println!("Launching process..."); // println!("Launching process...");
let result = Command::new(shell) Command::new(shell)
.args(&args) .args(&args)
.env("XOUS_SERVER", server_env) .env("XOUS_SERVER", server_env)
.env("XOUS_PID", pid_env) .env("XOUS_PID", pid_env)
@ -176,12 +176,10 @@ pub fn create_process_post(
.env("XOUS_PROCESS_KEY", process_key_env) .env("XOUS_PROCESS_KEY", process_key_env)
.spawn() .spawn()
.map(ProcessHandle) .map(ProcessHandle)
.map_err(|e| { .map_err(|_| {
// eprintln!("couldn't start command: {}", e); // eprintln!("couldn't start command: {}", e);
crate::Error::InternalError crate::Error::InternalError
}); })
// println!("Process result: {:?}", result);
result
} }
pub fn wait_process(mut joiner: ProcessHandle) -> crate::SysCallResult { pub fn wait_process(mut joiner: ProcessHandle) -> crate::SysCallResult {
@ -407,8 +405,8 @@ fn xous_connect_impl(
mailbox: Arc::new(Mutex::new(HashMap::new())), mailbox: Arc::new(Mutex::new(HashMap::new())),
}) })
} }
Err(e) => { Err(_e) => {
// eprintln!("Unable to connect to Xous server: {}", e); // eprintln!("Unable to connect to Xous server: {}", _e);
// eprintln!( // eprintln!(
// "Ensure Xous is running, or specify this process as an argument to the kernel" // "Ensure Xous is running, or specify this process as an argument to the kernel"
// ); // );

View file

@ -1,6 +1,9 @@
use crate::{MemoryAddress, PID, TID}; use crate::{MemoryAddress, PID, TID};
use core::convert::TryInto; use core::convert::TryInto;
mod mem;
pub use mem::*;
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub struct ProcessArgs { pub struct ProcessArgs {
name: [u8; 16], name: [u8; 16],
@ -30,7 +33,7 @@ pub struct ProcessInit {
pub struct WaitHandle<T>(core::marker::PhantomData<T>); pub struct WaitHandle<T>(core::marker::PhantomData<T>);
pub struct ProcessHandle(()); 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, call as usize,
init.call as usize, init.call as usize,
@ -151,8 +154,8 @@ where
pub fn create_thread_simple_post<T, U>( pub fn create_thread_simple_post<T, U>(
_f: fn(T) -> U, _f: fn(T) -> U,
_arg: T, _arg: T,
thread_id: TID, _thread_id: TID,
) -> core::result::Result<WaitHandle<T>, crate::Error> ) -> core::result::Result<WaitHandle<U>, crate::Error>
where where
T: Send + 'static, T: Send + 'static,
U: Send + 'static, U: Send + 'static,