Skip to content

Commit 2aa1c88

Browse files
committed
Revert "Cygwin: pipe: Restore blocking mode of read pipe on close()/raw_read()"
This reverts commit c7fe29f.
1 parent 19b50e4 commit 2aa1c88

3 files changed

Lines changed: 8 additions & 45 deletions

File tree

‎winsup/cygwin/fhandler/pipe.cc‎

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ fhandler_pipe::set_pipe_non_blocking (bool nonblocking)
5454
NTSTATUS status;
5555
IO_STATUS_BLOCK io;
5656
FILE_PIPE_INFORMATION fpi;
57-
bool was_blocking_read_pipe_new = was_blocking_read_pipe;
58-
59-
if (get_device () == FH_PIPER && nonblocking && !was_blocking_read_pipe)
60-
{
61-
status = NtQueryInformationFile (get_handle (), &io, &fpi, sizeof fpi,
62-
FilePipeInformation);
63-
if (NT_SUCCESS (status))
64-
was_blocking_read_pipe_new =
65-
(fpi.CompletionMode == FILE_PIPE_QUEUE_OPERATION);
66-
}
6757

6858
fpi.ReadMode = FILE_PIPE_BYTE_STREAM_MODE;
6959
fpi.CompletionMode = nonblocking ? FILE_PIPE_COMPLETE_OPERATION
@@ -72,11 +62,6 @@ fhandler_pipe::set_pipe_non_blocking (bool nonblocking)
7262
FilePipeInformation);
7363
if (!NT_SUCCESS (status))
7464
debug_printf ("NtSetInformationFile(FilePipeInformation): %y", status);
75-
else
76-
{
77-
was_blocking_read_pipe = was_blocking_read_pipe_new;
78-
is_blocking_read_pipe = !nonblocking;
79-
}
8065
}
8166

8267
int
@@ -110,8 +95,6 @@ fhandler_pipe::init (HANDLE f, DWORD a, mode_t mode, int64_t uniq_id)
11095
even with FILE_SYNCHRONOUS_IO_NONALERT. */
11196
set_pipe_non_blocking (get_device () == FH_PIPER ?
11297
true : is_nonblocking ());
113-
was_blocking_read_pipe = false;
114-
11598
return 1;
11699
}
117100

@@ -306,9 +289,6 @@ fhandler_pipe::raw_read (void *ptr, size_t& len)
306289
if (!len)
307290
return;
308291

309-
if (is_blocking_read_pipe)
310-
set_pipe_non_blocking (true);
311-
312292
DWORD timeout = is_nonblocking () ? 0 : INFINITE;
313293
DWORD waitret = cygwait (read_mtx, timeout);
314294
switch (waitret)
@@ -741,8 +721,6 @@ fhandler_pipe::close ()
741721
CloseHandle (query_hdl);
742722
if (query_hdl_close_req_evt)
743723
CloseHandle (query_hdl_close_req_evt);
744-
if (was_blocking_read_pipe)
745-
set_pipe_non_blocking (false);
746724
int ret = fhandler_base::close ();
747725
ReleaseMutex (hdl_cnt_mtx);
748726
CloseHandle (hdl_cnt_mtx);
@@ -1399,7 +1377,6 @@ fhandler_pipe::spawn_worker (int fileno_stdin, int fileno_stdout,
13991377
{
14001378
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
14011379
pipe->set_pipe_non_blocking (false);
1402-
need_send_noncygchld_sig = true;
14031380
}
14041381

14051382
/* If multiple writers including non-cygwin app exist, the non-cygwin
@@ -1425,21 +1402,3 @@ fhandler_pipe::spawn_worker (int fileno_stdin, int fileno_stdout,
14251402
t->kill_pgrp (__SIGNONCYGCHLD);
14261403
}
14271404
}
1428-
1429-
void
1430-
fhandler_pipe::sigproc_worker (void)
1431-
{
1432-
cygheap_fdenum cfd (false);
1433-
while (cfd.next () >= 0)
1434-
if (cfd->get_dev () == FH_PIPEW)
1435-
{
1436-
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
1437-
if (pipe->need_close_query_hdl ())
1438-
pipe->close_query_handle ();
1439-
}
1440-
else if (cfd->get_dev () == FH_PIPER)
1441-
{
1442-
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
1443-
pipe->is_blocking_read_pipe = true;
1444-
}
1445-
}

‎winsup/cygwin/local_includes/fhandler.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,8 +1197,6 @@ class fhandler_pipe: public fhandler_pipe_fifo
11971197
private:
11981198
HANDLE read_mtx;
11991199
pid_t popen_pid;
1200-
bool was_blocking_read_pipe;
1201-
bool is_blocking_read_pipe;
12021200
HANDLE query_hdl;
12031201
HANDLE hdl_cnt_mtx;
12041202
HANDLE query_hdl_proc;
@@ -1289,7 +1287,6 @@ class fhandler_pipe: public fhandler_pipe_fifo
12891287
}
12901288
static void spawn_worker (int fileno_stdin, int fileno_stdout,
12911289
int fileno_stderr);
1292-
static void sigproc_worker (void);
12931290
};
12941291

12951292
#define CYGWIN_FIFO_PIPE_NAME_LEN 47

‎winsup/cygwin/sigproc.cc‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,14 @@ wait_sig (VOID *)
15251525
}
15261526
break;
15271527
case __SIGNONCYGCHLD:
1528-
fhandler_pipe::sigproc_worker ();
1528+
cygheap_fdenum cfd (false);
1529+
while (cfd.next () >= 0)
1530+
if (cfd->get_dev () == FH_PIPEW)
1531+
{
1532+
fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
1533+
if (pipe->need_close_query_hdl ())
1534+
pipe->close_query_handle ();
1535+
}
15291536
break;
15301537
}
15311538
if (clearwait && !have_execed)

0 commit comments

Comments
 (0)