bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9101: timeout should use setitimer if available


From: Paul Eggert
Subject: bug#9101: timeout should use setitimer if available
Date: Mon, 18 Jul 2011 09:44:08 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11

On 07/18/11 03:01, Pádraig Brady wrote:
> I'll apply this soon.

Thanks for doing that. Some comments:

I see that my bug report was incoherent, as it was talking about
nanosecond resolution and setitimer, when I meant to be writing about
timer_settime (which *does* have nanosecond resolution).  Sorry about
that.

POSIX says that setitimer is obsolescent, and that applications should use
timer_settime.  How about if we add a gnulib module for timer_settime
and have 'timeout' use that instead?  (This could be a separate patch,
done later.)

   +  struct timespec ts = dtotimespec (duration);
   +  tv.tv_sec = MIN (ts.tv_sec, LONG_MAX); /* Assuming tv_sec is positive.  */

That second statement should be removed.  time_t is not necessarily
the same as 'long', and setitimer should work with values longer than
LONG_MAX, if time_t is wider than 'long'.  And parse_duration when
combined with dtotimespec guarantees that tv_sec is nonnegative here
(it might be zero), so that comment needs to be removed too.

   +      if (tv.tv_sec != LONG_MAX)

This LONG_MAX should be TYPE_MAXIMUM (time_t).

Of course all of this rounding-and-checking-for-overflow business
goes away once we go to timer_settime....






reply via email to

[Prev in Thread] Current Thread [Next in Thread]