NetBSD-Bugs archive

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

kern/60944: fifo opened non-blocking and set to blocking regression



>Number:         60944
>Category:       kern
>Synopsis:       fifo opened non-blocking and set to blocking regression
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 30 18:00:00 +0000 2026
>Originator:     Christos Zoulas
>Release:        NetBSD 11.99.9
>Organization:
	FIFO and Gutter cleaning, Inc.
>Environment:
System: NetBSD quasar.astron.com 11.99.9 NetBSD 11.99.9 (QUASAR) #78: Fri Oct 30 13:10:02 EDT 2026 christos%quasar.astron.com@localhost:/usr/src/sys/arch/amd64/compile/QUASAR amd64

Architecture: x86_64
Machine: amd64
>Description:

	Select should block if there are no writers on freshly opened FIFO
	that is set to blocking.

>How-To-Repeat:

	Running xlt2pd with a new kernel goes into an loop opening and
	closing its control fd.

#include <sys/stat.h>
#include <sys/select.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <err.h>


int
main(void)
{

	int fd, r;
	fd_set rfd;

	if (mkfifo("foo", 0600) == -1)
		err(EXIT_FAILURE, "mkfifo");

	if ((fd = open("foo", O_RDONLY|O_NONBLOCK, 0)) == -1)
		err(EXIT_FAILURE, "open");

	if (fcntl(fd, F_SETFL, O_RDONLY) == -1)
		err(EXIT_FAILURE, "fcntl");

	FD_ZERO(&rfd);
	FD_SET(fd, &rfd);
	if ((r = select(fd + 1, &rfd, NULL, NULL, NULL)) == -1)
		err(EXIT_FAILURE, "select");

	if (r && FD_ISSET(fd, &rfd))
		err(EXIT_FAILURE, "pipe fd is ready\n");
	return EXIT_SUCCESS;
}
>Fix:
	Please!




Home | Main Index | Thread Index | Old Index