Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Revert most of the previous change.
details: https://anonhg.NetBSD.org/src/rev/74d5a4d57960
branches: trunk
changeset: 749959:74d5a4d57960
user: dsl <dsl%NetBSD.org@localhost>
date: Sun Dec 13 18:27:02 2009 +0000
description:
Revert most of the previous change.
Only one fd needs clobbering, not all fds that reference the pipe.
This may be what ad@ realised when he tried to add the same code to
sockets. Unfixes part of PR/26567.
diffstat:
sys/kern/sys_pipe.c | 26 ++++++++++----------------
sys/sys/pipe.h | 3 +--
2 files changed, 11 insertions(+), 18 deletions(-)
diffs (80 lines):
diff -r 71f552a501e6 -r 74d5a4d57960 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c Sun Dec 13 17:58:27 2009 +0000
+++ b/sys/kern/sys_pipe.c Sun Dec 13 18:27:02 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_pipe.c,v 1.123 2009/12/12 21:28:04 dsl Exp $ */
+/* $NetBSD: sys_pipe.c,v 1.124 2009/12/13 18:27:02 dsl Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.123 2009/12/12 21:28:04 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.124 2009/12/13 18:27:02 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -542,12 +542,8 @@
* Detect EOF condition.
* Read returns 0 on EOF, no need to set error.
*/
- if (rpipe->pipe_state & (PIPE_EOF | PIPE_ABORTED)) {
- if (rpipe->pipe_state & PIPE_ABORTED)
- /* Another thread has called close() */
- error = EBADF;
+ if (rpipe->pipe_state & PIPE_EOF)
break;
- }
/*
* Don't block on non-blocking I/O.
@@ -984,13 +980,6 @@
break;
}
- if (wpipe->pipe_state & PIPE_ABORTED) {
- /* Another thread has called close() */
- if (uio->uio_resid == 0)
- error = EBADF;
- break;
- }
-
/*
* We have no more space and have something to offer,
* wake up select/poll.
@@ -1220,9 +1209,14 @@
{
struct pipe *pipe = fp->f_data;
- /* Unblock blocked reads/writes - they will return EBADF. */
+ /*
+ * Unblock blocked reads/writes in order to allow close() to complete.
+ * This isn't going to work yet!
+ * The underlying problem is that only the 'fd' in question needs
+ * its operations terminating, the pipe itself my be open via
+ * other fd.
+ */
mutex_enter(pipe->pipe_lock);
- pipe->pipe_state |= PIPE_ABORTED;
cv_broadcast(&pipe->pipe_rcv);
cv_broadcast(&pipe->pipe_wcv);
mutex_exit(pipe->pipe_lock);
diff -r 71f552a501e6 -r 74d5a4d57960 sys/sys/pipe.h
--- a/sys/sys/pipe.h Sun Dec 13 17:58:27 2009 +0000
+++ b/sys/sys/pipe.h Sun Dec 13 18:27:02 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pipe.h,v 1.30 2009/12/12 21:28:04 dsl Exp $ */
+/* $NetBSD: pipe.h,v 1.31 2009/12/13 18:27:02 dsl Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -96,7 +96,6 @@
pointers/data. */
#define PIPE_LWANT 0x200 /* Process wants exclusive access to
pointers/data. */
-#define PIPE_ABORTED 0x400 /* fo_abort()ed, unblock read/write */
/*
* Per-pipe data structure.
Home |
Main Index |
Thread Index |
Old Index