public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: jw schultz <jw@pegasys.ws>
To: Ondrej Jombik <nepto@pobox.sk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: POSSIBLE BUG: certain writes to pipe block (after select())
Date: Tue, 25 Nov 2003 16:10:29 -0800	[thread overview]
Message-ID: <20031126001029.GF10144@pegasys.ws> (raw)
In-Reply-To: <Pine.LNX.4.50.0311251258420.27648-100000@Maxim.Platon.SK>

On Tue, Nov 25, 2003 at 01:20:18PM +0100, Ondrej Jombik wrote:
> [ Please CC me in the answer as I am not in the list. ]
> 
> I discovered that certain writes to filedescriptor created with pipe()
> system call will block even if select() previously returned change on
> that filedescriptor -- of course select() returned change in "write"
> fd_set.
> 
> While doing a deep investigation, I find out, that this write only
> blocks if more than 4096 bytes are written. This is certain for 2.4.20,
> 2.4.21 and 2.6.0-test7 kernels. Other kernels were untested. What is
> more interesting is the fact, that PIPE_BUF kernel constant (defined in
> the file /usr/include/linux/limits.h) has value equal to 4096 bytes.
> 
> So when writting 4097 bytes write() blocks. When writting 4096 bytes it
> does not. However I had never seen during my information hunt an
> information, that only maximum PIPE_BUF bytes can be written into
> filedescriptor created with pipe() system call. I think this is the
> point of the whole thing, but I'm confused why this is not written
> anywhere.
> 
> But anyway, I would like to mention, that expected behaviour is, that
> write() will write 4096 bytes (so return value from write() syscall is
> 4096) and the rest should be up to user. So it has to be userspace deal
> to wait for writing remaining byte(s).

This is correct behavior.  popen opens the file descriptors
with having default flags.  Therefore they have blocking
enabled.  See fcntl(2).

      reply	other threads:[~2003-11-26  0:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-25 12:20 POSSIBLE BUG: certain writes to pipe block (after select()) Ondrej Jombik
2003-11-26  0:10 ` jw schultz [this message]

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=20031126001029.GF10144@pegasys.ws \
    --to=jw@pegasys.ws \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nepto@pobox.sk \
    /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