summaryrefslogtreecommitdiffstats
path: root/sys/compat/freebsd32/freebsd32_misc.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-07-21 19:43:52 +0000
committerkib <kib@FreeBSD.org>2013-07-21 19:43:52 +0000
commita7dacef5abe44a69d8f8d3f79d753a984e59c17c (patch)
tree82302b154c4760230b54ab99ddf9e43c17de823d /sys/compat/freebsd32/freebsd32_misc.c
parente9d8b81db78ac44bc32831cd4227161dafd886bd (diff)
downloadFreeBSD-src-a7dacef5abe44a69d8f8d3f79d753a984e59c17c.zip
FreeBSD-src-a7dacef5abe44a69d8f8d3f79d753a984e59c17c.tar.gz
Implement compat32 wrappers for the ktimer_* syscalls.
Reported, reviewed and tested by: Petr Salinger <Petr.Salinger@seznam.cz> Sponsored by: The FreeBSD Foundation MFC after: 1 week
Diffstat (limited to 'sys/compat/freebsd32/freebsd32_misc.c')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 13d2bcb..4899e03 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -2331,6 +2331,70 @@ freebsd32_clock_getres(struct thread *td,
return (error);
}
+int freebsd32_ktimer_create(struct thread *td,
+ struct freebsd32_ktimer_create_args *uap)
+{
+ struct sigevent32 ev32;
+ struct sigevent ev, *evp;
+ int error, id;
+
+ if (uap->evp == NULL) {
+ evp = NULL;
+ } else {
+ evp = &ev;
+ error = copyin(uap->evp, &ev32, sizeof(ev32));
+ if (error != 0)
+ return (error);
+ error = convert_sigevent32(&ev32, &ev);
+ if (error != 0)
+ return (error);
+ }
+ error = kern_ktimer_create(td, uap->clock_id, evp, &id, -1);
+ if (error == 0) {
+ error = copyout(&id, uap->timerid, sizeof(int));
+ if (error != 0)
+ kern_ktimer_delete(td, id);
+ }
+ return (error);
+}
+
+int
+freebsd32_ktimer_settime(struct thread *td,
+ struct freebsd32_ktimer_settime_args *uap)
+{
+ struct itimerspec32 val32, oval32;
+ struct itimerspec val, oval, *ovalp;
+ int error;
+
+ error = copyin(uap->value, &val32, sizeof(val32));
+ if (error != 0)
+ return (error);
+ ITS_CP(val32, val);
+ ovalp = uap->ovalue != NULL ? &oval : NULL;
+ error = kern_ktimer_settime(td, uap->timerid, uap->flags, &val, ovalp);
+ if (error == 0 && uap->ovalue != NULL) {
+ ITS_CP(oval, oval32);
+ error = copyout(&oval32, uap->ovalue, sizeof(oval32));
+ }
+ return (error);
+}
+
+int
+freebsd32_ktimer_gettime(struct thread *td,
+ struct freebsd32_ktimer_gettime_args *uap)
+{
+ struct itimerspec32 val32;
+ struct itimerspec val;
+ int error;
+
+ error = kern_ktimer_gettime(td, uap->timerid, &val);
+ if (error == 0) {
+ ITS_CP(val, val32);
+ error = copyout(&val32, uap->value, sizeof(val32));
+ }
+ return (error);
+}
+
int
freebsd32_clock_getcpuclockid2(struct thread *td,
struct freebsd32_clock_getcpuclockid2_args *uap)
OpenPOWER on IntegriCloud