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...");
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"
// );

View file

@ -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<T>(core::marker::PhantomData<T>);
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<T, U>(
_f: fn(T) -> U,
_arg: T,
thread_id: TID,
) -> core::result::Result<WaitHandle<T>, crate::Error>
_thread_id: TID,
) -> core::result::Result<WaitHandle<U>, crate::Error>
where
T: Send + 'static,
U: Send + 'static,