Subject: Re: File::Tail is broken on NetBSD -current FFS
To: None <charlie@eatyourpets.com, jdolecek@netbsd.org, greywolf@starwolf.com,>
From: Matija Grabnar <matija.grabnar@arnes.si>
List: current-users
Date: 05/15/2002 11:20:53
charlie@eatyourpets.com said:
> It _seems_ like that code uses select() on the descriptor. However,
> select() on NetBSD (and I believe all *BSD*) returns immediatelly for
> regular files. The semantics for regular files might be different on
> Linux or Solaris. 

No, no, NO! File::Tail does NOT do a select on file. It **PROVIDES**
a select that works on file, but DOES NOT rely on the operating system 
to provide a select that works like that. In fact, I don't know of 
any operating system where select works on ordinary files.

The "eats all CPU" bug usualy comes from problems with Time::HiRes.
File::Tail relies on Time::HiRes to provide a version of sleep that
takes fractional seconds (so that sleep(0.25) will sleep for a quarter of 
a second). Unfortunately, if Time::HiRes has a problems, that means that
the system sleep is called, and in most implementations, sleep for less 
than one second does NO sleep at all - leading to busy waiting on the 
file, which is exactly the thing that File::Tail tries to avoid. 

Please, doublecheck that Time::HiRes is correctly installed and 
correctly exports the sub-second sleep, so that sleep (0.1), sleep (0.2)
etc do the *right thing* and don't return immediately.

I suppose I will have to recode File::Tail to explicitly call usleep,
so that if Time::HiRes doesn't load correctly, at least File::Tail
will fail instead of appearing to be written by an incompetent.

Best regards,
         Matija Grabnar
-- 
"My name is Not Important. Not to friends. 
    But you can call me mr. Important"  - Not J. Important 
Matija.Grabnar@arnes.si