exfile / file locking
aland at deployingradius.com
Tue Jul 25 15:09:44 CEST 2017
On Jul 25, 2017, at 8:29 AM, Phil Mayers <p.mayers at imperial.ac.uk> wrote:
> What I don't understand is why the code open()s to one FD but returns a dup()d FD to the caller. This seems to accomplish nothing - you're still paying for a context switch on the dup() and it's frankly hard for me to believe that saving the open() is worth the extra code complexity, but I'm assuming there's a reason.
Hmm... I thought so, but perhaps not...
> Unless I'm missing something, the mutex around the exfile isn't dependent on the dup()ing of the FD?
It returns from exfile_open() with the mutex held. So the dup() is done while the mutex is locked.
The exfile_close() releases the mutex.
More information about the Freeradius-Devel