dup3/O_CLOEXEC/F_DUPFD_CLOEXEC

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Thu Jan 14 07:00:00 GMT 2010


On Wed, Jan 13, 2010 at 09:00:19PM -0700, Eric Blake wrote:
>>    MALLOC_CHECK;
>> -  debug_printf ("dup2 (%d, %d)", oldfd, newfd);
>> +  debug_printf ("dup3 (%d, %d, %d)", oldfd, newfd, flags);
>
>I'd prefer %#x for flags, rather than %d (two instances in this function).

In that case it should be %p to be consistent with other uses.

>> +      set_errno (EBADF);
>> +      return -1;
>> +    }
>> +  if (!cygheap->fdtab.not_open (oldfd) && oldfd == newfd)
>
>Is not_open() expensive?  If so, reverse the order of the conditionals for
>speed.

Yes, not_open() is expensive.

cgf



More information about the Cygwin-patches mailing list