summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/ntdll.h8
-rw-r--r--winsup/cygwin/select.cc2
3 files changed, 14 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 299caf708..1272c87da 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2011-06-03 Christopher Faylor <me.cygwin2011@cgf.cx>
+ * ntdll.h (FILE_PIPE_*): Define constants.
+ * select.cc (pipe_data_available): Detect closing state.
+
+2011-06-03 Christopher Faylor <me.cygwin2011@cgf.cx>
+
* pinfo.cc (_pinfo::set_ctty): Don't reset myself->{pgid,sid} if
terminal has no pgid or sid settings.
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index 82b6cff47..29e6412d6 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -800,6 +800,14 @@ typedef struct _FILE_ALL_INFORMATION {
FILE_NAME_INFORMATION NameInformation;
} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
+enum
+{
+ FILE_PIPE_DISCONNECTED_STATE = 1,
+ FILE_PIPE_LISTENING_STATE = 2,
+ FILE_PIPE_CONNECTED_STATE = 3,
+ FILE_PIPE_CLOSING_STATE = 4
+};
+
typedef struct _FILE_PIPE_LOCAL_INFORMATION
{
ULONG NamedPipeType;
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 7197ed117..6a827f70d 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -524,7 +524,7 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, bool writing)
res = true;
}
}
- return res;
+ return res ?: -!!(fpli.NamedPipeState & FILE_PIPE_CLOSING_STATE);
}
static int