mailing list of musl libc
 help / color / mirror / code / Atom feed
* [patch] expose execvpe under _(GNU|BSD)_SOURCE
@ 2014-04-19  3:40 M Farkas-Dyck
  2014-04-20  4:29 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: M Farkas-Dyck @ 2014-04-19  3:40 UTC (permalink / raw)
  To: musl

Forgot to #include "libc.h" last time.

From 9740391c7569bfa694cc0de1282858bad9b7f554 Mon Sep 17 00:00:00 2001
From: M Farkas-Dyck <strake888@gmail.com>
Date: Tue, 15 Apr 2014 22:02:29 -0500
Subject: [PATCH] expose execvpe under _(GNU|BSD)_SOURCE

---
 include/unistd.h     | 3 +++
 src/process/execvp.c | 3 +++
 2 files changed, 6 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
 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..7d32200 100644
--- a/src/process/execvp.c
+++ b/src/process/execvp.c
@@ -3,6 +3,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <limits.h>
+#include "libc.h"

 extern char **__environ;

@@ -47,3 +48,5 @@ int execvp(const char *file, char *const argv[])
 {
 	return __execvpe(file, argv, __environ);
 }
+
+weak_alias(__execvpe, execvpe);
-- 
1.8.5.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] expose execvpe under _(GNU|BSD)_SOURCE
  2014-04-19  3:40 [patch] expose execvpe under _(GNU|BSD)_SOURCE M Farkas-Dyck
@ 2014-04-20  4:29 ` Rich Felker
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2014-04-20  4:29 UTC (permalink / raw)
  To: musl

Committed with minor changes. Thanks.

Rich


On Fri, Apr 18, 2014 at 10:40:28PM -0500, M Farkas-Dyck wrote:
> Forgot to #include "libc.h" last time.
> 
> >From 9740391c7569bfa694cc0de1282858bad9b7f554 Mon Sep 17 00:00:00 2001
> From: M Farkas-Dyck <strake888@gmail.com>
> Date: Tue, 15 Apr 2014 22:02:29 -0500
> Subject: [PATCH] expose execvpe under _(GNU|BSD)_SOURCE
> 
> ---
>  include/unistd.h     | 3 +++
>  src/process/execvp.c | 3 +++
>  2 files changed, 6 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
>  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..7d32200 100644
> --- a/src/process/execvp.c
> +++ b/src/process/execvp.c
> @@ -3,6 +3,7 @@
>  #include <unistd.h>
>  #include <errno.h>
>  #include <limits.h>
> +#include "libc.h"
> 
>  extern char **__environ;
> 
> @@ -47,3 +48,5 @@ int execvp(const char *file, char *const argv[])
>  {
>  	return __execvpe(file, argv, __environ);
>  }
> +
> +weak_alias(__execvpe, execvpe);
> -- 
> 1.8.5.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] expose execvpe under _(GNU|BSD)_SOURCE
  2014-04-16  3:06 ` Rich Felker
  2014-04-16  4:15   ` M Farkas-Dyck
@ 2014-04-16  4:17   ` M Farkas-Dyck
  1 sibling, 0 replies; 6+ messages in thread
From: M Farkas-Dyck @ 2014-04-16  4:17 UTC (permalink / raw)
  To: musl

On 15/04/2014, Rich Felker <dalias@libc.org> wrote:
> Testing feature test macros with #ifdef in the libc source files is not meaningful

also, derp.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] expose execvpe under _(GNU|BSD)_SOURCE
  2014-04-16  3:06 ` Rich Felker
@ 2014-04-16  4:15   ` M Farkas-Dyck
  2014-04-16  4:17   ` M Farkas-Dyck
  1 sibling, 0 replies; 6+ messages in thread
From: M Farkas-Dyck @ 2014-04-16  4:15 UTC (permalink / raw)
  To: musl

On 15/04/2014, Rich Felker <dalias@libc.org> wrote:
> I don't really object to exposing it under _BSD_SOURCE, but is there
> precedent for this?

Yes: http://www.openbsd.org/cgi-bin/man.cgi?query=execvpe

> 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.

---
 include/unistd.h     | 3 +++
 src/process/execvp.c | 2 ++
 2 files changed, 5 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
 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..5c486b1 100644
--- a/src/process/execvp.c
+++ b/src/process/execvp.c
@@ -47,3 +47,5 @@ int execvp(const char *file, char *const argv[])
 {
 	return __execvpe(file, argv, __environ);
 }
+
+weak_alias(__execvpe, execvpe);
-- 
1.8.5.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] expose execvpe under _(GNU|BSD)_SOURCE
  2014-04-16  3:00 M Farkas-Dyck
@ 2014-04-16  3:06 ` Rich Felker
  2014-04-16  4:15   ` M Farkas-Dyck
  2014-04-16  4:17   ` M Farkas-Dyck
  0 siblings, 2 replies; 6+ messages in thread
From: Rich Felker @ 2014-04-16  3:06 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch] expose execvpe under _(GNU|BSD)_SOURCE
@ 2014-04-16  3:00 M Farkas-Dyck
  2014-04-16  3:06 ` Rich Felker
  0 siblings, 1 reply; 6+ messages in thread
From: M Farkas-Dyck @ 2014-04-16  3:00 UTC (permalink / raw)
  To: musl

---
 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
 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
-- 
1.8.5.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-20  4:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-19  3:40 [patch] expose execvpe under _(GNU|BSD)_SOURCE M Farkas-Dyck
2014-04-20  4:29 ` Rich Felker
  -- strict thread matches above, loose matches on Subject: below --
2014-04-16  3:00 M Farkas-Dyck
2014-04-16  3:06 ` Rich Felker
2014-04-16  4:15   ` M Farkas-Dyck
2014-04-16  4:17   ` M Farkas-Dyck

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).