From: "Fausto Richetti Blanco" <fausto.blanco@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: riel@redhat.com, jengelh@medozas.de, fausto.blanco@gmail.com
Subject: Re: Pipe buffers' limit of 16 * 4K
Date: Thu, 29 May 2008 10:00:36 -0300 [thread overview]
Message-ID: <d8d698ae0805290600s782e16b4pe70d725f55826cf0@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.1.10.0805290000400.19264@fbirervta.pbzchgretzou.qr>
Yes, I need an unspecified amount (it is the data content of a HTTP POST).
The tee system call appeared in the 2.6.17 (I'm using 2.6.9). That's
because I did my implementation using a buffer and copying it using
write. Unfortunately, both solutions suffer from the kernel buffer
limitation.
As I said, there's a lot of other solutions to my specific problem.
I'll problably move my solution inside the lib =/ But I decided to
write to this list to ask for dynamically adjustable sizes for the
pipes' buffers. Is there any good reason for this not to be pushed to
the kernel head ?
On Wed, May 28, 2008 at 7:05 PM, Jan Engelhardt <jengelh@medozas.de> wrote:
>
> On Wednesday 2008-05-28 23:22, Fausto Richetti Blanco wrote:
>>>
>>> It works very well, except when the input has more than 4K (or 16
>>> * 4K in more recent kernels) because the restore_input() blocks at
>>> this limit.
>>>
>>> I kwow there are other solutions to my problem (e.g: using a
>>> thread, moving our decisions to the lib, etc...) by I'm wondering if
>>> making the pipe buffers' limit adjustable is not a good idea. Maybe it
>>> should be helpful for another things too (like Jan Engelhardt said in
>>> his email).
>>>
>>> In fact, I didn't find any way of restoring the input (with the
>>> input being the 'read side' of a pipe) other than using pipes. That's
>>> because I've decided to ask this in the linux-kernel list. Is there a
>>> reason for this limit not to be an adjustable parameter ?
>
> You could have a look at the tee(2) system call and see whether it helps
> you a bit. Something along the lines of:
>
> int pfd[2];
> pipe(pfd); /* tee() wants an fd... */
> tee(STDIN_FILENO, pfd[1], len, SPLICE_F_NONBLOCK);
> read(pfd[0], ..., also in nonblock-mode)
>
> Of course this also has a certain drawback, namely that the pipe will
> only give you as much bytes as it carries, and no more than that,
> because the write side of the pipe at STDIN_FILENO is currently
> blocking exactly because the pipe is full.
> In other words, at most "4K" to be read with tee().
>
> Alternatively, if you need to consume an unspecified amount, it is
> probably best to go the thread way.
next prev parent reply other threads:[~2008-05-29 13:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <d8d698ae0805231255i4d0da724p68cb2b9376134797@mail.gmail.com>
2008-05-24 0:19 ` Fausto Richetti Blanco
2008-05-24 0:56 ` Rik van Riel
[not found] ` <d8d698ae0805261043u125b653ve73d067cd92caa16@mail.gmail.com>
2008-05-28 21:22 ` Fausto Richetti Blanco
2008-05-28 22:05 ` Jan Engelhardt
2008-05-29 13:00 ` Fausto Richetti Blanco [this message]
2008-05-29 13:19 ` Miquel van Smoorenburg
2008-05-29 14:36 ` Jan Engelhardt
2008-05-29 15:46 ` Fausto Richetti Blanco
2008-05-30 10:35 ` Jens Axboe
2008-06-05 9:55 ` Jan Engelhardt
2008-06-06 9:19 ` Jens Axboe
2008-05-26 14:15 ` Jan Engelhardt
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=d8d698ae0805290600s782e16b4pe70d725f55826cf0@mail.gmail.com \
--to=fausto.blanco@gmail.com \
--cc=jengelh@medozas.de \
--cc=linux-kernel@vger.kernel.org \
--cc=riel@redhat.com \
/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
all inboxes | Powered by JetHome®