mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 17:33:23 +00:00
Remove the shim kernel crate
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
d76c7a5b1e
commit
dafd16075f
24
kernel/src/syscall/waitid.rs
Normal file
24
kernel/src/syscall/waitid.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::SyscallReturn;
|
||||
use crate::{
|
||||
prelude::*,
|
||||
process::{wait_child_exit, ProcessFilter, WaitOptions},
|
||||
};
|
||||
|
||||
pub fn sys_waitid(
|
||||
which: u64,
|
||||
upid: u64,
|
||||
_infoq_addr: u64,
|
||||
options: u64,
|
||||
_rusage_addr: u64,
|
||||
_ctx: &Context,
|
||||
) -> Result<SyscallReturn> {
|
||||
// FIXME: what does infoq and rusage use for?
|
||||
let process_filter = ProcessFilter::from_which_and_id(which, upid)?;
|
||||
let wait_options = WaitOptions::from_bits(options as u32)
|
||||
.ok_or(Error::with_message(Errno::EINVAL, "invalid options"))?;
|
||||
let waited_process = wait_child_exit(process_filter, wait_options)?;
|
||||
let pid = waited_process.map_or(0, |process| process.pid());
|
||||
Ok(SyscallReturn::Return(pid as _))
|
||||
}
|
Reference in New Issue
Block a user