Re: [PATCH v2] Cygwin: open: Unlock fdtab before open_with_arch()

Mark Geisert <[email protected]> Fri, 17 Jul 2026 23:16:46 -0700 (PDT)
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
Hi Takashi,
I agree with your comments on my comments. As a check against regression, 
could you please run Christian's OPEN_MAX STC on your patched system when 
you have a chance?  Here's the STC in case you don't have it...
----8<----
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>


int main()
{
    for (int i = 0; i < 10000; i++) {
      char name[32];
      snprintf(name, sizeof(name), "file-%04d.tmp", i);
      errno = 0;
      int fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666);
      if (fd >= 0)
        continue;
      printf("open(%s, ...)=%d (errno=%d)\n", name, fd, errno);
      struct stat st;
      printf("stat(%s, ...)=%d\n", name, stat(name, &st));
      break;
    }
    return 0;
}
---->8----
Success is indicated by a report of error 24 when attempting to create 
file-3197.tmp. Don't forget to delete the 3196 file-*.tmp files after.

If that test works your patch is GTG as far as I'm concerned. I believe it 
should go to both 3.6.11 and 3.7.0.
Thanks & Regards,

..mark