1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

linux(4): Implement sched_rr_get_interval_time64 syscall.

MFC after:		2 weeks
This commit is contained in:
Dmitry Chagin 2022-05-04 13:06:47 +03:00
parent cdddbb77c3
commit 8c84ca657b
3 changed files with 37 additions and 10 deletions

View File

@ -77,4 +77,3 @@ DUMMY(recvmmsg_time64);
DUMMY(mq_timedsend_time64);
DUMMY(mq_timedreceive_time64);
DUMMY(semtimedop_time64);
DUMMY(sched_rr_get_interval_time64);

View File

@ -2658,12 +2658,10 @@ linux_pollout(struct thread *td, struct pollfd *fds, struct pollfd *ufds, u_int
return (0);
}
int
linux_sched_rr_get_interval(struct thread *td,
struct linux_sched_rr_get_interval_args *uap)
static int
linux_sched_rr_get_interval_common(struct thread *td, pid_t pid,
struct timespec *ts)
{
struct timespec ts;
struct l_timespec lts;
struct thread *tdt;
int error;
@ -2671,15 +2669,27 @@ linux_sched_rr_get_interval(struct thread *td,
* According to man in case the invalid pid specified
* EINVAL should be returned.
*/
if (uap->pid < 0)
if (pid < 0)
return (EINVAL);
tdt = linux_tdfind(td, uap->pid, -1);
tdt = linux_tdfind(td, pid, -1);
if (tdt == NULL)
return (ESRCH);
error = kern_sched_rr_get_interval_td(td, tdt, &ts);
error = kern_sched_rr_get_interval_td(td, tdt, ts);
PROC_UNLOCK(tdt->td_proc);
return (error);
}
int
linux_sched_rr_get_interval(struct thread *td,
struct linux_sched_rr_get_interval_args *uap)
{
struct timespec ts;
struct l_timespec lts;
int error;
error = linux_sched_rr_get_interval_common(td, uap->pid, &ts);
if (error != 0)
return (error);
error = native_to_linux_timespec(&lts, &ts);
@ -2688,6 +2698,25 @@ linux_sched_rr_get_interval(struct thread *td,
return (copyout(&lts, uap->interval, sizeof(lts)));
}
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
int
linux_sched_rr_get_interval_time64(struct thread *td,
struct linux_sched_rr_get_interval_time64_args *uap)
{
struct timespec ts;
struct l_timespec64 lts;
int error;
error = linux_sched_rr_get_interval_common(td, uap->pid, &ts);
if (error != 0)
return (error);
error = native_to_linux_timespec64(&lts, &ts);
if (error != 0)
return (error);
return (copyout(&lts, uap->interval, sizeof(lts)));
}
#endif
/*
* In case when the Linux thread is the initial thread in
* the thread group thread id is equal to the process id.

View File

@ -79,4 +79,3 @@ DUMMY(recvmmsg_time64);
DUMMY(mq_timedsend_time64);
DUMMY(mq_timedreceive_time64);
DUMMY(semtimedop_time64);
DUMMY(sched_rr_get_interval_time64);