|
|
Message-ID: <20140416030624.GD26358@brightrain.aerifal.cx>
Date: Tue, 15 Apr 2014 23:06:24 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [patch] expose execvpe under _(GNU|BSD)_SOURCE
On Tue, Apr 15, 2014 at 10:00:08PM -0500, M Farkas-Dyck wrote:
> ---
> include/unistd.h | 3 +++
> src/process/execvp.c | 7 +++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/include/unistd.h b/include/unistd.h
> index bf10a6d..342ab68 100644
> --- a/include/unistd.h
> +++ b/include/unistd.h
> @@ -88,6 +88,9 @@ int execle(const char *, const char *, ...);
> int execl(const char *, const char *, ...);
> int execvp(const char *, char *const []);
> int execlp(const char *, const char *, ...);
> +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
> +int execvpe(const char *, char *const [], char *const []);
> +#endif
I don't really object to exposing it under _BSD_SOURCE, but is there
precedent for this?
> int fexecve(int, char *const [], char *const []);
> _Noreturn void _exit(int);
>
> diff --git a/src/process/execvp.c b/src/process/execvp.c
> index 0a33e42..068c722 100644
> --- a/src/process/execvp.c
> +++ b/src/process/execvp.c
> @@ -47,3 +47,10 @@ int execvp(const char *file, char *const argv[])
> {
> return __execvpe(file, argv, __environ);
> }
> +
> +#if defined(_GNU_SOURCE) || defined (_BSD_SOURCE)
> +int execvpe(const char *file, char *const argv[], char *const envp[])
> +{
> + return __execvpe(file, argv, envp);
> +}
> +#endif
Testing feature test macros with #ifdef in the libc source files is
not meaningful, and doesn't respect the namespace. There are two
possible right ways to do this: either a separate source file (so it
can't affect the namespace), or a weak alias from __execvpe to
execvpe. The latter would be preferable here since it would have zero
increase to code size.
Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.