View | Details | Raw Unified | Return to bug 235640
Collapse All | Expand All

(-)b/sys/kern/sys_pipe.c (-2 / +6 lines)
Lines 1743-1757 static int Link Here
1743
filt_pipewrite(struct knote *kn, long hint)
1743
filt_pipewrite(struct knote *kn, long hint)
1744
{
1744
{
1745
	struct pipe *wpipe;
1745
	struct pipe *wpipe;
1746
   
1746
1747
	/*
1748
	 * If this end of the pipe is closed, the knote was removed from the
1749
	 * knlist and the list lock is therefore not held.
1750
	 */
1747
	wpipe = kn->kn_hook;
1751
	wpipe = kn->kn_hook;
1748
	PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
1749
	if (wpipe->pipe_present != PIPE_ACTIVE ||
1752
	if (wpipe->pipe_present != PIPE_ACTIVE ||
1750
	    (wpipe->pipe_state & PIPE_EOF)) {
1753
	    (wpipe->pipe_state & PIPE_EOF)) {
1751
		kn->kn_data = 0;
1754
		kn->kn_data = 0;
1752
		kn->kn_flags |= EV_EOF;
1755
		kn->kn_flags |= EV_EOF;
1753
		return (1);
1756
		return (1);
1754
	}
1757
	}
1758
	PIPE_LOCK_ASSERT(wpipe, MA_OWNED);
1755
	kn->kn_data = (wpipe->pipe_buffer.size > 0) ?
1759
	kn->kn_data = (wpipe->pipe_buffer.size > 0) ?
1756
	    (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) : PIPE_BUF;
1760
	    (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) : PIPE_BUF;
1757
	if (wpipe->pipe_state & PIPE_DIRECTW)
1761
	if (wpipe->pipe_state & PIPE_DIRECTW)

Return to bug 235640