forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#131654 - betrusted-io:xous-various-fixes, r…
…=thomcc Various fixes for Xous This patchset includes several fixes for Xous that have crept in over the last few months: * The `adjust_process()` syscall was incorrect * Warnings have started appearing in `alloc` -- adopt the same approach as wasm, until wasm figures out a workaround * Dead code warnings have appeared in the networking code. Add `allow(dead_code)` as these structs are used as IPC values * Add support for `args` and `env`, which have been useful for running tests * Update `unwinding` to `0.2.3` which fixes the recent regression due to changes in `asm!()` code
- Loading branch information
Showing
11 changed files
with
518 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use crate::ffi::OsString; | ||
use crate::sys::pal::xous::os::get_application_parameters; | ||
use crate::sys::pal::xous::os::params::ArgumentList; | ||
use crate::{fmt, vec}; | ||
|
||
pub struct Args { | ||
parsed_args_list: vec::IntoIter<OsString>, | ||
} | ||
|
||
pub fn args() -> Args { | ||
let Some(params) = get_application_parameters() else { | ||
return Args { parsed_args_list: vec![].into_iter() }; | ||
}; | ||
|
||
for param in params { | ||
if let Ok(args) = ArgumentList::try_from(¶m) { | ||
let mut parsed_args = vec![]; | ||
for arg in args { | ||
parsed_args.push(arg.into()); | ||
} | ||
return Args { parsed_args_list: parsed_args.into_iter() }; | ||
} | ||
} | ||
Args { parsed_args_list: vec![].into_iter() } | ||
} | ||
|
||
impl fmt::Debug for Args { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
self.parsed_args_list.as_slice().fmt(f) | ||
} | ||
} | ||
|
||
impl Iterator for Args { | ||
type Item = OsString; | ||
fn next(&mut self) -> Option<OsString> { | ||
self.parsed_args_list.next() | ||
} | ||
fn size_hint(&self) -> (usize, Option<usize>) { | ||
self.parsed_args_list.size_hint() | ||
} | ||
} | ||
|
||
impl DoubleEndedIterator for Args { | ||
fn next_back(&mut self) -> Option<OsString> { | ||
self.parsed_args_list.next_back() | ||
} | ||
} | ||
|
||
impl ExactSizeIterator for Args { | ||
fn len(&self) -> usize { | ||
self.parsed_args_list.len() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.