From: Tom Tromey <tromey@redhat.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: close-on-exec internal file descriptors
Date: Sat, 06 Dec 2008 22:06:00 -0000 [thread overview]
Message-ID: <m3skp1ufgi.fsf@fleche.redhat.com> (raw)
In-Reply-To: <200812061540.mB6FemZD011819@brahms.sibelius.xs4all.nl> (Mark Kettenis's message of "Sat\, 6 Dec 2008 16\:40\:48 +0100 \(CET\)")
>>>>> "Mark" == Mark Kettenis <mark.kettenis@xs4all.nl> writes:
Tom> I chose to take advantage of the new glibc flags like O_CLOEXEC when
Tom> they are available. This is friendlier in the Python case -- here,
Tom> gdb might have multiple threads, and the glibc flags enable us to
TOM> avoid a window where a file descriptor is not marked close-on-exec.
Mark> Sorry, but I don't see the point in having #ifdef O_CLOEXEC code
Mark> when there is a perfectly portable way to do this using fcntl.
It is better for thread safety. This matters in the Python case.
Mark> It leads to more bits of code that can possibly go untested.
I will try to add a test case. That will address this.
Mark> I also think it would actually be better to explicitly close file
Mark> descriptors before doing an exec instead of relying on people to use
Mark> the proper _cloexec call throughout gdb.
Why do you think this?
I think that it is difficult to truly ensure reliability with either
approach. We might miss an open, but so too we might miss a
fork/exec. The more libraries we use, the more likely this becomes.
But, since gdb and all its dependencies are free software, I think we
might as well try to implement the better approach, whichever that is.
In my view, close-on-exec is preferable. It better communicates the
intent of the programmer, and in the library case it is an abstraction
barrier.
Tom
next prev parent reply other threads:[~2008-12-06 22:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-06 0:39 Tom Tromey
2008-12-06 8:14 ` Eli Zaretskii
2008-12-06 15:58 ` Tom Tromey
2008-12-06 16:52 ` Daniel Jacobowitz
2008-12-06 17:05 ` Eli Zaretskii
2008-12-06 16:54 ` Eli Zaretskii
2008-12-06 15:26 ` Daniel Jacobowitz
2008-12-06 15:59 ` Tom Tromey
2008-12-06 15:42 ` Mark Kettenis
2008-12-06 22:06 ` Tom Tromey [this message]
2008-12-07 19:26 ` Mark Kettenis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3skp1ufgi.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox