Redo networking (#22)

* Rewriting network functions

* Add buffer to dup
Fix non-blocking handling by triggering once on enabling events to read to EOF

* Modifications for UDP API

* Implement TCP client side

* Add active close

* Add DMAR parser

* Implement basic TCP listening. Need to improve the state machine

* Reduce debugging

* Fixes for close procedure

* Updates to fix path processing in libstd
This commit is contained in:
Jeremy Soller 2016-10-26 13:19:56 -06:00 committed by GitHub
parent 268c859fd6
commit 2491e4771e
54 changed files with 1884 additions and 1476 deletions

View file

@ -56,7 +56,7 @@ impl Scheme for RootScheme {
}
}
fn dup(&self, file: usize) -> Result<usize> {
fn dup(&self, file: usize, _buf: &[u8]) -> Result<usize> {
let mut handles = self.handles.write();
let inner = {
let inner = handles.get(&file).ok_or(Error::new(EBADF))?;
@ -89,12 +89,24 @@ impl Scheme for RootScheme {
inner.write(buf)
}
fn fevent(&self, file: usize, _flags: usize) -> Result<usize> {
Ok(file)
fn fevent(&self, file: usize, flags: usize) -> Result<usize> {
let inner = {
let handles = self.handles.read();
let inner = handles.get(&file).ok_or(Error::new(EBADF))?;
inner.clone()
};
inner.fevent(flags)
}
fn fsync(&self, _file: usize) -> Result<usize> {
Ok(0)
fn fsync(&self, file: usize) -> Result<usize> {
let inner = {
let handles = self.handles.read();
let inner = handles.get(&file).ok_or(Error::new(EBADF))?;
inner.clone()
};
inner.fsync()
}
fn close(&self, file: usize) -> Result<usize> {