From owner-freebsd-hackers Mon Jun 5 15: 9:46 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 1CF3937B606 for ; Mon, 5 Jun 2000 15:09:36 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.12 #1) id 12z4Pn-000AhT-00; Mon, 05 Jun 2000 22:28:07 +0100 Received: (from ben) by strontium.scientia.demon.co.uk (Exim 3.12 #7) id 12z4Pn-00038w-00; Mon, 05 Jun 2000 22:28:07 +0100 Date: Mon, 5 Jun 2000 22:28:07 +0100 From: Ben Smithurst To: David Malone Cc: hackers@FreeBSD.org Subject: Re: readers missing EOF on FIFOs. Message-ID: <20000605222807.M42325@strontium.scientia.demon.co.uk> References: <20000605010324.E42325@strontium.scientia.demon.co.uk> <20000605214804.A61337@walton.maths.tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20000605214804.A61337@walton.maths.tcd.ie> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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