Add wnohang, make PS/2 driver write input to display scheme, which then passes it to the shell

This commit is contained in:
Jeremy Soller 2016-09-22 10:10:27 -06:00
parent 046236c10f
commit 76b0c7eeea
9 changed files with 151 additions and 96 deletions

View file

@ -18,7 +18,7 @@ use elf::{self, program_header};
use scheme;
use syscall;
use syscall::error::*;
use syscall::flag::{CLONE_VM, CLONE_FS, CLONE_FILES, MAP_WRITE, MAP_WRITE_COMBINE};
use syscall::flag::{CLONE_VM, CLONE_FS, CLONE_FILES, MAP_WRITE, MAP_WRITE_COMBINE, WNOHANG};
use syscall::validate::{validate_slice, validate_slice_mut};
pub fn brk(address: usize) -> Result<usize> {
@ -594,7 +594,7 @@ pub fn sched_yield() -> Result<usize> {
Ok(0)
}
pub fn waitpid(pid: usize, status_ptr: usize, _options: usize) -> Result<usize> {
pub fn waitpid(pid: usize, status_ptr: usize, flags: usize) -> Result<usize> {
//TODO: Implement status_ptr and options
loop {
{
@ -616,6 +616,8 @@ pub fn waitpid(pid: usize, status_ptr: usize, _options: usize) -> Result<usize>
if exited {
let mut contexts = context::contexts_mut();
return contexts.remove(pid).ok_or(Error::new(ESRCH)).and(Ok(pid));
} else if flags & WNOHANG == WNOHANG {
return Ok(0);
}
}