hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 11bf1261ae1afc556cd3b65c3ddf52730cdee20b
parent e0701955a144dc42bd8ce1ff3749fe8ce99c14c8
Author: Vincent Dagonneau <v@vda.io>
Date:   Wed,  4 May 2022 12:16:01 -0400

rt/+linux: add execve syscall

Diffstat:
Mrt/+linux/syscalls.ha | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -238,6 +238,18 @@ export fn execveat(dirfd: int, path: path, argv: *[*]nullable *const char, }; }; +export fn execve(path: path, argv: *[*]nullable *const char, + envp: *[*]nullable *const char) errno = { + let path = kpath(path)?; + return match (wrap_return(syscall3(SYS_execve, path: uintptr: u64, + argv: uintptr, envp: uintptr))) { + case let err: errno => + yield err; + case u64 => + abort("unreachable"); + }; +}; + // Returns the new PID to the parent, void to the child, or errno if something // goes wrong. export fn fork() (int | void | errno) = clone(null, SIGCHLD, null, null, 0);