rlm_linelog & locking
Phil Mayers
p.mayers at imperial.ac.uk
Tue Apr 21 17:10:34 CEST 2009
Alan DeKok wrote:
> Phil Mayers wrote:
>> It appears rlm_linelog doesn't lock the file before writing to it.
>> Should it? Won't lines get interspersed at high logging rates if not?
>
> IIRC, using O_APPEND, and writing small amounts means that the writes
> are "all or nothing". i.e. The OS takes care of ensuring that the write
> succeeds.
Ah - I see man 2 write says:
"""If the file was open(2)ed with O_APPEND, the file offset is first set
to the end of the file before writing. The adjustment of the file
offset and the write operation are performed as an atomic step..."""
...and goes on to list the (few) circumstances under which the number of
bytes written is < number of bytes in buffer - basically, signals or out
of disk space.
Cool - thanks!
More information about the Freeradius-Users
mailing list