Date: Sat, 02 Dec 2000 10:12:56 -0700 From: Wes Peters <wes@softweyr.com> To: Charlie & <root@int80h.org> Cc: hackers@FreeBSD.org Subject: Re: pipe Message-ID: <3A292D98.E655D755@softweyr.com> References: <20001202085127.A301@int80h.org>
index | next in thread | previous in thread | raw e-mail
Charlie & wrote:
>
> Sorry if this is a dumb question, but after years of DOS programming, I
> am still discovering the subletiest of Unix:
>
> When I create a pipe, do I have to use it for interprocess communication
> only, or can the same process write to one end and later read from the
> other?
>
> What I am looking for is to use it as a FIFO-style buffer. Instead of
> allocating and reallocating memory, let the system worry about how
> much memory the data needs. This is for a two (or more) pass compiler,
> which reads from stdin and writes to stdout. It does not know how much
> data it still has coming in, so it has no idea how much memory it needs
> to store information in, yet after one pass it needs to read it in the
> same order it was written (FIFO).
>
> If this is possible, is there a limit as to how much I can write to the
> pipe before I start reading it, or is it limitless (within reason, of
> course)?
Yes, you can read from your own pipe, and yes the buffering availabe in
the pipe is limited. IIRC, the pipe size is 8K.
--
"Where am I, and what am I doing in this handbasket?"
Wes Peters Softweyr LLC
wes@softweyr.com http://softweyr.com/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A292D98.E655D755>
