From 5ab0c12d54e7f47a64b476d41a7ed15104f79f5c Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 30 Jun 2024 23:57:39 -0400 Subject: kernel: exec: Add execve() Signed-off-by: Ian Moffett --- sys/include/sys/exec.h | 8 ++++++++ sys/include/sys/proc.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'sys/include') diff --git a/sys/include/sys/exec.h b/sys/include/sys/exec.h index 73eae01..f5fac97 100644 --- a/sys/include/sys/exec.h +++ b/sys/include/sys/exec.h @@ -72,7 +72,15 @@ struct exec_prog { char **envp; }; +struct execve_args { + const char *pathname; + char **argv; + char **envp; +}; + +int execve(struct proc *td, const struct execve_args *args); int elf64_load(const char *pathname, struct proc *td, struct exec_prog *prog); + void elf_unload(struct proc *td, struct exec_prog *prog); void setregs(struct proc *td, struct exec_prog *prog, uintptr_t stack); diff --git a/sys/include/sys/proc.h b/sys/include/sys/proc.h index 0c3cd33..ba931f3 100644 --- a/sys/include/sys/proc.h +++ b/sys/include/sys/proc.h @@ -56,6 +56,8 @@ struct proc { }; #define PROC_EXITING BIT(0) /* Exiting */ +#define PROC_EXEC BIT(1) /* Exec called (cleared by sched) */ +#define PROC_INEXEC BIT(2) /* Exec in progress */ struct proc *this_td(void); int md_fork(struct proc *p, struct proc *parent, uintptr_t ip); -- cgit v1.2.3