summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsemarie <semarie@openbsd.org>2019-07-14 10:21:11 +0000
committersemarie <semarie@openbsd.org>2019-07-14 10:21:11 +0000
commitcb59755635862b3385dd764c29cd911cb37dd397 (patch)
tree18996bc8acf97320e9e283f8cfa8dbe5fb3018ed
parenta bunch of changes, all related to error-handling: (diff)
downloadwireguard-openbsd-cb59755635862b3385dd764c29cd911cb37dd397.tar.xz
wireguard-openbsd-cb59755635862b3385dd764c29cd911cb37dd397.zip
rename PIPE_WANT to PIPE_WANTD.
PIPE_WANT flag is used for signaling the pipe is about to be run-down. Pending readers/writers will wakeup the closing thread which is waiting. We already have PIPE_WANTR, PIPE_WANTW and PIPE_LWANT flags, so PIPE_WANT isn't really descriptive. No functional changes intented. ok visa@ anton@ mpi@
-rw-r--r--sys/kern/sys_pipe.c18
-rw-r--r--sys/sys/pipe.h4
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 1df0c0e4dd3..9fecf1b6df6 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.91 2019/07/13 06:51:59 semarie Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.92 2019/07/14 10:21:11 semarie Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -404,10 +404,10 @@ unlocked_error:
--rpipe->pipe_busy;
/*
- * PIPE_WANT processing only makes sense if pipe_busy is 0.
+ * PIPE_WANTD processing only makes sense if pipe_busy is 0.
*/
- if ((rpipe->pipe_busy == 0) && (rpipe->pipe_state & PIPE_WANT)) {
- rpipe->pipe_state &= ~(PIPE_WANT|PIPE_WANTW);
+ if ((rpipe->pipe_busy == 0) && (rpipe->pipe_state & PIPE_WANTD)) {
+ rpipe->pipe_state &= ~(PIPE_WANTD|PIPE_WANTW);
wakeup(rpipe);
} else if (rpipe->pipe_buffer.cnt < MINPIPESIZE) {
/*
@@ -475,8 +475,8 @@ pipe_write(struct file *fp, struct uio *uio, int fflags)
if (error) {
--wpipe->pipe_busy;
if ((wpipe->pipe_busy == 0) &&
- (wpipe->pipe_state & PIPE_WANT)) {
- wpipe->pipe_state &= ~(PIPE_WANT | PIPE_WANTR);
+ (wpipe->pipe_state & PIPE_WANTD)) {
+ wpipe->pipe_state &= ~(PIPE_WANTD | PIPE_WANTR);
wakeup(wpipe);
}
goto done;
@@ -619,8 +619,8 @@ retrywrite:
--wpipe->pipe_busy;
- if ((wpipe->pipe_busy == 0) && (wpipe->pipe_state & PIPE_WANT)) {
- wpipe->pipe_state &= ~(PIPE_WANT | PIPE_WANTR);
+ if ((wpipe->pipe_busy == 0) && (wpipe->pipe_state & PIPE_WANTD)) {
+ wpipe->pipe_state &= ~(PIPE_WANTD | PIPE_WANTR);
wakeup(wpipe);
} else if (wpipe->pipe_buffer.cnt > 0) {
/*
@@ -806,7 +806,7 @@ pipeclose(struct pipe *cpipe)
cpipe->pipe_state |= PIPE_EOF;
while (cpipe->pipe_busy) {
wakeup(cpipe);
- cpipe->pipe_state |= PIPE_WANT;
+ cpipe->pipe_state |= PIPE_WANTD;
tsleep(cpipe, PRIBIO, "pipecl", 0);
}
diff --git a/sys/sys/pipe.h b/sys/sys/pipe.h
index 77740666222..a8b8127a86a 100644
--- a/sys/sys/pipe.h
+++ b/sys/sys/pipe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipe.h,v 1.16 2018/11/12 16:33:08 visa Exp $ */
+/* $OpenBSD: pipe.h,v 1.17 2019/07/14 10:21:11 semarie Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -61,7 +61,7 @@ struct pipebuf {
#define PIPE_ASYNC 0x004 /* Async? I/O. */
#define PIPE_WANTR 0x008 /* Reader wants some characters. */
#define PIPE_WANTW 0x010 /* Writer wants space to put characters. */
-#define PIPE_WANT 0x020 /* Pipe is wanted to be run-down. */
+#define PIPE_WANTD 0x020 /* Pipe is wanted to be run-down. */
#define PIPE_SEL 0x040 /* Pipe has a select active. */
#define PIPE_EOF 0x080 /* Pipe is in EOF condition. */
#define PIPE_LOCK 0x100 /* Process has exclusive access to pointers/data. */