Skip to content

Commit

Permalink
Merge pull request #1048 from no92/wait4
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennisbonke authored Apr 2, 2024
2 parents bbb349b + 6ee9371 commit 8a02b79
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sysdeps/managarm/generic/fork-exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ int sys_futex_wake(int *pointer) {
}

int sys_waitpid(pid_t pid, int *status, int flags, struct rusage *ru, pid_t *ret_pid) {
if(ru) {
mlibc::infoLogger() << "mlibc: struct rusage in sys_waitpid is unsupported" << frg::endlog;
return ENOSYS;
}

SignalGuard sguard;

managarm::posix::CntRequest<MemoryAllocator> req(getSysdepsAllocator());
Expand Down Expand Up @@ -89,6 +84,12 @@ int sys_waitpid(pid_t pid, int *status, int flags, struct rusage *ru, pid_t *ret
if(status)
*status = resp.mode();
*ret_pid = resp.pid();

if(ru != nullptr) {
ru->ru_utime.tv_sec = resp.ru_user_time() / 1'000'000'000;
ru->ru_utime.tv_usec = (resp.ru_user_time() % 1'000'000'000) / 1'000;
}

return 0;
}

Expand Down

0 comments on commit 8a02b79

Please sign in to comment.