Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-03-22 16:49:46 +0300
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-04-01 19:03:15 +0300
commite9c96f0a6daaad41920eea7ff84c8ce95918f1a3 (patch)
tree5e701ced36486137fcb5e8f69798f8071bf9fe73 /winsup/cygwin/sigproc.cc
parentaac414986fcf5fd66b76d061eda3d3618d64eff1 (diff)
Cygwin: pipe: Avoid deadlock for non-cygwin writer.
- As mentioned in commit message of the commit b531d6b0, if multiple writers including non-cygwin app exist, the non-cygwin app cannot detect pipe closure on the read side when the pipe is created by system account or the the pipe creator is running as service. This is because query_hdl which is held in write side also is a read end of the pipe, so the pipe is still alive for the non-cygwin app even after the reader is closed. To avoid this problem, this patch lets all processes in the same process group close query_hdl using newly introduced internal signal __SIGNONCYGCHLD when non-cygwin app is started. Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251097.html
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index d3f2b0c6a..62df96652 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1477,6 +1477,16 @@ wait_sig (VOID *)
clearwait = true;
}
break;
+ case __SIGNONCYGCHLD:
+ cygheap_fdenum cfd (false);
+ while (cfd.next () >= 0)
+ if (cfd->get_dev () == FH_PIPEW)
+ {
+ fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
+ if (pipe->need_close_query_hdl ())
+ pipe->close_query_handle ();
+ }
+ break;
}
if (clearwait && !have_execed)
proc_subproc (PROC_CLEARWAIT, 0);