Web lists-archives.com

Re: I'm done with O_CLOEXEC

On Fri, Mar 20, 2015 at 7:29 PM, Christian Hergert <christian@xxxxxxxxxx> wrote:

This makes me happy. I don't think I've actually seen any of this stuff handled right. Not to mention that close() itself is basically broken in multi-threaded scenarios on Linux (Linus says to basically "just not worry about it" if you get EINTR, which may or may not have succeeded, and then the FD entry taken by another thread).

What I would welcome, is a function that says "glib, close all FDs you know about or that you created". If all the libraries did that, at least it would be possible for applications to maybe, sorta, do the right thing. (That would push the synchronization responsibility during fork()/exec() to the application).

no, it wouldn't.

as a pango user, do i call pango_close_all_fds_before_exec() or does gtk? or gdk? or ...

as a libfftw3 user, do i call fftw2_close_all_fds_before_exec() or does some other library that also uses it? (which i may know that i am using, or i may not (via loading some arbitrary module).

"call the close_before_exec() for all libraries that i know i explicitly call into and pray that the rest do the right things for other libraries that i don't explicitly use" .... this is a much weaker proposition.

what you want is "close_all_fds_before_exec()" that just gets the job done, in one place, in the application.
gtk-devel-list mailing list