Hi, The following diff renames PIPE_WANT flag 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. Comments or OK ? -- Sebastien Marie Index: sys/kern/sys_pipe.c =================================================================== --- sys/kern/sys_pipe.c.orig 2019-07-13 07:06:05.239550881 +0200 +++ sys/kern/sys_pipe.c 2019-07-13 07:07:48.780729506 +0200 @@ -399,10 +399,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) { /* @@ -470,8 +470,8 @@ pipe_write(struct file *fp, struct uio * 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; @@ -614,8 +614,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) { /* @@ -810,7 +810,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); } Index: sys/sys/pipe.h =================================================================== --- sys/sys/pipe.h.orig 2019-07-12 14:58:51.733723987 +0200 +++ sys/sys/pipe.h 2019-07-13 07:07:00.450361707 +0200 @@ -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. */