Re: svn commit: r1918258 - /apr/apr/trunk/file_io/unix/pipe.c

Joe Orton <[email protected]>
Newsgroups gmane.comp.apache.apr.devel
Organization Registered in England and Wales under Company Registration No. 03798903 Directors: Michael Cunningham (US), Michael O'Neill (Ireland), Paul Argiry (US)
Message-ID <[email protected]>
On Thu, Jun 13, 2024 at 08:35:37AM +0200, Ruediger Pluem wrote:
> 
> 
> On 6/11/24 6:05 PM, [email protected] wrote:
> > Author: jorton
> > Date: Tue Jun 11 16:05:22 2024
> > New Revision: 1918258
> > 
> > URL: http://svn.apache.org/viewvc?rev=1918258&view=rev
> > Log:
> > * file_io/unix/pipe.c (file_pipe_create): Use pipe2(,O_NONBLOCK) by
> >   default unless APR_FULL_BLOCK was used; unconditionally set the
> >   blocking state later. Saves two syscalls per invocation for both
> >   APR_READ_BLOCK and APR_WRITE_BLOCK, no [intended] functional change.
> 
> I guess it is me being blind , but how do we save two syscalls for the
> APR_READ_BLOCK and APR_WRITE_BLOCK case each? With the code before the patch
> we started with a blocking pipe and needed to set one end of the pipe to non blocking.
> Now we start with a non blocking pipe and need to set the other end to blocking.
> Where did I get lost and miss the point?

No, you got it correct, I obviously got confused counting syscalls at 
some point there, sorry! APR_FULL_BLOCK is the only case where using 
pipe2() saves syscalls, and for every other case it costs three syscalls 
regardless of whether pipe() or pipe2() is used. So r1918258 is a noop. 
I'll revert this, thanks for the review.

Regards, Joe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.