aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linux/linux_event.c16
-rw-r--r--sys/compat/linux/linux_futex.c4
-rw-r--r--sys/compat/linux/linux_misc.c4
-rw-r--r--sys/compat/linux/linux_socket.c4
-rw-r--r--sys/compat/linuxkpi/common/include/linux/time.h4
5 files changed, 15 insertions, 17 deletions
diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index ae6cb83c9e7a..bb4825574ed5 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -1183,7 +1183,7 @@ linux_timerfd_curval(struct timerfd *tfd, struct itimerspec *ots)
linux_timerfd_clocktime(tfd, &cts);
*ots = tfd->tfd_time;
if (ots->it_value.tv_sec != 0 || ots->it_value.tv_nsec != 0) {
- timespecsub(&ots->it_value, &cts);
+ timespecsub(&ots->it_value, &cts, &ots->it_value);
if (ots->it_value.tv_sec < 0 ||
(ots->it_value.tv_sec == 0 &&
ots->it_value.tv_nsec == 0)) {
@@ -1265,9 +1265,10 @@ linux_timerfd_settime(struct thread *td, struct linux_timerfd_settime_args *args
linux_timerfd_clocktime(tfd, &cts);
ts = nts.it_value;
if ((args->flags & LINUX_TFD_TIMER_ABSTIME) == 0) {
- timespecadd(&tfd->tfd_time.it_value, &cts);
+ timespecadd(&tfd->tfd_time.it_value, &cts,
+ &tfd->tfd_time.it_value);
} else {
- timespecsub(&ts, &cts);
+ timespecsub(&ts, &cts, &ts);
}
TIMESPEC_TO_TIMEVAL(&tv, &ts);
callout_reset(&tfd->tfd_callout, tvtohz(&tv),
@@ -1303,13 +1304,13 @@ linux_timerfd_expire(void *arg)
if (timespeccmp(&cts, &tfd->tfd_time.it_value, >=)) {
if (timespecisset(&tfd->tfd_time.it_interval))
timespecadd(&tfd->tfd_time.it_value,
- &tfd->tfd_time.it_interval);
+ &tfd->tfd_time.it_interval,
+ &tfd->tfd_time.it_value);
else
/* single shot timer */
timespecclear(&tfd->tfd_time.it_value);
if (timespecisset(&tfd->tfd_time.it_value)) {
- ts = tfd->tfd_time.it_value;
- timespecsub(&ts, &cts);
+ timespecsub(&tfd->tfd_time.it_value, &cts, &ts);
TIMESPEC_TO_TIMEVAL(&tv, &ts);
callout_reset(&tfd->tfd_callout, tvtohz(&tv),
linux_timerfd_expire, tfd);
@@ -1319,8 +1320,7 @@ linux_timerfd_expire(void *arg)
selwakeup(&tfd->tfd_sel);
wakeup(&tfd->tfd_count);
} else if (timespecisset(&tfd->tfd_time.it_value)) {
- ts = tfd->tfd_time.it_value;
- timespecsub(&ts, &cts);
+ timespecsub(&tfd->tfd_time.it_value, &cts, &ts);
TIMESPEC_TO_TIMEVAL(&tv, &ts);
callout_reset(&tfd->tfd_callout, tvtohz(&tv),
linux_timerfd_expire, tfd);
diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c
index a82672eaa4f1..7c15af2d89c2 100644
--- a/sys/compat/linux/linux_futex.c
+++ b/sys/compat/linux/linux_futex.c
@@ -290,10 +290,10 @@ futex_copyin_timeout(int op, struct l_timespec *luts, int clockrt,
return (error);
if (clockrt) {
nanotime(&kts);
- timespecsub(ts, &kts);
+ timespecsub(ts, &kts, ts);
} else if (op == LINUX_FUTEX_WAIT_BITSET) {
nanouptime(&kts);
- timespecsub(ts, &kts);
+ timespecsub(ts, &kts, ts);
}
return (error);
}
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 95a8ab174e9d..516952fac490 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -2382,8 +2382,8 @@ linux_ppoll(struct thread *td, struct linux_ppoll_args *args)
if (error == 0 && args->tsp != NULL) {
if (td->td_retval[0]) {
nanotime(&ts1);
- timespecsub(&ts1, &ts0);
- timespecsub(&uts, &ts1);
+ timespecsub(&ts1, &ts0, &ts1);
+ timespecsub(&uts, &ts1, &uts);
if (uts.tv_sec < 0)
timespecclear(&uts);
} else
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 604627048ed0..d4f567b5192f 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1463,7 +1463,7 @@ linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args)
if (error != 0)
return (error);
getnanotime(&tts);
- timespecadd(&tts, &ts);
+ timespecadd(&tts, &ts, &tts);
}
msg = PTRIN(args->msg);
@@ -1492,7 +1492,7 @@ linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args)
*/
if (args->timeout) {
getnanotime(&ts);
- timespecsub(&ts, &tts);
+ timespecsub(&ts, &tts, &ts);
if (!timespecisset(&ts) || ts.tv_sec > 0)
break;
}
diff --git a/sys/compat/linuxkpi/common/include/linux/time.h b/sys/compat/linuxkpi/common/include/linux/time.h
index 9f69e95f6bf5..1c07c69a67a6 100644
--- a/sys/compat/linuxkpi/common/include/linux/time.h
+++ b/sys/compat/linuxkpi/common/include/linux/time.h
@@ -76,9 +76,7 @@ timespec_sub(struct timespec lhs, struct timespec rhs)
{
struct timespec ts;
- ts.tv_sec = lhs.tv_sec;
- ts.tv_nsec = lhs.tv_nsec;
- timespecsub(&ts, &rhs);
+ timespecsub(&lhs, &rhs, &ts);
return ts;
}