Messages in this thread | | | Date | Fri, 3 Jul 2009 13:19:17 +0800 | From | Amerigo Wang <> | Subject | Re: PROPOSAL: extend pipe() to support NULL argument. |
| |
On Fri, Jul 03, 2009 at 12:08:58PM +0800, Changli Gao wrote: >On Fri, Jul 3, 2009 at 11:00 AM, Amerigo Wang<xiyou.wangcong@gmail.com> wrote: >> >> When I said 'pipe', I meant *anonymous* pipe, definitely! >> There is nothing related with *named* pipe here. >> >Pipe means *anonymous* pipe? Who defined that? What the difference >between an anonymou pipe and a named pipe? Two ends or one ends? I >don't think so. Having explicit name is the right difference between >them.
I have no interests to teach you its definition.
if you re-read my email, you should conclude what 'pipe' there means, according to the contexts.
> >And when I said 'kernel buffer handler', I means it is not a >traditional pipe, and I just extend and reuse the pipe API to create a >kernel buffer handler for splicing use.
What pipe(2) creates is exactly an *anonymous* pipe.
> >> You are going to a *wrong* direction. >> >What is the right direction you think? Keep the pipe() API unchanged >and keep two fds refering to the same kernel buffer? If you want to >keep the API unchanged just for compatiblity with POSIX, I agree with >you, and maybe a new system call is needed.
Yes, exactly. Inventing a new API is better than modifying pipe(2), IMO.
BUT I still don't agree that you really need this... I think you can add a flag or something like that to an fd to do this, e.g.
fcntl(fd, F_SETFD, FD_PIPERW);
Isn't this better?
> >> >> If you repeat your (pipe,splice,splice,close,close) sequence for >> thousands times, it is still the same, nothing saves... >> >You means that? > >while (<condition>) { > pipe/splice/splice/close/close? >}
At least this is what I understand from your words.
> >You don't know my meaning. As a proxy server, there maybe lots of >connections to maintain, and these connections will keep open for a >long time. If the data received can be sent in a relay cycle, the >kernel buffer can be reused. If not, the kernel buffer must be >reserved. When there are lots of these kinds of connections, lots of >kernel buffers must be reserved. At this time, whether two fds per >kernel buffer or one fds per kernel buffer matters.
SHow us the code, please.
| |