mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-10 18:50:03 +01:00
[orbis-kernel] Implement sys_nanosleep
This commit is contained in:
parent
191a9459af
commit
b969ce893a
|
|
@ -228,8 +228,8 @@ SysResult sys_ktimer_settime(Thread *thread, sint timerid, sint flags,
|
|||
SysResult sys_ktimer_gettime(Thread *thread, sint timerid,
|
||||
ptr<struct itimerspec> value);
|
||||
SysResult sys_ktimer_getoverrun(Thread *thread, sint timerid);
|
||||
SysResult sys_nanosleep(Thread *thread, ptr<const timespec> rqtp,
|
||||
ptr<timespec> rmtp);
|
||||
SysResult sys_nanosleep(Thread *thread, cptr<orbis::timespec> rqtp,
|
||||
ptr<orbis::timespec> rmtp);
|
||||
SysResult sys_ntp_gettime(Thread *thread, ptr<struct ntptimeval> ntvp);
|
||||
SysResult sys_minherit(Thread *thread, ptr<void> addr, size_t len,
|
||||
sint inherit);
|
||||
|
|
|
|||
|
|
@ -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…
Reference in a new issue