aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2022-05-04 10:06:49 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2022-05-04 10:06:49 +0000
commita1fd2911ddb06c1a2d23ebb636a46bc20ca498e7 (patch)
tree70c53f64612b9df16fd283e4f65d49542df6b7ee /sys/compat/linux
parent9038a0b74cf74c73cea635ae2fff51706cc9ab33 (diff)
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_timer.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_timer.c b/sys/compat/linux/linux_timer.c
index 83c099fbc800..3e844704f132 100644
--- a/sys/compat/linux/linux_timer.c
+++ b/sys/compat/linux/linux_timer.c
@@ -123,20 +123,54 @@ linux_timer_settime(struct thread *td, struct linux_timer_settime_args *uap)
{
struct l_itimerspec l_val, l_oval;
struct itimerspec val, oval, *ovalp;
- int error;
+ int flags, error;
+
+ error = copyin(uap->new, &l_val, sizeof(l_val));
+ if (error != 0)
+ return (error);
+ error = linux_to_native_itimerspec(&val, &l_val);
+ if (error != 0)
+ return (error);
+ ovalp = uap->old != NULL ? &oval : NULL;
+ error = linux_to_native_timerflags(&flags, uap->flags);
+ if (error != 0)
+ return (error);
+ error = kern_ktimer_settime(td, uap->timerid, flags, &val, ovalp);
+ if (error == 0 && uap->old != NULL) {
+ error = native_to_linux_itimerspec(&l_val, &val);
+ if (error == 0)
+ error = copyout(&l_oval, uap->old, sizeof(l_oval));
+ }
+ return (error);
+}
+
+#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
+int
+linux_timer_settime64(struct thread *td, struct linux_timer_settime64_args *uap)
+{
+ struct l_itimerspec64 l_val, l_oval;
+ struct itimerspec val, oval, *ovalp;
+ int flags, error;
error = copyin(uap->new, &l_val, sizeof(l_val));
if (error != 0)
return (error);
- ITS_CP(l_val, val);
+ error = linux_to_native_itimerspec64(&val, &l_val);
+ if (error != 0)
+ return (error);
ovalp = uap->old != NULL ? &oval : NULL;
- error = kern_ktimer_settime(td, uap->timerid, uap->flags, &val, ovalp);
+ error = linux_to_native_timerflags(&flags, uap->flags);
+ if (error != 0)
+ return (error);
+ error = kern_ktimer_settime(td, uap->timerid, flags, &val, ovalp);
if (error == 0 && uap->old != NULL) {
- ITS_CP(oval, l_oval);
- error = copyout(&l_oval, uap->old, sizeof(l_oval));
+ error = native_to_linux_itimerspec64(&l_val, &val);
+ if (error == 0)
+ error = copyout(&l_oval, uap->old, sizeof(l_oval));
}
return (error);
}
+#endif
int
linux_timer_gettime(struct thread *td, struct linux_timer_gettime_args *uap)