[PATCH 2/2] posix: New Linux posix_spawn{p} implementation
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu Jan 28 17:45:00 GMT 2016
On 28-01-2016 15:22, Mike Frysinger wrote:
> 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
>
According to 74385da564a92fc441a7d7f3ed7a4295b74bfdbf we can now assume
O_CLOEXEC as always existent for Linux. I will change that.
More information about the Libc-alpha
mailing list