[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kernel/2182: virtual interval timers always one-shot
The following reply was made to PR kernel/2182; it has been noted by GNATS.
From: Theo de Raadt <email@example.com>
Subject: Re: kernel/2182: virtual interval timers always one-shot
Date: Sat, 17 Nov 2001 17:44:37 -0700
Seems to work fine from what I see. Would have helped if you had
included a test program which fails, because mine seems to work.
Your comment about kern_time.c not even using it_interval is wrong
too, as grep will show.
Perhaps you did not read this paragraph:
If it_value is non-zero, it indicates the time to the next timer expira-
tion. If it_interval is non-zero, it specifies a value to be used in
reloading it_value when the timer expires. Setting it_value to 0 dis-
ables a timer. Setting it_interval to 0 causes a timer to be disabled
after its next expiration (assuming it_value is non-zero).
There does seem to be something strange with very small values of
it_interval, in particular, when the time is < 10000 usec.
int save_errno = errno;
write(STDOUT_FILENO, ".", 1);
errno = save_errno;
struct itimerval tvi;
struct sigaction sa;
tvi.it_interval.tv_sec = 1;
tvi.it_interval.tv_usec = 0;
tvi.it_value.tv_sec = 1;
tvi.it_value.tv_usec = 0;
memset(&sa, 0, sizeof sa);
sa.sa_handler = timer;
sa.sa_flags = SA_RESTART;
sigaction(SIGVTALRM, &sa, NULL);
setitimer(ITIMER_VIRTUAL, &tvi, NULL);