Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern On pipe reads, check for EOF before FNONBLOCK to av...
details: https://anonhg.NetBSD.org/src/rev/947a08cc371b
branches: trunk
changeset: 543010:947a08cc371b
user: pk <pk%NetBSD.org@localhost>
date: Fri Feb 14 13:16:44 2003 +0000
description:
On pipe reads, check for EOF before FNONBLOCK to avoid spurious EAGAIN errors.
diffstat:
sys/kern/sys_pipe.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diffs (49 lines):
diff -r c22db8ff8782 -r 947a08cc371b sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c Fri Feb 14 11:05:39 2003 +0000
+++ b/sys/kern/sys_pipe.c Fri Feb 14 13:16:44 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_pipe.c,v 1.35 2003/02/12 21:54:16 pk Exp $ */
+/* $NetBSD: sys_pipe.c,v 1.36 2003/02/14 13:16:44 pk Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.35 2003/02/12 21:54:16 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.36 2003/02/14 13:16:44 pk Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -490,14 +490,6 @@
if (nread > 0)
break;
- /*
- * don't block on non-blocking I/O
- */
- if (fp->f_flag & FNONBLOCK) {
- error = EAGAIN;
- break;
- }
-
PIPE_LOCK(rpipe);
/*
@@ -510,6 +502,15 @@
}
/*
+ * don't block on non-blocking I/O
+ */
+ if (fp->f_flag & FNONBLOCK) {
+ PIPE_UNLOCK(rpipe);
+ error = EAGAIN;
+ break;
+ }
+
+ /*
* Unlock the pipe buffer for our remaining processing.
* We will either break out with an error or we will
* sleep and relock to loop.
Home |
Main Index |
Thread Index |
Old Index