tail -f

Dave Decot decot at hpisod2.HP.COM
Sat Dec 10 11:50:13 AEST 1988


> >Can someone please tell me how 'tail -f' works?.  Obviously, it does not
> >do a busy loop while doing a stat on the file.  I know that it has got
> >to be blocked, waiting for the length to change, but how does it get
> >notified of a change?  Thanks in advance for any responses.
> 
> Oh, dear, he used the "O" word.  One should be careful using that
> word....
> 
> In fact, it *does* do a busy loop while doing "read"s (not "stat"s) of
> the file; it just sleeps 1 second between attempts to "read", so it
> doesn't burn quite so much CPU doing it.  If there were some way for it
> to block waiting for the length to change, it would; however, there
> isn't any such way. 

I suppose it could use select(2)...

Dave



More information about the Comp.unix.questions mailing list