summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pipe.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-10-23 19:01:47 +0000
committerChristopher Faylor <me@cgf.cx>2011-10-23 19:01:47 +0000
commit31d2bedc585420092eb53895c5f5646651f13215 (patch)
tree4e7ab98f866744fb5fd40c22db63a8113226df41 /winsup/cygwin/pipe.cc
parent1f012519e4954361e3f5c8ad4eab79cde57a510c (diff)
downloadcygnal-31d2bedc585420092eb53895c5f5646651f13215.tar.gz
cygnal-31d2bedc585420092eb53895c5f5646651f13215.tar.bz2
cygnal-31d2bedc585420092eb53895c5f5646651f13215.zip
* fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for testing
ReadFile return. * pipe.cc (fhandler_pipe::create_selectable): Open the write side of the pipe in message-mode to force writing as "chunks". Explain why.
Diffstat (limited to 'winsup/cygwin/pipe.cc')
-rw-r--r--winsup/cygwin/pipe.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc
index aa56cf531..99c79121e 100644
--- a/winsup/cygwin/pipe.cc
+++ b/winsup/cygwin/pipe.cc
@@ -238,9 +238,15 @@ fhandler_pipe::create_selectable (LPSECURITY_ATTRIBUTES sa_ptr, HANDLE& r,
It's important to only allow a single instance, to ensure that
the pipe was not created earlier by some other process, even if
the pid has been reused. We avoid FILE_FLAG_FIRST_PIPE_INSTANCE
- because that is only available for Win2k SP2 and WinXP. */
+ because that is only available for Win2k SP2 and WinXP.
+
+ Note that the write side of the pipe is opened as PIPE_TYPE_MESSAGE.
+ This *seems* to more closely mimic Linux pipe behavior and is
+ definitely required for pty handling since fhandler_pty_master
+ writes to the pipe in chunks, terminated by newline when CANON mode
+ is specified. */
r = CreateNamedPipe (pipename, PIPE_ACCESS_INBOUND | overlapped,
- PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 1, psize,
+ PIPE_TYPE_MESSAGE | PIPE_READMODE_BYTE, 1, psize,
psize, NMPWAIT_USE_DEFAULT_WAIT, sa_ptr);
if (r != INVALID_HANDLE_VALUE)