1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 00:16:17 +04:00

Fix get_ppid for init process

This commit is contained in:
Jiajie Chen 2019-04-17 00:28:34 +08:00
parent cd2a2e23bb
commit b5f194d20f

View File

@ -231,7 +231,11 @@ pub fn sys_gettid() -> SysResult {
/// Get the parent process id
pub fn sys_getppid() -> SysResult {
Ok(process().parent.as_ref().unwrap().lock().pid.get())
if let Some(ref parent) = process().parent.as_ref() {
Ok(parent.lock().pid.get())
} else {
Ok(0)
}
}
/// Exit the current thread