summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2014-07-15 22:11:23 +0000
committerChristopher Faylor <me@cgf.cx>2014-07-15 22:11:23 +0000
commit6f05b327678f5081df227a6b11aed66837b82971 (patch)
tree987fad28cdb9429cbf9167b16269915db2ac8ff7
parent0db2f28fd613bfffeb994e09ac3b1d41c5cbf51a (diff)
downloadcygnal-6f05b327678f5081df227a6b11aed66837b82971.tar.gz
cygnal-6f05b327678f5081df227a6b11aed66837b82971.tar.bz2
cygnal-6f05b327678f5081df227a6b11aed66837b82971.zip
* 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.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/sigproc.cc16
2 files changed, 21 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c8ed712ff..d1bac2ff0 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
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.
2014-07-14 Christopher Faylor <me.cygwin2014@cgf.cx>
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index a530c89ca..f04c01386 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -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. */