Turn execvpe() into an internal libc routine.
Adding exevpe() has caused some ports to break. Even though execvpe() is a useful routine, it does not conform to any standards. This patch is a little bit different from the patch sent to the mailing list. I forgot to remove execvpe from the Symbol.map (which does not seem to miscompile libc, though). Reviewed by: davidxu Approved by: philip
This commit is contained in:
parent
d7c5bf81cb
commit
c605eea952
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179947
@ -335,7 +335,6 @@ int execlp(const char *, const char *, ...);
|
|||||||
int execv(const char *, char * const *);
|
int execv(const char *, char * const *);
|
||||||
int execve(const char *, char * const *, char * const *);
|
int execve(const char *, char * const *, char * const *);
|
||||||
int execvp(const char *, char * const *);
|
int execvp(const char *, char * const *);
|
||||||
int execvpe(const char *, char * const *, char * const *);
|
|
||||||
pid_t fork(void);
|
pid_t fork(void);
|
||||||
long fpathconf(int, int);
|
long fpathconf(int, int);
|
||||||
char *getcwd(char *, size_t);
|
char *getcwd(char *, size_t);
|
||||||
|
@ -81,7 +81,7 @@ MLINKS+=err.3 err_set_exit.3 err.3 err_set_file.3 err.3 errc.3 err.3 errx.3 \
|
|||||||
err.3 verr.3 err.3 verrc.3 err.3 verrx.3 err.3 vwarn.3 err.3 vwarnc.3 \
|
err.3 verr.3 err.3 verrc.3 err.3 verrx.3 err.3 vwarn.3 err.3 vwarnc.3 \
|
||||||
err.3 vwarnx.3 err.3 warnc.3 err.3 warn.3 err.3 warnx.3
|
err.3 vwarnx.3 err.3 warnc.3 err.3 warn.3 err.3 warnx.3
|
||||||
MLINKS+=exec.3 execl.3 exec.3 execle.3 exec.3 execlp.3 exec.3 exect.3 \
|
MLINKS+=exec.3 execl.3 exec.3 execle.3 exec.3 execlp.3 exec.3 exect.3 \
|
||||||
exec.3 execv.3 exec.3 execvP.3 exec.3 execvp.3 exec.3 execvpe.3
|
exec.3 execv.3 exec.3 execvP.3 exec.3 execvp.3
|
||||||
MLINKS+=fpclassify.3 finite.3 fpclassify.3 finitef.3 \
|
MLINKS+=fpclassify.3 finite.3 fpclassify.3 finitef.3 \
|
||||||
fpclassify.3 isfinite.3 fpclassify.3 isinf.3 fpclassify.3 isnan.3 \
|
fpclassify.3 isfinite.3 fpclassify.3 isinf.3 fpclassify.3 isnan.3 \
|
||||||
fpclassify.3 isnormal.3
|
fpclassify.3 isnormal.3
|
||||||
|
@ -329,7 +329,6 @@ FBSD_1.0 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
FBSD_1.1 {
|
FBSD_1.1 {
|
||||||
execvpe;
|
|
||||||
fdopendir;
|
fdopendir;
|
||||||
fts_open;
|
fts_open;
|
||||||
fts_close;
|
fts_close;
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
.Nm exect ,
|
.Nm exect ,
|
||||||
.Nm execv ,
|
.Nm execv ,
|
||||||
.Nm execvp ,
|
.Nm execvp ,
|
||||||
.Nm execvpe ,
|
|
||||||
.Nm execvP
|
.Nm execvP
|
||||||
.Nd execute a file
|
.Nd execute a file
|
||||||
.Sh LIBRARY
|
.Sh LIBRARY
|
||||||
@ -65,8 +64,6 @@
|
|||||||
.Ft int
|
.Ft int
|
||||||
.Fn execvp "const char *file" "char *const argv[]"
|
.Fn execvp "const char *file" "char *const argv[]"
|
||||||
.Ft int
|
.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[]"
|
.Fn execvP "const char *file" "const char *search_path" "char *const argv[]"
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
@ -121,10 +118,9 @@ be terminated by a
|
|||||||
pointer.
|
pointer.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fn execle ,
|
.Fn execle
|
||||||
.Fn exect
|
|
||||||
and
|
and
|
||||||
.Fn execvpe
|
.Fn exect
|
||||||
functions also specify the environment of the executed process by following
|
functions also specify the environment of the executed process by following
|
||||||
the
|
the
|
||||||
.Dv NULL
|
.Dv NULL
|
||||||
@ -146,7 +142,6 @@ Some of these functions have special semantics.
|
|||||||
The functions
|
The functions
|
||||||
.Fn execlp ,
|
.Fn execlp ,
|
||||||
.Fn execvp ,
|
.Fn execvp ,
|
||||||
.Fn execvpe ,
|
|
||||||
and
|
and
|
||||||
.Fn execvP
|
.Fn execvP
|
||||||
will duplicate the actions of the shell in searching for an executable file
|
will duplicate the actions of the shell in searching for an executable file
|
||||||
@ -157,7 +152,6 @@ For
|
|||||||
.Fn execlp
|
.Fn execlp
|
||||||
and
|
and
|
||||||
.Fn execvp ,
|
.Fn execvp ,
|
||||||
.Fn execvpe ,
|
|
||||||
search path is the path specified in the environment by
|
search path is the path specified in the environment by
|
||||||
.Dq Ev PATH
|
.Dq Ev PATH
|
||||||
variable.
|
variable.
|
||||||
@ -283,8 +277,7 @@ The
|
|||||||
.Fn execl ,
|
.Fn execl ,
|
||||||
.Fn execle ,
|
.Fn execle ,
|
||||||
.Fn execlp ,
|
.Fn execlp ,
|
||||||
.Fn execvp ,
|
.Fn execvp
|
||||||
.Fn execvpe
|
|
||||||
and
|
and
|
||||||
.Fn execvP
|
.Fn execvP
|
||||||
functions
|
functions
|
||||||
@ -326,7 +319,3 @@ The
|
|||||||
.Fn execvP
|
.Fn execvP
|
||||||
function first appeared in
|
function first appeared in
|
||||||
.Fx 5.2 .
|
.Fx 5.2 .
|
||||||
The
|
|
||||||
.Fn execvpe
|
|
||||||
function first appeared in
|
|
||||||
.Fx 8.0 .
|
|
||||||
|
@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "un-namespace.h"
|
#include "un-namespace.h"
|
||||||
|
#include "libc_private.h"
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -140,7 +141,7 @@ execv(name, argv)
|
|||||||
int
|
int
|
||||||
execvp(const char *name, char * const *argv)
|
execvp(const char *name, char * const *argv)
|
||||||
{
|
{
|
||||||
return (execvpe(name, argv, environ));
|
return (_execvpe(name, argv, environ));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -272,7 +273,7 @@ execvP(const char *name, const char *path, char * const argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
execvpe(const char *name, char * const argv[], char * const envp[])
|
_execvpe(const char *name, char * const argv[], char * const envp[])
|
||||||
{
|
{
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "un-namespace.h"
|
#include "un-namespace.h"
|
||||||
|
#include "libc_private.h"
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -212,7 +213,7 @@ do_posix_spawn(pid_t *pid, const char *path,
|
|||||||
_exit(127);
|
_exit(127);
|
||||||
}
|
}
|
||||||
if (use_env_path)
|
if (use_env_path)
|
||||||
execvpe(path, argv, envp != NULL ? envp : environ);
|
_execvpe(path, argv, envp != NULL ? envp : environ);
|
||||||
else
|
else
|
||||||
_execve(path, argv, envp != NULL ? envp : environ);
|
_execve(path, argv, envp != NULL ? envp : environ);
|
||||||
error = errno;
|
error = errno;
|
||||||
|
@ -195,4 +195,7 @@ extern void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t)
|
|||||||
/* Without back-compat translation */
|
/* Without back-compat translation */
|
||||||
extern int __sys_fcntl(int, int, ...);
|
extern int __sys_fcntl(int, int, ...);
|
||||||
|
|
||||||
|
/* execve() with PATH processing to implement posix_spawnp() */
|
||||||
|
int _execvpe(const char *, char * const *, char * const *);
|
||||||
|
|
||||||
#endif /* _LIBC_PRIVATE_H_ */
|
#endif /* _LIBC_PRIVATE_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user