git: 8c84ca657bb3 - main - linux(4): Implement sched_rr_get_interval_time64 syscall.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 May 2022 10:08:06 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8c84ca657bb343b73f315520ac3cabc43c5a67ec commit 8c84ca657bb343b73f315520ac3cabc43c5a67ec Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2022-05-04 10:06:47 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-05-04 10:06:47 +0000 linux(4): Implement sched_rr_get_interval_time64 syscall. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/compat/linux/linux_misc.c | 45 +++++++++++++++++++++++++------ sys/i386/linux/linux_dummy_machdep.c | 1 - 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index fb7c88629af7..e14da5b74733 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -77,4 +77,3 @@ DUMMY(recvmmsg_time64); DUMMY(mq_timedsend_time64); DUMMY(mq_timedreceive_time64); DUMMY(semtimedop_time64); -DUMMY(sched_rr_get_interval_time64); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 8a9e34d6cae3..118318d9bae1 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -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(<s, &ts); @@ -2688,6 +2698,25 @@ linux_sched_rr_get_interval(struct thread *td, return (copyout(<s, 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(<s, &ts); + if (error != 0) + return (error); + return (copyout(<s, 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. diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index 071f5fff6f47..cbe945e00635 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -79,4 +79,3 @@ DUMMY(recvmmsg_time64); DUMMY(mq_timedsend_time64); DUMMY(mq_timedreceive_time64); DUMMY(semtimedop_time64); -DUMMY(sched_rr_get_interval_time64);