Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2008 01:23:01 +0200
From:      Ed Schouten <ed@80386.nl>
To:        David Xu <davidxu@freebsd.org>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, Philip Paeps <philip@FreeBSD.org>
Subject:   Re: execvpe port breakage
Message-ID:  <20080621232301.GU93496@hoeg.nl>
In-Reply-To: <485B884A.70006@freebsd.org>
References:  <485B7FFC.4040509@FreeBSD.org> <485B884A.70006@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Zzd9Wh/bp6DhMAqJ
Content-Type: multipart/mixed; boundary="uWCTLymdFNG0vGYZ"
Content-Disposition: inline


--uWCTLymdFNG0vGYZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

David,

* David Xu <davidxu@freebsd.org> wrote:
> Looks like the application defined its own version of execvpe() ?
> I think we should change name execvpe in our header file to something
> else to avoid conflict.

What do you think about the attached patch?

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--uWCTLymdFNG0vGYZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="execvpe.diff"
Content-Transfer-Encoding: quoted-printable

Index: include/unistd.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- include/unistd.h	(revision 179921)
+++ include/unistd.h	(working copy)
@@ -335,7 +335,6 @@
 int	 execv(const char *, char * const *);
 int	 execve(const char *, char * const *, char * const *);
 int	 execvp(const char *, char * const *);
-int	 execvpe(const char *, char * const *, char * const *);
 pid_t	 fork(void);
 long	 fpathconf(int, int);
 char	*getcwd(char *, size_t);
Index: lib/libc/gen/exec.3
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lib/libc/gen/exec.3	(revision 179921)
+++ lib/libc/gen/exec.3	(working copy)
@@ -38,7 +38,6 @@
 .Nm exect ,
 .Nm execv ,
 .Nm execvp ,
-.Nm execvpe ,
 .Nm execvP
 .Nd execute a file
 .Sh LIBRARY
@@ -65,8 +64,6 @@
 .Ft int
 .Fn execvp "const char *file" "char *const argv[]"
 .Ft int
-.Fn execvpe "const char *file" "char *const argv[]" "char *const envp[]"
-.Ft int
 .Fn execvP "const char *file" "const char *search_path" "char *const argv[=
]"
 .Sh DESCRIPTION
 The
@@ -121,10 +118,9 @@
 pointer.
 .Pp
 The
-.Fn execle ,
-.Fn exect
+.Fn execle
 and
-.Fn execvpe
+.Fn exect
 functions also specify the environment of the executed process by following
 the
 .Dv NULL
@@ -146,7 +142,6 @@
 The functions
 .Fn execlp ,
 .Fn execvp ,
-.Fn execvpe ,
 and
 .Fn execvP
 will duplicate the actions of the shell in searching for an executable file
@@ -157,7 +152,6 @@
 .Fn execlp
 and
 .Fn execvp ,
-.Fn execvpe ,
 search path is the path specified in the environment by
 .Dq Ev PATH
 variable.
@@ -283,8 +277,7 @@
 .Fn execl ,
 .Fn execle ,
 .Fn execlp ,
-.Fn execvp ,
-.Fn execvpe
+.Fn execvp
 and
 .Fn execvP
 functions
@@ -326,7 +319,3 @@
 .Fn execvP
 function first appeared in
 .Fx 5.2 .
-The
-.Fn execvpe
-function first appeared in
-.Fx 8.0 .
Index: lib/libc/gen/posix_spawn.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lib/libc/gen/posix_spawn.c	(revision 179921)
+++ lib/libc/gen/posix_spawn.c	(working copy)
@@ -39,6 +39,7 @@
 #include <string.h>
 #include <unistd.h>
 #include "un-namespace.h"
+#include "libc_private.h"
=20
 extern char **environ;
=20
@@ -212,7 +213,7 @@
 				_exit(127);
 		}
 		if (use_env_path)
-			execvpe(path, argv, envp !=3D NULL ? envp : environ);
+			_execvpe(path, argv, envp !=3D NULL ? envp : environ);
 		else
 			_execve(path, argv, envp !=3D NULL ? envp : environ);
 		error =3D errno;
Index: lib/libc/gen/exec.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lib/libc/gen/exec.c	(revision 179921)
+++ lib/libc/gen/exec.c	(working copy)
@@ -46,6 +46,7 @@
=20
 #include <stdarg.h>
 #include "un-namespace.h"
+#include "libc_private.h"
=20
 extern char **environ;
=20
@@ -140,7 +141,7 @@
 int
 execvp(const char *name, char * const *argv)
 {
-	return (execvpe(name, argv, environ));
+	return (_execvpe(name, argv, environ));
 }
=20
 static int
@@ -272,7 +273,7 @@
 }
=20
 int
-execvpe(const char *name, char * const argv[], char * const envp[])
+_execvpe(const char *name, char * const argv[], char * const envp[])
 {
 	const char *path;
=20
Index: lib/libc/include/libc_private.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- lib/libc/include/libc_private.h	(revision 179921)
+++ lib/libc/include/libc_private.h	(working copy)
@@ -195,4 +195,7 @@
 /* Without back-compat translation */
 extern int	__sys_fcntl(int, int, ...);
=20
+/* execve() with PATH processing to implement posix_spawnp() */
+int _execvpe(const char *, char * const *, char * const *);
+
 #endif /* _LIBC_PRIVATE_H_ */

--uWCTLymdFNG0vGYZ--

--Zzd9Wh/bp6DhMAqJ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkhdjVUACgkQ52SDGA2eCwV+3wCdFhZ0qYw8rHRRkCplSqsbZyob
bOcAnRLubJXMYJBactGF0JPAqTiyZQ5t
=MnHe
-----END PGP SIGNATURE-----

--Zzd9Wh/bp6DhMAqJ--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080621232301.GU93496>