Mercurial > illumos > illumos-gate
changeset 13616:5d28731f11c2
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>
author | Bryan Cantrill <bryan@joyent.com> |
---|---|
date | Wed, 22 Feb 2012 14:00:06 -0500 |
parents | 824064bb7f53 |
children | 189bdb3d9698 |
files | usr/src/uts/common/os/timer.c |
diffstat | 1 files changed, 3 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/os/timer.c Wed Jun 22 10:30:44 2011 -0700 +++ b/usr/src/uts/common/os/timer.c Wed Feb 22 14:00:06 2012 -0500 @@ -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 @@ 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 @@ 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);