Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jun 2000 22:28:07 +0100
From:      Ben Smithurst <ben@scientia.demon.co.uk>
To:        David Malone <dwmalone@maths.tcd.ie>
Cc:        hackers@FreeBSD.org
Subject:   Re: readers missing EOF on FIFOs.
Message-ID:  <20000605222807.M42325@strontium.scientia.demon.co.uk>
In-Reply-To: <20000605214804.A61337@walton.maths.tcd.ie>
References:  <20000605010324.E42325@strontium.scientia.demon.co.uk> <20000605214804.A61337@walton.maths.tcd.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
David Malone wrote:

> I didn't check your program, but I did try:
> 
> 	mkfifo /tmp/a
> 	echo hello > /tmp/a &
> 	echo bye > /tmp/a &
> 	cat /tmp/a

that's essentially what I'm doing, yes.

> I'm not sure how you can get around this, other than either the
> hacky way with the sleep, or maybe by using file locking of some
> sort.

How about

	open, write, close, unlink, mkfifo

That way when my program calls open when the reader already has the fifo
open, it's not opening the same fifo (same name, but different inode etc
in the filesystem).  This seems to work, I'll ignore the extra overhead
(however much it is).  Or I could probably do

	mkfifo "fifo.new";
	rename "fifo.new", "fifo";

to guarantee that "fifo" would always exist.

Anyway, it's hardly an important application, the FIFO in question is
"~/.signature".  Can you guess what it does yet? :-) Yes I know there's
probably something in the ports to do what I want, but I'm one of these
perverted people who actually likes programming simple things like this,
I might even learn something from it.

-- 
Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D


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?20000605222807.M42325>