mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
[orbis-kernel] Implement sys_nanosleep
This commit is contained in:
parent
191a9459af
commit
b969ce893a
2 changed files with 23 additions and 5 deletions
|
|
@ -108,9 +108,27 @@ orbis::SysResult orbis::sys_clock_getres(Thread *thread, clockid_t clock_id,
|
|||
ptr<timespec> tp) {
|
||||
return ErrorCode::NOSYS;
|
||||
}
|
||||
orbis::SysResult orbis::sys_nanosleep(Thread *thread, ptr<const timespec> rqtp,
|
||||
ptr<timespec> rmtp) {
|
||||
return ErrorCode::NOSYS;
|
||||
orbis::SysResult orbis::sys_nanosleep(Thread *thread,
|
||||
cptr<orbis::timespec> rqtp,
|
||||
ptr<orbis::timespec> rmtp) {
|
||||
ORBIS_LOG_TRACE(__FUNCTION__, rqtp, rmtp);
|
||||
struct ::timespec rq;
|
||||
struct ::timespec rm;
|
||||
orbis::timespec value;
|
||||
if (auto e = uread(value, rqtp); e != ErrorCode{})
|
||||
return e;
|
||||
rq.tv_sec = value.sec;
|
||||
rq.tv_nsec = value.nsec;
|
||||
if (::nanosleep(&rq, &rm) == EINTR) {
|
||||
if (rmtp) {
|
||||
value.sec = rm.tv_sec;
|
||||
value.nsec = rm.tv_nsec;
|
||||
if (auto e = uwrite(rmtp, value); e != ErrorCode{})
|
||||
return e;
|
||||
}
|
||||
return ErrorCode::INTR;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
orbis::SysResult orbis::sys_gettimeofday(Thread *thread, ptr<orbis::timeval> tp,
|
||||
ptr<orbis::timezone> tzp) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue