Skip to content

Commit

Permalink
Merge pull request o8vm#12 from viniciusfdasilva/main
Browse files Browse the repository at this point in the history
[FEATURE] - Removing permission to kill root process and Adding clear to coreutils
  • Loading branch information
o8vm authored Apr 11, 2024
2 parents 4722f3e + ef22de1 commit c90d1fc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/kernel/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,12 @@ impl SysCalls {
#[cfg(all(target_os = "none", feature = "kernel"))]
{
let pid = argraw(0);
kill(pid)

if pid == 0 {
Err(PermissionDenied)
}else{
kill(pid)
}
}
}
pub fn uptime() -> Result<usize> {
Expand Down
4 changes: 4 additions & 0 deletions src/user/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ path = "bin/wc.rs"
name = "_head"
path = "bin/head.rs"

[[bin]]
name = "_clear"
path = "bin/clear.rs"

[dependencies]
libkernel = { workspace = true }

Expand Down
14 changes: 14 additions & 0 deletions src/user/bin/clear.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

#![no_std]

use ulib::{
io::Write,
stdio::{stdout}
};


fn main() {

// clear the screen
stdout().write(b"\x1b[2J\x1b[H").unwrap();
}

0 comments on commit c90d1fc

Please sign in to comment.