dup3/O_CLOEXEC/F_DUPFD_CLOEXEC

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Wed Jan 13 21:49:00 GMT 2010


On Wed, Jan 13, 2010 at 10:25:37PM +0100, Corinna Vinschen wrote:
>Hi,
>
>the below patch implements the Linux dup3/O_CLOEXEC/F_DUPFD_CLOEXEC
>extension.  I hope I didn't miss anything important since it affects
>quite a few fhandlers.  Fortunately most is mechanical change, except
>for a few places (dtable.cc, pipe.cc, fhandeler_fifo.cc, syscalls.cc).
>Nevertheless, I'd be glad if somebody could have a second look into
>this.
>
>Eric, you asked for it in the first place, do you have a fine testcase
>for this functionality?

The number of times that you typed:

  sa_buf = close_on_exec ()
              ? sec_user_nih ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid())
              : sec_user ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());

implies that this should be a macro or a function.

Could the setting of close_on_exec be handled in the syscalls.cc open()
so that it doesn't have to be done so many times?  You could have
build_fh_name set the noexec flag so that close_on_exec() would still
work in the fhandler_*::open functions.

cgf



More information about the Cygwin-patches mailing list