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
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2008-05-30 21:56:37 +0400
committerChristopher Faylor <me@cgf.cx>2008-05-30 21:56:37 +0400
commit11a36faaa631c7fa429a087b4463ed377f616500 (patch)
tree5f68c2d33d9aff25f74398bc8a9619855812a533 /winsup
parent4f3af63913104f4f5514257cc18e908aa57b054b (diff)
* select.cc (peek_pipe): Semi-reinstate pipe NT-special write detection.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/select.cc26
2 files changed, 17 insertions, 14 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a7da1003a..f29ccff0f 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-30 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * select.cc (peek_pipe): Semi-reinstate pipe NT-special write
+ detection.
+
2008-05-29 Christopher Faylor <me+cygwin@cgf.cx>
* devices.in: Change mapping for /dev/ttyS* and /dev/com*.
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 5c26248ab..d11a1158e 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -16,6 +16,7 @@ details. */
#include "winsup.h"
#include <stdlib.h>
+#include "ntdll.h"
#include <wingdi.h>
#include <winuser.h>
@@ -294,7 +295,7 @@ select_stuff::wait (fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
select_printf ("woke up. wait_ret %d. verifying", wait_ret);
s = &start;
bool gotone = false;
- /* Some types of object (e.g., consoles) wake up on "inappropriate" events
+ /* Some types of objects (e.g., consoles) wake up on "inappropriate" events
like mouse movements. The verify function will detect these situations.
If it returns false, then this wakeup was a false alarm and we should go
back to waiting. */
@@ -505,10 +506,6 @@ out:
fh->get_name ());
else
{
-#if 0
-/* FIXME: This code is not quite correct. There's no better solution
- so far but to always treat the write side of the pipe as writable. */
-
IO_STATUS_BLOCK iosb = {0};
FILE_PIPE_LOCAL_INFORMATION fpli = {0};
@@ -519,19 +516,18 @@ out:
FilePipeLocalInformation))
{
/* If NtQueryInformationFile fails, optimistically assume the
- pipe is writable. This could happen on Win9x, because
- NtQueryInformationFile is not available, or if we somehow
+ pipe is writable. This could happen if we somehow
inherit a pipe that doesn't permit FILE_READ_ATTRIBUTES
access on the write end. */
select_printf ("%s, NtQueryInformationFile failed",
fh->get_name ());
gotone += s->write_ready = true;
}
- /* Ensure that enough space is available for atomic writes,
- as required by POSIX. Subsequent writes with size > PIPE_BUF
- can still block, but most (all?) UNIX variants seem to work
- this way (e.g., BSD, Linux, Solaris). */
- else if (fpli.WriteQuotaAvailable >= PIPE_BUF)
+ /* If there is anything available in the pipe buffer then signal
+ that. This means that a pipe could still block since you could
+ be trying to write more to the pipe than is available in the
+ buffer but that is the hazard of select(). */
+ else if (fpli.WriteQuotaAvailable)
{
select_printf ("%s, ready for write: size %lu, avail %lu",
fh->get_name (),
@@ -539,6 +535,10 @@ out:
fpli.WriteQuotaAvailable);
gotone += s->write_ready = true;
}
+#if 0
+/* FIXME: This code is not quite correct. There's no better solution
+ so far but to make simple assumptions based on WriteQuotaAvailable. */
+
/* If we somehow inherit a tiny pipe (size < PIPE_BUF), then consider
the pipe writable only if it is completely empty, to minimize the
probability that a subsequent write will block. */
@@ -551,8 +551,6 @@ out:
fpli.WriteQuotaAvailable);
gotone += s->write_ready = true;
}
-#else
- gotone += s->write_ready = true;
#endif
}
}