svn commit: r313632 - in stable/10/contrib/netbsd-tests/lib/libc/gen: . posix_spawn

Eric van Gyzen eric at vangyzen.net
Mon Feb 13 15:16:25 UTC 2017


On 02/13/2017 02:22, Ed Schouten wrote:
> 2017-02-11 15:28 GMT+01:00 Eric van Gyzen <eric at vangyzen.net>:
>> I would be concerned that app developers would read this definition, ignore
>> the one in the man page, and use the __-prefixed types in their apps.
>
> I think that's a concern that's not specific to the change at hand, as
> that's simply how BSD header files work. Take a look at the
> declaration of kill() in our copy of <signal.h>:
>
> int     kill(__pid_t, int);
>
> This is simply the construct that the BSDs use to depend on a type
> without exposing it.

Note that we [usually] expose that type earlier in that same file:

#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
#ifndef _PID_T_DECLARED
typedef __pid_t         pid_t;
#define _PID_T_DECLARED
#endif
#endif

Apparently, signal.h should not expose pid_t in a strict pre-2001 POSIX 
environment.  Without this restriction, the prototype for kill() would 
probably use pid_t, as is done in several other files, such as spawn.h:

#ifndef _PID_T_DECLARED
typedef __pid_t         pid_t;
#define _PID_T_DECLARED
#endif

int posix_spawn(pid_t * __restrict, const char * __restrict,
...

Let me be clear:  Your change is useful and good, and I think you should 
commit it.  I would suggest using the above construct for the 
__-prefixed types, but it's only a suggestion.

Cheers,

Eric


More information about the svn-src-all mailing list