Converting file handles into a new type FileHandle
Keeping file handles (and pids, and scheme id, ...) as usize is a footgun. Let's remove it.
This commit is contained in:
parent
37a34ab7f7
commit
9c90a8fe42
7 changed files with 53 additions and 43 deletions
|
@ -43,6 +43,7 @@ extern crate goblin;
|
|||
extern crate spin;
|
||||
|
||||
use core::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
|
||||
use scheme::FileHandle;
|
||||
|
||||
#[macro_use]
|
||||
#[macro_export]
|
||||
|
@ -93,9 +94,9 @@ pub fn cpu_count() -> usize {
|
|||
pub extern fn userspace_init() {
|
||||
assert_eq!(syscall::chdir(b"initfs:bin"), Ok(0));
|
||||
|
||||
assert_eq!(syscall::open(b"debug:", 0), Ok(0));
|
||||
assert_eq!(syscall::open(b"debug:", 0), Ok(1));
|
||||
assert_eq!(syscall::open(b"debug:", 0), Ok(2));
|
||||
assert_eq!(syscall::open(b"debug:", 0).map(FileHandle::into), Ok(0));
|
||||
assert_eq!(syscall::open(b"debug:", 0).map(FileHandle::into), Ok(1));
|
||||
assert_eq!(syscall::open(b"debug:", 0).map(FileHandle::into), Ok(2));
|
||||
|
||||
syscall::exec(b"initfs:bin/init", &[]).expect("failed to execute initfs:init");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue