Implement the typical use of waitpid
This commit is contained in:
parent
e680a84a57
commit
3e726a5d0d
1 changed files with 146 additions and 101 deletions
15
kernel/syscall/validate.rs
Normal file
15
kernel/syscall/validate.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use core::slice;
|
||||
|
||||
use super::Result;
|
||||
|
||||
/// Convert a pointer and length to slice, if valid
|
||||
/// TODO: Check validity
|
||||
pub fn validate_slice<T>(ptr: *const T, len: usize) -> Result<&'static [T]> {
|
||||
Ok(unsafe { slice::from_raw_parts(ptr, len) })
|
||||
}
|
||||
|
||||
/// Convert a pointer and length to slice, if valid
|
||||
/// TODO: Check validity
|
||||
pub fn validate_slice_mut<T>(ptr: *mut T, len: usize) -> Result<&'static mut [T]> {
|
||||
Ok(unsafe { slice::from_raw_parts_mut(ptr, len) })
|
||||
}
|
||||
Loading…
Reference in a new issue