Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2001 11:52:26 +0300
From:      Peter Pentchev <roam@orbitel.bg>
To:        Zhihui Zhang <zzhang@cs.binghamton.edu>
Cc:        Manas Bhatt <bhatt_manas@yahoo.com>, hackers@FreeBSD.ORG
Subject:   Re: does data overflow in pipes
Message-ID:  <20010628115226.D80342@ringworld.oblivion.bg>
In-Reply-To: <Pine.SOL.4.21.0106272244150.23062-100000@opal>; from zzhang@cs.binghamton.edu on Wed, Jun 27, 2001 at 10:45:21PM -0400
References:  <20010628024057.71824.qmail@web10705.mail.yahoo.com> <Pine.SOL.4.21.0106272244150.23062-100000@opal>

next in thread | previous in thread | raw e-mail | index | archive | help
It is also possible that it would only write as much as it can,
and return the amount written, leaving it to you to write the rest
later.  (Uhm.. you do check the return values from write(2), right? :)

The relevant source is in src/sys/kern/sys_pipe.c, namely the pipe_write()
function.  From a quick look, it would seem that writes behave exactly
the way I thought - only writing as much as there is space left in
the pipe buffer.

G'luck,
Peter

-- 
I am the meaning of this sentence.

On Wed, Jun 27, 2001 at 10:45:21PM -0400, Zhihui Zhang wrote:
> 
> I guess the kernel will block the process trying to write more data than
> that can be accommodated. Or if you are using non-blocking I/O, it will
> return an error.
> 
> -Zhihui
> 
> On Wed, 27 Jun 2001, Manas Bhatt wrote:
> 
> > hi all,
> >      pipes uses only direct blocks to store data. so
> > depending on the blocksize , a total data of
> > 10*blocksize can be written in one go but what happens
> > if a writer process tries to write more 10*blocksize
> > of data in one go. Does the kernel overwrites the 
> > data  in pipe or not ? if yes, why? if not, then how
> > does it allow the writer to write more 10*blocksize of
> > data?
> >      if someone can direct me to implementation
> > (source files), it would be great.
> > thanks

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?20010628115226.D80342>