This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: close-on-exec internal file descriptors


On Fri, Dec 05, 2008 at 05:38:13PM -0700, Tom Tromey wrote:
> +/* Like open, but ensure that the resulting file descriptor is marked
> +   close-on-exec, if possible.  */
> +int
> +open_cloexec (const char *path, int flags, int mode)
> +{
> +#ifdef O_CLOEXEC
> +  return open (path, flags | O_CLOEXEC, mode);

If you build with headers that include O_CLOEXEC support, but the
running kernel is too old, will this fail to open entirely?  Or are
unknown open flags ignored?

Also, WDYT about separating the goal from the mechanism?  With this
patch, every bit of gdb knows "we close file descriptors on exec";
if it was gdb_open, it would just be "gdb-specific version of open".

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]