[asterisk-dev] asterisk ast_close_fds_above_n, wtf?
Tilghman Lesher
tilghman at meg.abyt.es
Wed May 18 11:09:25 CDT 2011
On Wednesday 18 May 2011 09:53:24 Tilghman Lesher wrote:
> On Wednesday 18 May 2011 09:08:11 Paul Albrecht wrote:
> > To summarize for those that like to keep score: you have conceded that
> > the "close on exec" flag can be used reliably on linux and now you're
> > arguing that the "close on exec" flag isn't portable.
>
> I have not conceded that point. We have external libraries linked into
> Asterisk, and as those libraries do not consistently use the CLOEXEC
> flag, those file descriptors may remain open in a child process with
> your approach, while they will be closed with the approach used in
> Asterisk.
>
> > Well so what? The closefrom system call isn't portable either so
> > what's your point? As the preferred platform for asterisk is linux
> > you should be writing your code to that system interface. If you want
> > to port asterisk to other platforms then use the preprocessor to
> > conditionally generate whatever code you need for them.
>
> Thank you for your opinion on how you engineer your own projects. We
> prefer uniting the code as best as possible for portability. Our only
> limiting criteria is ensuring that the portability factor does not
> significantly impact Linux performance, and in this case, it does not.
>
> If you feel that the CLOEXEC approach is better, then I suggest that you
> work with POSIX to get that approach (and corresponding kernel APIs)
> into a forthcoming edition of the Unix standard. Following adoption of
> those API changes by the platforms we support, you are welcome to ask
> us to reconsider our approach at that time.
Just as a followup, it appears that this process of getting the CLOEXEC flag
into POSIX (atomic at FD creation) has already been started:
http://austingroupbugs.net/view.php?id=411
It appears to be targeted for issue 8, which is the next standard after
POSIX.1-2008.
Oh, and Paul, you're going to have to convince the maintainer of libcurl to
set the flag in that library by default, as it's one of the libraries that
we use in Asterisk. He remains unconvinced he should do anything, as
evidenced by his last email on the subject:
http://curl.haxx.se/mail/lib-2011-04/0215.html
Without the libraries that we use following that convention, we would have
file descriptor leaks in Asterisk if we followed your approach. That's not
acceptable to us, which is again why we adopted our current approach.
--
Tilghman
More information about the asterisk-dev
mailing list