[PATCH] Cygwin: introduce close_range

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jan 15 12:56:11 GMT 2024


On Jan 15 13:41, Christian Franke wrote:
> Corinna Vinschen wrote:
> > On Jan 15 13:07, Corinna Vinschen wrote:
> > > Sorry Christian, but..
> > > 
> > > I was just going to push this patch when I realized that we now have
> > > two lines of debug output per affected file descriptor:
> > > 
> > > On Jan 15 12:19, Christian Franke wrote:
> > > > +  for (unsigned int i = firstfd; i < size; i++)
> > > > +    {
> > > > +      cygheap_fdget cfd ((int) i, false, false);
> > > > +      if (cfd < 0)
> > > > +	continue;
> > > > +
> > > > +      if (flags & CLOSE_RANGE_CLOEXEC)
> > > > +	{
> > > > +	  syscall_printf ("set FD_CLOEXEC on fd %u", i);
> > > > +	  cfd->fcntl (F_SETFD, FD_CLOEXEC);
> > > fhandler::set_close_on_exec() already prints this:
> > > 
> > >    debug_printf ("set close_on_exec for %s to %d", get_name (), val);
> > > 
> > > > +	}
> > > > +      else
> > > > +	{
> > > > +	  syscall_printf ("closing fd %u", i);
> > > > +	  cfd->close_with_arch ();
> > > fhandler::close() already prints this:
> > > 
> > >    syscall_printf ("closing '%s' handle %p", get_name (), get_handle ());
> 
> I've also seen this duplication, but the drawback of the above messages is
> that the FD itself is not printed.

In both cases, that's right.  Good point, actually.

> So I decided to keep the
> syscall_printf().

I pushed the patch now with the additional syscall_printf, FWIW.
If they really annoy people, which unlikely, we can still drop them.


Thanks,
Corinna


More information about the Cygwin-patches mailing list