Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_exec.c
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | sys_execve(struct thread *td, struct execve_args *uap) | ||||
error = pre_execve(td, &oldvmspace); | error = pre_execve(td, &oldvmspace); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, | error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, | ||||
uap->argv, uap->envv); | uap->argv, uap->envv); | ||||
if (error == 0) | if (error == 0) | ||||
error = kern_execve(td, &args, NULL, oldvmspace); | error = kern_execve(td, &args, NULL, oldvmspace); | ||||
post_execve(td, error, oldvmspace); | post_execve(td, error, oldvmspace); | ||||
AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); | |||||
return (error); | return (error); | ||||
} | } | ||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct fexecve_args { | struct fexecve_args { | ||||
int fd; | int fd; | ||||
char **argv; | char **argv; | ||||
char **envv; | char **envv; | ||||
Show All 11 Lines | if (error != 0) | ||||
return (error); | return (error); | ||||
error = exec_copyin_args(&args, NULL, UIO_SYSSPACE, | error = exec_copyin_args(&args, NULL, UIO_SYSSPACE, | ||||
uap->argv, uap->envv); | uap->argv, uap->envv); | ||||
if (error == 0) { | if (error == 0) { | ||||
args.fd = uap->fd; | args.fd = uap->fd; | ||||
error = kern_execve(td, &args, NULL, oldvmspace); | error = kern_execve(td, &args, NULL, oldvmspace); | ||||
} | } | ||||
post_execve(td, error, oldvmspace); | post_execve(td, error, oldvmspace); | ||||
AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); | |||||
return (error); | return (error); | ||||
} | } | ||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct __mac_execve_args { | struct __mac_execve_args { | ||||
char *fname; | char *fname; | ||||
char **argv; | char **argv; | ||||
char **envv; | char **envv; | ||||
Show All 12 Lines | #ifdef MAC | ||||
error = pre_execve(td, &oldvmspace); | error = pre_execve(td, &oldvmspace); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, | error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, | ||||
uap->argv, uap->envv); | uap->argv, uap->envv); | ||||
if (error == 0) | if (error == 0) | ||||
error = kern_execve(td, &args, uap->mac_p, oldvmspace); | error = kern_execve(td, &args, uap->mac_p, oldvmspace); | ||||
post_execve(td, error, oldvmspace); | post_execve(td, error, oldvmspace); | ||||
AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); | |||||
return (error); | return (error); | ||||
#else | #else | ||||
return (ENOSYS); | return (ENOSYS); | ||||
#endif | #endif | ||||
} | } | ||||
int | int | ||||
pre_execve(struct thread *td, struct vmspace **oldvmspace) | pre_execve(struct thread *td, struct vmspace **oldvmspace) | ||||
▲ Show 20 Lines • Show All 1,548 Lines • Show Last 20 Lines |