This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] posix: New Linux posix_spawn{p} implementation


On 27 Jan 2016 08:17, Paul Eggert wrote:
> Adhemerval Zanella wrote:
> > +#ifdef O_CLOEXEC
> > +# ifndef __ASSUME_PIPE2
> > +  if (__have_pipe2 >= 0)
> > +# endif
> > +    {
> > +      r = __pipe2 (pipe_fds, O_CLOEXEC);
> > +# ifndef __ASSUME_PIPE2
> > +      if (__have_pipe2 == 0)
> ...
> 
> This sort of code is hard to read. Instead, declare substitutes like this after 
> you do your #includes:
> 
>    #ifndef __ASSUME_PIPE2
>    # define __have_pipe2 1
>    #endif
>    #ifndef O_CLOEXEC
>    # define O_CLOEXEC 0
>    #endif
> 
> and let the rest of the code just use __have_pipe2 and O_CLOEXEC, without the 
> forest of #ifdefs.

where does O_CLOEXEC not exist ?  can't we clean that up ?

looking at __ASSUME_O_CLOEXEC, that too is set to 1 everywhere
(linux/nacl/hurd).  rather than add more code using these, can't
we delete this old code ?  or at the very least, do not try to
use those symbols in this new code.
-mike

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]