25 Jul
2017
25 Jul
'17
9:09 a.m.
On Jul 25, 2017, at 8:29 AM, Phil Mayers <p.mayers@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. Alan DeKok.