From owner-freebsd-hackers Fri May 8 07:33:25 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA00932 for freebsd-hackers-outgoing; Fri, 8 May 1998 07:33:25 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ren.dtir.qld.gov.au (firewall-user@ns.dtir.qld.gov.au [203.108.138.66]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA00910 for ; Fri, 8 May 1998 07:32:49 -0700 (PDT) (envelope-from syssgm@dtir.qld.gov.au) Received: by ren.dtir.qld.gov.au; id AAA09433; Sat, 9 May 1998 00:32:51 +1000 (EST) Received: from ogre.dtir.qld.gov.au(167.123.8.3) by ren.dtir.qld.gov.au via smap (3.2) id xma009431; Sat, 9 May 98 00:32:22 +1000 Received: from troll.dtir.qld.gov.au (troll-8.dtir.qld.gov.au [167.123.8.1]) by ogre.dtir.qld.gov.au (8.8.7/8.8.7) with ESMTP id AAA01862; Sat, 9 May 1998 00:32:21 +1000 (EST) Received: from localhost (syssgm@localhost) by troll.dtir.qld.gov.au (8.8.5/8.8.5) with SMTP id AAA03472; Sat, 9 May 1998 00:32:18 +1000 (EST) Message-Id: <199805081432.AAA03472@troll.dtir.qld.gov.au> X-Authentication-Warning: troll.dtir.qld.gov.au: syssgm@localhost didn't use HELO protocol To: "Andreas Huber" cc: "Justin C. Walker" , freebsd-hackers@FreeBSD.ORG, syssgm@dtir.qld.gov.au Subject: Re: Question about pipe() References: <199805080437.VAA01526@lilith.apple.com> In-Reply-To: <199805080437.VAA01526@lilith.apple.com> from "Justin C. Walker" at "08 May 1998 15:37:53 +1000" Date: Sat, 09 May 1998 00:32:17 +1000 From: Stephen McKay Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Friday, 8th May 1998, "Justin C. Walker" wrote: > "Andreas Huber" wrote: > * I was under the impression that if the write end of a pipe is closed, a > * read() at the other end of the pipe will return an error (or at least > * an EOF condition). Apparently it doesn't. Did I miss something? Is > * there another way to interrupt the read()? Yes, when the write end is closed, the read end returns 0 bytes to read() (ie EOF). You might have duplicated the write end using fork() though and forgotten to close the copy you don't need. This is a common mistake. Similarly, a write when the read end is closed (all copies, remember) will generate SIGPIPE (which you can set to be ignored) and returns an error (with errno == EPIPE). Named pipes are very similar, but I don't think you were talking about these. > In case no one's answered: a pipe reader will hang around >waiting for data to read, the idea being that the pipe reader is a >"service provider", while the pipe writer is the "service requester". >A pipe doesn't really have an end-of-file - it's "infinitely long". I have no idea what this fellow means here. I suggest you disregard it. Stephen. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message