This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/2] posix: New Linux posix_spawn{p} implementation
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Paul Eggert <eggert at cs dot ucla dot edu>, libc-alpha at sourceware dot org
- Date: Thu, 28 Jan 2016 15:45:21 -0200
- Subject: Re: [PATCH 2/2] posix: New Linux posix_spawn{p} implementation
- Authentication-results: sourceware.org; auth=none
- References: <1453897925-3643-1-git-send-email-adhemerval dot zanella at linaro dot org> <1453897925-3643-2-git-send-email-adhemerval dot zanella at linaro dot org> <56A8ED97 dot 5060101 at cs dot ucla dot edu> <20160128172243 dot GB14840 at vapier dot lan>
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.