NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR/59056 CVS commit: src



The following reply was made to PR kern/59056; it has been noted by GNATS.

From: "Taylor R Campbell" <riastradh%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/59056 CVS commit: src
Date: Sat, 3 Oct 2026 16:26:51 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sat Oct  3 16:26:51 UTC 2026
 
 Modified Files:
 	src/sys/kern: sys_pipe.c
 	src/tests/lib/libc/sys: t_poll.c t_sigio.c
 
 Log Message:
 pipe(2): Restructure select/poll/kqueue records.
 
 1. When a thread is waiting on an endpoint of a pipe, have it wait on
    _that endpoint_ (i.e., cv_wait or selrecord), not on the other
    endpoint sometimes depending on the direction of the I/O.
 
 2. Make poll(2) on the writer side of a pipe wake with POLLERR when
    the reader side is closed, because write would return immediately,
    and fail with EPIPE/SIGPIPE.  See also:
 
    https://mail-index.NetBSD.org/tech-kern/2026/09/21/msg031255.html
 
    (In contrast, for the other way around, when the writer side of a
    pipe is closed, poll(2) on the reader is already defined to wake
    with POLLHUP, and while read would return immediately, it will not
    _fail_; it will simply report EOF, so there is no justification
    for POLLERR in that direction.)
 
 3. For EVFILT_READ, require the reader side of a pipe; likewise, for
    EVFILT_WRITE, require the writer side of a pipe.  That this wasn't
    enforced before was an accident, as far as I can tell, and made
    the kevent paths very confusing about which side of the pipe is
    which.
 
 PR kern/59056: poll POLLHUP bugs
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.173 -r1.174 src/sys/kern/sys_pipe.c
 cvs rdiff -u -r1.18 -r1.19 src/tests/lib/libc/sys/t_poll.c
 cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/sys/t_sigio.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 



Home | Main Index | Thread Index | Old Index