[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <412e6f7f0907021910w64af0525h17afb518f0e18f97@mail.gmail.com>
Date: Fri, 3 Jul 2009 10:10:13 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Amerigo Wang <xiyou.wangcong@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: PROPOSAL: extend pipe() to support NULL argument.
On Fri, Jul 3, 2009 at 9:55 AM, Amerigo Wang<xiyou.wangcong@...il.com> wrote:
>
>
> What is a pipe in your mind? A pipe has two points, obviously,
> you are making it a single point, thus you can't call it a pipe
> any more...
>
> I don't like this
How do you think the following code?
mkfifo("/tmp/a", O_RDWR);
fd = open("'/tmp/a", O_RDWR);
Is it right? Is it allowed by Linux/Unix/POSIX?
and when used by splice(), pipe represents a kernel buffer handler not
its original meaning.
.
>
> And just as what you showed above, you can close the fd's
> after finishing, thus you only save one fd during these
> two splice(), not useful...
splice() is a high performance system call. It maybe used in thousands
of connection environment, so one instance saves one fd, and thousands
of fd will be saved.
>
>
>>>
>>> You are trying to break it...
>>>
>>
>>It depends on the argument for pipe, if the argument is NULL, it
>>breaks the code above.
>>
>
> Sure, malloc(2) can return NULL.
>
>
You should check the return value returned by malloc brefore passing
it to pipe(), and not rely on pipe()'s check.
--
Regards,
Changli Gao(xiaosuo@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists