PERFORCE change 167207 for review
Zhao Shuai
zhaoshuai at FreeBSD.org
Tue Aug 11 12:00:19 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=167207
Change 167207 by zhaoshuai at zhaoshuai on 2009/08/11 11:59:38
sync subr_pipe.c in my branch with sys_pipe.c @HEAD
Affected files ...
.. //depot/projects/soc2009/fifo/sys/kern/subr_pipe.c#10 edit
Differences ...
==== //depot/projects/soc2009/fifo/sys/kern/subr_pipe.c#10 (text+ko) ====
@@ -299,10 +299,8 @@
*p_rpipe = rpipe;
*p_wpipe = wpipe;
- knlist_init(&rpipe->pipe_sel.si_note, PIPE_MTX(rpipe), NULL, NULL,
- NULL);
- knlist_init(&wpipe->pipe_sel.si_note, PIPE_MTX(wpipe), NULL, NULL,
- NULL);
+ knlist_init_mtx(&rpipe->pipe_sel.si_note, PIPE_MTX(rpipe));
+ knlist_init_mtx(&wpipe->pipe_sel.si_note, PIPE_MTX(wpipe));
if ((error = pipe_create(rpipe, 1)) != 0 ||
(error = pipe_create(wpipe, 0)) != 0) {
@@ -677,6 +675,8 @@
pmap = vmspace_pmap(curproc->p_vmspace);
endaddr = round_page((vm_offset_t)uio->uio_iov->iov_base + size);
addr = trunc_page((vm_offset_t)uio->uio_iov->iov_base);
+ if (endaddr < addr)
+ return (EFAULT);
for (i = 0; addr < endaddr; addr += PAGE_SIZE, i++) {
/*
* vm_fault_quick() can sleep. Consequently,
@@ -1256,8 +1256,7 @@
#endif
if (events & (POLLIN | POLLRDNORM))
if ((rpipe->pipe_state & PIPE_DIRECTW) ||
- (rpipe->pipe_buffer.cnt > 0) ||
- (rpipe->pipe_state & PIPE_EOF))
+ (rpipe->pipe_buffer.cnt > 0))
revents |= events & (POLLIN | POLLRDNORM);
if (events & (POLLOUT | POLLWRNORM))
@@ -1267,10 +1266,14 @@
(wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF))
revents |= events & (POLLOUT | POLLWRNORM);
- if ((rpipe->pipe_state & PIPE_EOF) ||
- wpipe->pipe_present != PIPE_ACTIVE ||
- (wpipe->pipe_state & PIPE_EOF))
- revents |= POLLHUP;
+ if ((events & POLLINIGNEOF) == 0) {
+ if (rpipe->pipe_state & PIPE_EOF) {
+ revents |= (events & (POLLIN | POLLRDNORM));
+ if (wpipe->pipe_present != PIPE_ACTIVE ||
+ (wpipe->pipe_state & PIPE_EOF))
+ revents |= POLLHUP;
+ }
+ }
if (revents == 0) {
if (events & (POLLIN | POLLRDNORM)) {
More information about the p4-projects
mailing list