Brendan O'Dea wrote: > found 448965 5.8.8-9 > thanks > > On 06/11/2007, Matthijs Melchior <[EMAIL PROTECTED]> wrote: > >> Brendan O'Dea wrote: >> > [drivel about usleep] > > Oops, sorry... > > >> Yes, indeed, there is no problem with usleep. The problem I noticed is >> with ualarm: >> >> setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 2000000}}, >> 0xbfe91468) = -1 EINVAL (Invalid argument) >> > > OK. I've replicated this with 5.8.8-9 and see your problem. > > On what version did this work for you? > > I see that there is code in Time/HiRes.xs to emulate ualarm() using > setitimer() which seems to correctly set the sec/usec components of > the timeval (it_value/it_interval) arguments, but this is not being > used with my current libc which has ualarm(). > > It seems possible that the version which worked for you was built > using this emiulated version. The current build is calling ualarm() > directly. > > Note the manual page for ualarm() states that values >= 1000000 may > cause EINVAL (as is occuring here). > > --bod > OK, I have done the test on an older installation where I had no problem using ualarm with times of more than 1 second. There I see the following:
$ strace -e setitimer perl -MTime::HiRes=ualarm -e 'ualarm 2000000; sleep 4' setitimer(ITIMER_REAL, {it_interval={0,0}, it_value={0, 2000000}}, {it_interval={0,0}, it_value={0,0}}) = 0 --- SIGALRM (Alarm clock) @ 0 (0) --- $ Here the kernel does not issue EINVAL and apparently normalizes the struct timeval before using it. The relevant versions installed on that machine are: Kernel: 2.6.15-1-686-smp #1 SMP Thu Jun 29 09:50:41 CEST 2006 i686 GNU/Linux ii perl 5.8.8-7 ii lib6 2.3.6.ds1-11 ii libdb4.4 4.4.20-8 ii libgdbm3 1.8.3-2 ii perl-base 5.8.8-7 ii perl-modules 5.8.8-7 The manual page also states ualarm is obsolete since POSIX.1-2001. I think the implementation using setitimer should be kept and used whenever setitimer is available. I am using ualarm to allow for fractional number of seconds for the alarm, because the standard alarm only knows about whole seconds. Thanks. -- Regards, ---------------------------------------------------------------- -o) Matthijs Melchior Maarssen /\\ [EMAIL PROTECTED] +31 346 570616 Netherlands _\_v ---------------------------------------------------------------- ---- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]