diff options
author | Bryan Cantrill <bryan@joyent.com> | 2012-02-22 14:00:06 -0500 |
---|---|---|
committer | Bryan Cantrill <bryan@joyent.com> | 2012-02-22 14:00:06 -0500 |
commit | 13a426762210070b1e2dd1184ea1a88ec0d227e8 (patch) | |
tree | 874b1ed27896507e171d86ff4fe20eb271e399ce /usr/src/uts/common/os/timer.c | |
parent | 45e662eb8429b38c18931ebeed30f2e5287ae51b (diff) | |
download | illumos-joyent-13a426762210070b1e2dd1184ea1a88ec0d227e8.tar.gz |
1941 timer intervals incorrectly rounded to clock resolution
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/uts/common/os/timer.c')
-rw-r--r-- | usr/src/uts/common/os/timer.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/usr/src/uts/common/os/timer.c b/usr/src/uts/common/os/timer.c index 57c1ed97bd..8559d8736c 100644 --- a/usr/src/uts/common/os/timer.c +++ b/usr/src/uts/common/os/timer.c @@ -24,7 +24,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012, Joyent, Inc. All rights reserved. + */ #include <sys/timer.h> #include <sys/systm.h> @@ -741,7 +743,6 @@ int timer_settime(timer_t tid, int flags, itimerspec_t *val, itimerspec_t *oval) { itimerspec_t when; - timespec_t res; itimer_t *it; proc_t *p = curproc; int error; @@ -772,25 +773,6 @@ timer_settime(timer_t tid, int flags, itimerspec_t *val, itimerspec_t *oval) if ((it = timer_grab(p, tid)) == NULL) return (set_errno(EINVAL)); - /* - * From the man page: - * Time values that are between two consecutive non-negative - * integer multiples of the resolution of the specified timer - * shall be rounded up to the larger multiple of the resolution. - * We assume that the resolution of any clock is less than one second. - */ - if (it->it_backend->clk_clock_getres(&res) == 0 && res.tv_nsec > 1) { - long rem; - - if ((rem = when.it_interval.tv_nsec % res.tv_nsec) != 0) { - when.it_interval.tv_nsec += res.tv_nsec - rem; - timespecfix(&when.it_interval); - } - if ((rem = when.it_value.tv_nsec % res.tv_nsec) != 0) { - when.it_value.tv_nsec += res.tv_nsec - rem; - timespecfix(&when.it_value); - } - } error = it->it_backend->clk_timer_settime(it, flags, &when); timer_release(p, it); |