From 80ac635ceb815baa8f8eaef27bf1703f59cfc02f Mon Sep 17 00:00:00 2001 From: Able Date: Mon, 7 Feb 2022 20:18:23 -0600 Subject: [PATCH] relocate --- .gitignore | 4 +- userland/README.md | 2 + .../aos_wasm_stress_test}/.cargo/config.toml | 0 .../aos_wasm_stress_test}/Cargo.lock | 0 .../aos_wasm_stress_test}/Cargo.toml | 0 .../aos_wasm_stress_test}/readme.md | 0 .../aos_wasm_stress_test}/src/main.rs | 0 .../lib_syscalls}/C/file_calls.c | 0 .../lib_syscalls}/README.md | 0 userland/rname/Cargo.lock | 7 +++ userland/rname/Cargo.toml | 8 ++++ userland/rname/src/main.rs | 44 +++++++++++++++++++ 12 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 userland/README.md rename {aos_wasm_stress_test => userland/aos_wasm_stress_test}/.cargo/config.toml (100%) rename {aos_wasm_stress_test => userland/aos_wasm_stress_test}/Cargo.lock (100%) rename {aos_wasm_stress_test => userland/aos_wasm_stress_test}/Cargo.toml (100%) rename {aos_wasm_stress_test => userland/aos_wasm_stress_test}/readme.md (100%) rename {aos_wasm_stress_test => userland/aos_wasm_stress_test}/src/main.rs (100%) rename {lib_syscalls => userland/lib_syscalls}/C/file_calls.c (100%) rename {lib_syscalls => userland/lib_syscalls}/README.md (100%) create mode 100644 userland/rname/Cargo.lock create mode 100644 userland/rname/Cargo.toml create mode 100644 userland/rname/src/main.rs diff --git a/.gitignore b/.gitignore index f58b9cb..7cc8399 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 0000000..d8df701 --- /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 0000000..c4f7097 --- /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 0000000..8f2e8e2 --- /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 0000000..3aa10d0 --- /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) + } +}