aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorJohn Dyson <dyson@FreeBSD.org>1996-02-07 06:41:56 +0000
committerJohn Dyson <dyson@FreeBSD.org>1996-02-07 06:41:56 +0000
commit26d2f00960f5868d796730af86b7cba96207c43b (patch)
tree9efbc7cd02b3b63573e75b6912f5ff9c19975922 /sys/kern/sys_pipe.c
parentcc54f38c511336173666c46b0c2aca120f1e7584 (diff)
downloadsrc-26d2f00960f5868d796730af86b7cba96207c43b.tar.gz
src-26d2f00960f5868d796730af86b7cba96207c43b.zip
Apparent fix for a pipe hang problem.
Notes
Notes: svn path=/head/; revision=13951
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 2d26850a2f43..3e627f72a885 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: sys_pipe.c,v 1.6 1996/02/04 22:09:05 dyson Exp $
+ * $Id: sys_pipe.c,v 1.8 1996/02/05 05:50:34 dyson Exp $
*/
#ifndef OLD_PIPE
@@ -585,15 +585,25 @@ pipe_direct_write(wpipe, uio)
struct uio *uio;
{
int error;
+retry:
while (wpipe->pipe_state & PIPE_DIRECTW) {
+ if ( wpipe->pipe_state & PIPE_WANTR) {
+ wpipe->pipe_state &= ~PIPE_WANTR;
+ wakeup(wpipe);
+ }
+
error = tsleep(wpipe,
PRIBIO|PCATCH, "pipdww", 0);
if (error || (wpipe->pipe_state & PIPE_EOF))
goto error1;
}
wpipe->pipe_map.cnt = 0; /* transfer not ready yet */
- wpipe->pipe_state |= PIPE_DIRECTW;
- while (wpipe->pipe_buffer.cnt > 0) {
+ if (wpipe->pipe_buffer.cnt > 0) {
+ if ( wpipe->pipe_state & PIPE_WANTR) {
+ wpipe->pipe_state &= ~PIPE_WANTR;
+ wakeup(wpipe);
+ }
+
error = tsleep(wpipe,
PRIBIO|PCATCH, "pipdwc", 0);
if (error || (wpipe->pipe_state & PIPE_EOF)) {
@@ -602,8 +612,11 @@ pipe_direct_write(wpipe, uio)
error = EPIPE;
goto error1;
}
+ goto retry;
}
+ wpipe->pipe_state |= PIPE_DIRECTW;
+
error = pipe_build_write_buffer(wpipe, uio);
if (error) {
wpipe->pipe_state &= ~PIPE_DIRECTW;