Add process stuff
This commit is contained in:
parent
a3456a5b99
commit
e0774b4d39
@ -12,6 +12,7 @@ pub use abi::path;
|
|||||||
pub mod alloc;
|
pub mod alloc;
|
||||||
pub mod debug;
|
pub mod debug;
|
||||||
pub mod netc;
|
pub mod netc;
|
||||||
|
pub mod process;
|
||||||
pub mod sys;
|
pub mod sys;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
|
|
||||||
|
6
src/process.rs
Normal file
6
src/process.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//! Process management data types
|
||||||
|
|
||||||
|
pub use abi::process::{SpawnOption, SpawnOptions};
|
||||||
|
|
||||||
|
/// Status code returned when a process terminates
|
||||||
|
pub type ExitStatus = i32;
|
15
src/sys.rs
15
src/sys.rs
@ -7,6 +7,7 @@ use abi::{
|
|||||||
DirectoryEntry, FileAttr, FileMode, MountOptions, OpenOptions, RawFd, SeekFrom,
|
DirectoryEntry, FileAttr, FileMode, MountOptions, OpenOptions, RawFd, SeekFrom,
|
||||||
UnmountOptions,
|
UnmountOptions,
|
||||||
},
|
},
|
||||||
|
process::SpawnOptions,
|
||||||
syscall::SyscallFunction,
|
syscall::SyscallFunction,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -316,3 +317,17 @@ pub unsafe fn get_metadata(
|
|||||||
pub unsafe fn seek(fd: RawFd, pos: SeekFrom) -> Result<u64, Error> {
|
pub unsafe fn seek(fd: RawFd, pos: SeekFrom) -> Result<u64, Error> {
|
||||||
u64::from_syscall_result(syscall!(SyscallFunction::Seek, argn!(fd.0), argn!(u64::from(pos))))
|
u64::from_syscall_result(syscall!(SyscallFunction::Seek, argn!(fd.0), argn!(u64::from(pos))))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
pub unsafe fn spawn(options: &SpawnOptions<'_>) -> Result<u32, Error> {
|
||||||
|
u32::from_syscall_result(syscall!(SyscallFunction::Spawn, argp!(options as *const _)))
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
pub unsafe fn wait_process(pid: u32, status: &mut i32) -> Result<(), Error> {
|
||||||
|
<()>::from_syscall_result(syscall!(
|
||||||
|
SyscallFunction::WaitProcess,
|
||||||
|
argn!(pid),
|
||||||
|
argp!(status as *mut _)
|
||||||
|
))
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user