9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rog@vitanuova.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] trying to understand how fork/pipe a filtering program
Date: Fri,  1 Sep 2006 11:57:38 +0100	[thread overview]
Message-ID: <2edd17c34e530d3810c4150f4c907f32@vitanuova.com> (raw)
In-Reply-To: <6f2597316d0e00150a0c4bd2cc06bcee@plan9.bell-labs.com>

> Maybe it's been too long a week, but I could have sworn that a Plan 9
> pipe was a pair of unidirectional channels (queues in Streams
> terminology), so closing one end would cause a zero-byte read at the
> other, independently in each direction.  pipe(3) seems to support
> this.

the problem is that neither end was actually being closed,
as both ends of the pipe were dup'd onto stdin/stdout of the
child process. (the underlying close only happens when all references
have gone).

there is an alternative, i realised last night - you can do a zero-length
write after doing the writeimage, which will cause the child to read EOF,
which is usually fine (unless the child re-reads EOF, expecting it to remain EOF,
which can be the case with some buffered IO libraries and one-char lookahead;
depends whether it implements ungetc(EOF) - bio has this issue, for example)


  reply	other threads:[~2006-09-01 10:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-30 22:46 Axel Belinfante
2006-08-30 23:05 ` geoff
2006-08-31 16:26 ` "Nils O. Selåsdal"
2006-08-31 19:55   ` Axel Belinfante
2006-08-31 20:15     ` rog
2006-08-31 20:24       ` Axel Belinfante
2006-08-31 20:24     ` rog
2006-08-31 20:45       ` Axel Belinfante
2006-09-01  3:43     ` geoff
2006-09-01 10:57       ` rog [this message]
2006-09-01 14:35 ` rog
2006-09-01 15:33   ` Skip Tavakkolian
2006-09-01 15:59     ` rog
2006-09-01 18:42       ` Skip Tavakkolian
2006-09-03 19:09   ` Axel Belinfante
2006-09-04 14:52     ` Gorka guardiola
2006-09-04 20:50       ` Gorka guardiola
2006-09-04 19:26     ` Skip Tavakkolian
2006-09-04 20:25       ` Francisco J Ballesteros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2edd17c34e530d3810c4150f4c907f32@vitanuova.com \
    --to=rog@vitanuova.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).