On Thu, Apr 01, 1999 at 11:31:59PM -0500, Jay Soffian wrote:
>  Doesn't the presence of any messages in the new dir indicate "You
> have new mail." and the presence of any messages in the cur dir
> indicate "You have mail."

Yes, if you use those words, but the prompt is really saying that "You
have new unread mail." which is different.

> So you need to do an opendir and a readdir,
> but you can stop at the first directory entry that looks like a valid
> message. Hopefully I'm not being to naive. I'm hoping that the OS does
> _not_ in fact read in the entire directory and then libc just returns
> one entry at a time. If this is the case, then while you are saving
> some CPU by not iterating though all of the directory entries, the
> disk access is still the same, which is likely the expensive part.

On Linux, readdir is implemented with getdents, which returns multiple
entries at once.  However, it does not likely return more than one
block's worth of entries, in which case there is no extra I/O being done
anyways.  IOW, yes the OS reads more than one but it doesn't really make
a difference.
-- 
Bruce Guenter, QCC Communications Corp.  EMail: [EMAIL PROTECTED]
Phone: (306)249-0220               WWW: http://www.qcc.sk.ca/~bguenter/

Reply via email to