Module Name: src
Committed By: ad
Date: Wed Oct 4 22:19:58 UTC 2023
Modified Files:
src/sys/kern: sys_pipe.c
src/sys/sys: pipe.h
Log Message:
pipe->pipe_waiters isn't needed on NetBSD, kernel condvars do this for free.
To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/kern/sys_pipe.c
cvs rdiff -u -r1.38 -r1.39 src/sys/sys/pipe.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/sys_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.161 src/sys/kern/sys_pipe.c:1.162
--- src/sys/kern/sys_pipe.c:1.161 Wed Oct 4 22:12:23 2023
+++ src/sys/kern/sys_pipe.c Wed Oct 4 22:19:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_pipe.c,v 1.161 2023/10/04 22:12:23 ad Exp $ */
+/* $NetBSD: sys_pipe.c,v 1.162 2023/10/04 22:19:58 ad 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.161 2023/10/04 22:12:23 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.162 2023/10/04 22:19:58 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -348,19 +348,13 @@ pipelock(struct pipe *pipe, bool catch_p
KASSERT(mutex_owned(pipe->pipe_lock));
while (pipe->pipe_state & PIPE_LOCKFL) {
- pipe->pipe_waiters++;
- KASSERT(pipe->pipe_waiters != 0); /* just in case */
if (catch_p) {
error = cv_wait_sig(&pipe->pipe_lkcv, pipe->pipe_lock);
if (error != 0) {
- KASSERT(pipe->pipe_waiters > 0);
- pipe->pipe_waiters--;
return error;
}
} else
cv_wait(&pipe->pipe_lkcv, pipe->pipe_lock);
- KASSERT(pipe->pipe_waiters > 0);
- pipe->pipe_waiters--;
}
pipe->pipe_state |= PIPE_LOCKFL;
@@ -378,9 +372,7 @@ pipeunlock(struct pipe *pipe)
KASSERT(pipe->pipe_state & PIPE_LOCKFL);
pipe->pipe_state &= ~PIPE_LOCKFL;
- if (pipe->pipe_waiters > 0) {
- cv_signal(&pipe->pipe_lkcv);
- }
+ cv_signal(&pipe->pipe_lkcv);
}
/*
Index: src/sys/sys/pipe.h
diff -u src/sys/sys/pipe.h:1.38 src/sys/sys/pipe.h:1.39
--- src/sys/sys/pipe.h:1.38 Mon Jan 25 19:21:11 2021
+++ src/sys/sys/pipe.h Wed Oct 4 22:19:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pipe.h,v 1.38 2021/01/25 19:21:11 dholland Exp $ */
+/* $NetBSD: pipe.h,v 1.39 2023/10/04 22:19:58 ad Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -98,9 +98,8 @@ struct pipe {
struct timespec pipe_atime; /* time of last access */
struct timespec pipe_mtime; /* time of last modify */
struct timespec pipe_btime; /* time of creation */
- pid_t pipe_pgid; /* process group for sigio */
- u_int pipe_waiters; /* number of waiters pending */
struct pipe *pipe_peer; /* link with other direction */
+ pid_t pipe_pgid; /* process group for sigio */
u_int pipe_state; /* pipe status info */
int pipe_busy; /* busy flag, to handle rundown */
vaddr_t pipe_kmem; /* preallocated PIPE_SIZE buffer */