]> sourceware.org Git - newlib-cygwin.git/commitdiff
* sigproc.cc (sigproc_init): Set aside more buffer space for signal pipes.
authorChristopher Faylor <me@cgf.cx>
Tue, 15 Jul 2014 22:11:23 +0000 (22:11 +0000)
committerChristopher Faylor <me@cgf.cx>
Tue, 15 Jul 2014 22:11:23 +0000 (22:11 +0000)
(sig_send): Retry WriteFiles which fail when there is no error but packbytes
have not been sent.

winsup/cygwin/ChangeLog
winsup/cygwin/sigproc.cc

index c8ed712ff95d5cfe1dd34bdc18f0d78456deaffe..d1bac2ff03f584fbd12e0456a901e442d74393eb 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-15  Christopher Faylor  <me.cygwin2014@cgf.cx>
+
+       * sigproc.cc (sigproc_init): Set aside more buffer space for signal
+       pipes.
+       (sig_send): Retry WriteFiles which fail when there is no error but
+       packbytes have not been sent.
+
 2014-07-15  Christopher Faylor  <me.cygwin2014@cgf.cx>
 
        * sigproc.cc (send_sig): Don't report an error if WriteFile succeeds.
index a530c89caaf255521559eca4d2dd97bddaba9e83..f04c0138648c69156abfd29b51d96c87e35e19ed 100644 (file)
@@ -426,7 +426,7 @@ sigproc_init ()
   char char_sa_buf[1024];
   PSECURITY_ATTRIBUTES sa = sec_user_nih ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
   DWORD err = fhandler_pipe::create (sa, &my_readsig, &my_sendsig,
-                                    sizeof (sigpacket), "sigwait",
+                                    NSIG * sizeof (sigpacket), "sigwait",
                                     PIPE_ADD_PID);
   if (err)
     {
@@ -635,7 +635,19 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
     }
 
   DWORD nb;
-  if (!WriteFile (sendsig, leader, packsize, &nb, NULL))
+  BOOL res;
+  /* Try multiple times to send if packsize != nb since that probably
+     means that the pipe buffer is full.  */
+  for (int i = 0; i < 100; i++)
+    {
+      res = WriteFile (sendsig, leader, packsize, &nb, NULL);
+      if (!res || packsize == nb)
+       break;
+      Sleep (10);
+      res = 0;
+    }
+
+  if (!res)
     {
       /* Couldn't send to the pipe.  This probably means that the
         process is exiting.  */
This page took 0.033394 seconds and 5 git commands to generate.