修复了wait4的异常报错 (#312)

* 修复了wait4的异常报错
This commit is contained in:
Chiichen 2023-08-02 14:29:59 +08:00 committed by GitHub
parent 821bb9a2dc
commit 4da3758acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -41,8 +41,9 @@ impl Syscall {
) -> Result<usize, SystemError> {
let ret = unsafe { c_sys_wait4(pid, wstatus, options, rusage) };
if (ret as isize) < 0 {
return Err(SystemError::from_posix_errno(-(ret as isize) as i32)
.expect("wait4: Invalid errno"));
return Err(
SystemError::from_posix_errno((ret as isize) as i32).expect("wait4: Invalid errno")
);
}
return Ok(ret as usize);
}

View File

@ -120,6 +120,12 @@ int rm(const char * path);
*/
void swab(void *restrict src, void *restrict dest, ssize_t nbytes);
/**
* @brief pipe
* @param fildes fildes[0]fildes[1]
*/
int pipe(int fildes[2]);
pid_t getpid(void);
int dup(int fd);