diff --git a/.gitignore b/.gitignore index f58b9cb1..7cc83998 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ ableos/target aos_wasm_stress_test/target facepalm/target shadeable/target -qprofiler \ No newline at end of file +qprofiler +userland/*/target + diff --git a/userland/README.md b/userland/README.md new file mode 100644 index 00000000..d8df701b --- /dev/null +++ b/userland/README.md @@ -0,0 +1,2 @@ +# ableOS userland + diff --git a/aos_wasm_stress_test/.cargo/config.toml b/userland/aos_wasm_stress_test/.cargo/config.toml similarity index 100% rename from aos_wasm_stress_test/.cargo/config.toml rename to userland/aos_wasm_stress_test/.cargo/config.toml diff --git a/aos_wasm_stress_test/Cargo.lock b/userland/aos_wasm_stress_test/Cargo.lock similarity index 100% rename from aos_wasm_stress_test/Cargo.lock rename to userland/aos_wasm_stress_test/Cargo.lock diff --git a/aos_wasm_stress_test/Cargo.toml b/userland/aos_wasm_stress_test/Cargo.toml similarity index 100% rename from aos_wasm_stress_test/Cargo.toml rename to userland/aos_wasm_stress_test/Cargo.toml diff --git a/aos_wasm_stress_test/readme.md b/userland/aos_wasm_stress_test/readme.md similarity index 100% rename from aos_wasm_stress_test/readme.md rename to userland/aos_wasm_stress_test/readme.md diff --git a/aos_wasm_stress_test/src/main.rs b/userland/aos_wasm_stress_test/src/main.rs similarity index 100% rename from aos_wasm_stress_test/src/main.rs rename to userland/aos_wasm_stress_test/src/main.rs diff --git a/lib_syscalls/C/file_calls.c b/userland/lib_syscalls/C/file_calls.c similarity index 100% rename from lib_syscalls/C/file_calls.c rename to userland/lib_syscalls/C/file_calls.c diff --git a/lib_syscalls/README.md b/userland/lib_syscalls/README.md similarity index 100% rename from lib_syscalls/README.md rename to userland/lib_syscalls/README.md diff --git a/userland/rname/Cargo.lock b/userland/rname/Cargo.lock new file mode 100644 index 00000000..c4f70976 --- /dev/null +++ b/userland/rname/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "rname" +version = "0.1.0" diff --git a/userland/rname/Cargo.toml b/userland/rname/Cargo.toml new file mode 100644 index 00000000..8f2e8e28 --- /dev/null +++ b/userland/rname/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "rname" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/userland/rname/src/main.rs b/userland/rname/src/main.rs new file mode 100644 index 00000000..3aa10d09 --- /dev/null +++ b/userland/rname/src/main.rs @@ -0,0 +1,44 @@ +//! An implementation of the uname command. +//! +use crate::Arch::*; + +use core::fmt; + +// an example string "Darwin Roadrunner.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386" +pub struct RName { + pub arch: Arch, +} + +fn main() { + let mut rname_string = "".to_string(); + + rname_string.push_str("ableOS"); + + let arch = Some(X86_64); + if let Some(arch) = arch { + let fmt_str = format!(" {:?}", arch); + rname_string.push_str(&fmt_str); + } + + println!("{}", rname_string); +} +#[derive(Debug, Clone, Copy)] +pub enum Arch { + X86, + X86_64, + ARM, + ARM64, + PPC, + PPC64, + MIPS, + MIPS64, + SPARC, + SPARC64, + Unknown, +} + +impl fmt::Display for Arch { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self) + } +}