Skip site navigation (1)Skip section navigation (2)
Date:      06 Sep 1999 08:36:16 +0100
From:      Andrew Gierth <andrew@erlenstar.demon.co.uk>
To:        Alex Povolotsky <tarkhil@asteroid.svib.ru>
Cc:        stable@freebsd.org, hackers@freebsd.org
Subject:   Re: Problems with FIFO open in non-blocking mode?
Message-ID:  <87k8q41ogf.fsf@erlenstar.demon.co.uk>
In-Reply-To: Alex Povolotsky's message of "Mon, 6 Sep 1999 09:47:32 %2B0400 (MSD)"
References:  <199909060547.JAA29146@shuttle.svib.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Alex" == Alex Povolotsky <tarkhil@asteroid.svib.ru> writes:

 Alex> 	if ((control = open("STATUS",O_WRONLY|O_NONBLOCK))<0) {

 Alex> fails to run (STATUS is pre-created FIFO file) with error
 Alex> "Device not configured", which seems kinda odd for me.

 Alex> However, when FIFO is opened with O_RDWR and O_NONBLOCK, every
 Alex> attempt to select(2) its handler for writing doesn't wait until
 Alex> someone opens FIFO for reading, but instead FIFO is ready to
 Alex> write at every select.

 Alex> Is it a bug or a feature?

Both are features.

The behaviour of open() in the first case is required by standards. In
the second case, the fact that the FIFO has been opened O_RDWR means
that it _is_ ready for writing, and select() is correctly returning
the fact.

-- 
Andrew.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87k8q41ogf.fsf>