From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4889 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [patch] expose execvpe under _(GNU|BSD)_SOURCE Date: Tue, 15 Apr 2014 23:06:24 -0400 Message-ID: <20140416030624.GD26358@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1397617607 18440 80.91.229.3 (16 Apr 2014 03:06:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Apr 2014 03:06:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4893-gllmg-musl=m.gmane.org@lists.openwall.com Wed Apr 16 05:06:39 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WaGBK-000464-5B for gllmg-musl@plane.gmane.org; Wed, 16 Apr 2014 05:06:38 +0200 Original-Received: (qmail 25901 invoked by uid 550); 16 Apr 2014 03:06:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 25893 invoked from network); 16 Apr 2014 03:06:37 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:4889 Archived-At: 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