Return to BSD News archive
Newsgroups: comp.unix.bsd Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!pipex!uknet!festival!edcogsci!richard From: richard@cogsci.ed.ac.uk (Richard Tobin) Subject: Re: Q: howto select() on diskfile ? Message-ID: <CHM8I3.9oM@cogsci.ed.ac.uk> Organization: HCRC, University of Edinburgh References: <CHHFGJ.F23@dmi.min.dk> Date: Mon, 6 Dec 1993 13:37:14 GMT Lines: 13 In article <CHHFGJ.F23@dmi.min.dk> ls@dmi.min.dk (Lennart Sorth) writes: >Can select() not be used for real disk-files - and why not ? Yes, but it doesn't do what you think. Essentially, select() returns when a read() wouldn't block; this is always true for a diskfile. If you're at the end-of-file, a read() will return immediately, rather than waiting for more data to be appended. To do what "tail -f" does, you have to do what "tail -f" does (:-) which is sleep for a bit and then see whether there's any more data. -- Richard --