Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 1999 09:47:32 +0400 (MSD)
From:      Alex Povolotsky <tarkhil@asteroid.svib.ru>
To:        stable@freebsd.org
Cc:        hackers@freebsd.org
Subject:   Problems with FIFO open in non-blocking mode?
Message-ID:  <199909060547.JAA29146@shuttle.svib.ru>

next in thread | raw e-mail | index | archive | help
Hello!

The following program

#include <stdio.h>
#include <fcntl.h>

main() {
	int control;
	if ((control = open("STATUS",O_WRONLY|O_NONBLOCK))<0) {
		perror("Could not open STATUS ");
		exit(1);
	}
	printf("STATUS ready\n");
	close(control);
	return(0);
}

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

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

Is it a bug or a feature?

-- 
Alexander B. Povolotsky                            [ICQ 18277558]
[2:5020/145]  [http://freebsd.svib.ru] [tarkhil@asteroid.svib.ru]


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




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