Re: exim can hold mainlog files open for a long time .....

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: tron
Fecha:  
A: Piete.Brooks, ph10
Cc: exim-users
Asunto: Re: exim can hold mainlog files open for a long time .....
>Is stat() more expensive than time()? That is what it seems to come down
>to. Either stat() for each log write to see if the file has changed, or
>check the time() and close/reopen after a certain period (possibly only
>after a stat() to double-check).


The time needed to do a stat is insignificant if you are duplicating a
stat that you have done recently, since all data required for a stat is
cached. The pathname lookups, in particular, are generally cached well
enough that directories (which are almost certainly in-core) would
rarely need to be rescanned on a busy mail system. So, yes, stat() is
more expensive than time(), but is probably unmeasurably cheap next to
the time required for mail delivery.

Note that this analysis does not apply to systems that process mail
less frequently.  The pathname cache is typically not very large, so
entries in it don't live for very long.  Also, the directory and inode
data needed for the stat will be removed from memory if unused for some
number of minutes.  So, stat is much more expensive than time() on
systems that deliver a relatively small amount of mail, but who cares.
-- 
    Ronald S. Karr
    tron |-<=>-|    tron@???