Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exec.c
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Lines | if (error == 0) { | ||||
args.fd = uap->fd; | args.fd = uap->fd; | ||||
error = kern_execve(td, &args, NULL); | error = kern_execve(td, &args, NULL); | ||||
} | } | ||||
post_execve(td, error, oldvmspace); | post_execve(td, error, oldvmspace); | ||||
return (error); | return (error); | ||||
} | } | ||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct fldexec_args { | |||||
int interpreter; | |||||
int fd; | |||||
char **argv; | |||||
char **envv; | |||||
} | |||||
#endif | |||||
int | |||||
sys_fldexec(struct thread *td, struct fldexec_args *uap) | |||||
{ | |||||
struct image_args args; | |||||
struct vmspace *oldvmspace; | |||||
int error; | |||||
error = pre_execve(td, &oldvmspace); | |||||
if (error != 0) | |||||
return (error); | |||||
error = exec_copyin_args(&args, NULL, UIO_SYSSPACE, | |||||
uap->argv, uap->envv); | |||||
if (error == 0) { | |||||
args.interpreter = uap->interpreter; | |||||
brooks: Given that `sys_ffexecve` and `sys_fexecve` appear to be identical except for this line, I'm… | |||||
Not Done Inline ActionsThat's a good point... jonathan: That's a good point... | |||||
args.fd = uap->fd; | |||||
error = kern_execve(td, &args, NULL); | |||||
} | |||||
post_execve(td, error, oldvmspace); | |||||
return (error); | |||||
} | |||||
#ifndef _SYS_SYSPROTO_H_ | |||||
struct __mac_execve_args { | struct __mac_execve_args { | ||||
char *fname; | char *fname; | ||||
char **argv; | char **argv; | ||||
char **envv; | char **envv; | ||||
struct mac *mac_p; | struct mac *mac_p; | ||||
}; | }; | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 902 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
u_long argp, envp; | u_long argp, envp; | ||||
int error; | int error; | ||||
size_t length; | size_t length; | ||||
bzero(args, sizeof(*args)); | bzero(args, sizeof(*args)); | ||||
if (argv == NULL) | if (argv == NULL) | ||||
return (EFAULT); | return (EFAULT); | ||||
/* | |||||
* Don't override the imgact-specified interpreter by default. | |||||
*/ | |||||
args->interpreter = -1; | |||||
/* | /* | ||||
* Allocate demand-paged memory for the file name, argument, and | * Allocate demand-paged memory for the file name, argument, and | ||||
* environment strings. | * environment strings. | ||||
*/ | */ | ||||
error = exec_alloc_args(args); | error = exec_alloc_args(args); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 456 Lines • Show Last 20 Lines |
Given that sys_ffexecve and sys_fexecve appear to be identical except for this line, I'm tempted suggest a kern_ffexecve that you pass -1 to from sys_fexecve