GNU bug report logs - #9101
timeout should use setitimer if available

Previous Next

Package: coreutils;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sat, 16 Jul 2011 19:29:02 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 9101 <at> debbugs.gnu.org
Subject: bug#9101: timeout should use setitimer if available
Date: Tue, 19 Jul 2011 23:24:48 +0100
[Message part 1 (text/plain, inline)]
On 19/07/11 19:45, Paul Eggert wrote:
> On 07/19/11 04:00, Pádraig Brady wrote:
> 
>> +  if (timer_create (CLOCK_REALTIME, NULL, &timerid) == -1)
>> +    error (EXIT_FAILURE, errno, _("error in timer_create"));
>> +  if (timer_settime (timerid, 0, &its, NULL) == -1)
>> +    error (EXIT_FAILURE, errno, _("error in timer_settime"));
> 
> A minor point: the usual (more-conservative, and often-faster) style
> in coreutils is to write "foo (...) != 0" rather than "foo (...) ==
> -1" for system calls that return 0 or -1.
> 
>> We could remove the setitimer stuff altogether and
>> just support 1 second resolution on darwin et. al.
>> That's by far the most common use case anyway.
> 

OK I'll do that, encompassing your fallback suggestion.

> 
>> The gnulib check could be lumped into clock_time, like:
> 
> Yes, that would work, but the clock-time module probably should stay
> decoupled from timer_settime.  How about the following (untested)
> patch instead?  The idea is to append "timeout_LDADD +=
> $(LIB_TIMER_SETTIME)" to src/Makefile.am.
> 
> diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4

I'd rather not add this into jm-macros.
How about just adding a module to gnulib
where others might find it useful too?
Proposed module attached.

cheers,
Pádraig.
[timer-time.diff (text/x-patch, attachment)]

This bug report was last modified 6 years and 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.