mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-15 15:06:42 +00:00
The kernel uses two ways to write data on a pipe:
o buffered write, for chunks smaller than PIPE_MINDIRECT bytes o direct write, for everything else A call to writev(2) may receive struct iov of various size and the kernel may have to switch from one solution to the other. Before doing this, it must wake reader processes and any select/poll/kqueue up. This commit fixes a bug where select/poll/kqueue are not triggered when switching from buffered write to direct write. It adds calls to pipeselwakeup(). I give more details on freebsd-arch@: http://lists.freebsd.org/pipermail/freebsd-arch/2007-September/006790.html This should fix issues with Erlang (lang/erlang) and kqueue. Reported by: Rickard Green (Erlang)
This commit is contained in:
parent
f2bd4453a8
commit
4b5b09e744
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173750
@ -880,6 +880,7 @@ pipe_direct_write(wpipe, uio)
|
||||
wpipe->pipe_state &= ~PIPE_WANTR;
|
||||
wakeup(wpipe);
|
||||
}
|
||||
pipeselwakeup(wpipe);
|
||||
wpipe->pipe_state |= PIPE_WANTW;
|
||||
pipeunlock(wpipe);
|
||||
error = msleep(wpipe, PIPE_MTX(wpipe),
|
||||
@ -895,6 +896,7 @@ pipe_direct_write(wpipe, uio)
|
||||
wpipe->pipe_state &= ~PIPE_WANTR;
|
||||
wakeup(wpipe);
|
||||
}
|
||||
pipeselwakeup(wpipe);
|
||||
wpipe->pipe_state |= PIPE_WANTW;
|
||||
pipeunlock(wpipe);
|
||||
error = msleep(wpipe, PIPE_MTX(wpipe),
|
||||
@ -1080,6 +1082,8 @@ pipe_write(fp, uio, active_cred, flags, td)
|
||||
wpipe->pipe_state &= ~PIPE_WANTR;
|
||||
wakeup(wpipe);
|
||||
}
|
||||
pipeselwakeup(wpipe);
|
||||
wpipe->pipe_state |= PIPE_WANTW;
|
||||
pipeunlock(wpipe);
|
||||
error = msleep(wpipe, PIPE_MTX(rpipe), PRIBIO | PCATCH,
|
||||
"pipbww", 0);
|
||||
|
Loading…
Reference in New Issue
Block a user