Re: Pipe buffers' limit of 16 * 4K

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Fausto Richetti Blanco <fausto.blanco@...>
Cc: <linux-kernel@...>, <riel@...>
Date: Wednesday, May 28, 2008 - 6:05 pm

On Wednesday 2008-05-28 23:22, Fausto Richetti Blanco wrote:

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.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Pipe buffers' limit of 16 * 4K, Fausto Richetti Blanco, (Wed May 28, 5:22 pm)
Re: Pipe buffers' limit of 16 * 4K, Jan Engelhardt, (Wed May 28, 6:05 pm)
Re: Pipe buffers' limit of 16 * 4K, Fausto Richetti Blanco, (Thu May 29, 9:00 am)
Re: Pipe buffers' limit of 16 * 4K, Miquel van Smoorenburg, (Thu May 29, 9:19 am)
Re: Pipe buffers' limit of 16 * 4K, Jan Engelhardt, (Thu May 29, 10:36 am)
Re: Pipe buffers' limit of 16 * 4K, Fausto Richetti Blanco, (Thu May 29, 11:46 am)
Re: Pipe buffers' limit of 16 * 4K, Jens Axboe, (Fri May 30, 6:35 am)
Re: Pipe buffers' limit of 16 * 4K, Jan Engelhardt, (Thu Jun 5, 5:55 am)
Re: Pipe buffers' limit of 16 * 4K, Jens Axboe, (Fri Jun 6, 5:19 am)