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

(-)b/sys/kern/sys_pipe.c (-14 / +9 lines)
Lines 1516-1535 pipe_poll(struct file *fp, int events, struct ucred *active_cred, Link Here
1516
			 wpipe->pipe_buffer.size == 0)))
1516
			 wpipe->pipe_buffer.size == 0)))
1517
			revents |= events & (POLLOUT | POLLWRNORM);
1517
			revents |= events & (POLLOUT | POLLWRNORM);
1518
1518
1519
	levents = events &
1519
	levents = events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND);
1520
	    (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | POLLRDBAND);
1520
	if (rpipe->pipe_state & PIPE_EOF &&
1521
	if (rpipe->pipe_type & PIPE_TYPE_NAMED && fp->f_flag & FREAD && levents &&
1521
	    !(rpipe->pipe_type & PIPE_TYPE_NAMED && fp->f_flag & FREAD &&
1522
	    fp->f_pipegen == rpipe->pipe_wgen)
1522
	      levents && fp->f_pipegen == rpipe->pipe_wgen)) {
1523
		events |= POLLINIGNEOF;
1523
		if (fp->f_flag & FREAD)
1524
1524
			revents |= (events & (POLLIN | POLLRDNORM));
1525
	if ((events & POLLINIGNEOF) == 0) {
1525
		if (wpipe->pipe_present != PIPE_ACTIVE ||
1526
		if (rpipe->pipe_state & PIPE_EOF) {
1526
		    (wpipe->pipe_state & PIPE_EOF))
1527
			if (fp->f_flag & FREAD)
1527
			revents |= POLLHUP;
1528
				revents |= (events & (POLLIN | POLLRDNORM));
1529
			if (wpipe->pipe_present != PIPE_ACTIVE ||
1530
			    (wpipe->pipe_state & PIPE_EOF))
1531
				revents |= POLLHUP;
1532
		}
1533
	}
1528
	}
1534
1529
1535
	if (revents == 0) {
1530
	if (revents == 0) {
(-)b/sys/kern/uipc_socket.c (-7 / +5 lines)
Lines 4428-4434 sopoll_generic(struct socket *so, int events, struct ucred *active_cred, Link Here
4428
			revents = 0;
4428
			revents = 0;
4429
		else if (!TAILQ_EMPTY(&so->sol_comp))
4429
		else if (!TAILQ_EMPTY(&so->sol_comp))
4430
			revents = events & (POLLIN | POLLRDNORM);
4430
			revents = events & (POLLIN | POLLRDNORM);
4431
		else if ((events & POLLINIGNEOF) == 0 && so->so_error)
4431
		else if (so->so_error)
4432
			revents = (events & (POLLIN | POLLRDNORM)) | POLLHUP;
4432
			revents = (events & (POLLIN | POLLRDNORM)) | POLLHUP;
4433
		else {
4433
		else {
4434
			selrecord(td, &so->so_rdsel);
4434
			selrecord(td, &so->so_rdsel);
Lines 4448-4459 sopoll_generic(struct socket *so, int events, struct ucred *active_cred, Link Here
4448
			if (so->so_oobmark ||
4448
			if (so->so_oobmark ||
4449
			    (so->so_rcv.sb_state & SBS_RCVATMARK))
4449
			    (so->so_rcv.sb_state & SBS_RCVATMARK))
4450
				revents |= events & (POLLPRI | POLLRDBAND);
4450
				revents |= events & (POLLPRI | POLLRDBAND);
4451
		if ((events & POLLINIGNEOF) == 0) {
4451
		if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
4452
			if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
4452
			revents |= events & (POLLIN | POLLRDNORM);
4453
				revents |= events & (POLLIN | POLLRDNORM);
4453
			if (so->so_snd.sb_state & SBS_CANTSENDMORE)
4454
				if (so->so_snd.sb_state & SBS_CANTSENDMORE)
4454
				revents |= POLLHUP;
4455
					revents |= POLLHUP;
4456
			}
4457
		}
4455
		}
4458
		if (so->so_rcv.sb_state & SBS_CANTRCVMORE)
4456
		if (so->so_rcv.sb_state & SBS_CANTRCVMORE)
4459
			revents |= events & POLLRDHUP;
4457
			revents |= events & POLLRDHUP;
(-)b/sys/sys/poll.h (-1 lines)
Lines 68-74 struct pollfd { Link Here
68
68
69
#if __BSD_VISIBLE
69
#if __BSD_VISIBLE
70
/* General FreeBSD extension (currently only supported for sockets): */
70
/* General FreeBSD extension (currently only supported for sockets): */
71
#define	POLLINIGNEOF	0x2000		/* like POLLIN, except ignore EOF */
72
#define	POLLRDHUP	0x4000		/* half shut down */
71
#define	POLLRDHUP	0x4000		/* half shut down */
73
#endif
72
#endif
74
73
(-)b/usr.bin/truss/syscalls.c (-1 / +1 lines)
Lines 645-651 struct xlat { Link Here
645
static struct xlat poll_flags[] = {
645
static struct xlat poll_flags[] = {
646
	X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR)
646
	X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR)
647
	X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND)
647
	X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND)
648
	X(POLLWRBAND) X(POLLINIGNEOF) X(POLLRDHUP) XEND
648
	X(POLLWRBAND) X(POLLRDHUP) XEND
649
};
649
};
650
650
651
static struct xlat sigaction_flags[] = {
651
static struct xlat sigaction_flags[] = {

Return to bug 284529