hare

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

commit 1749a9a0ebc46a4cfad00791fca871ce48af8873
parent ebb81682f2a1aff982b85ce66279967f0ed1fd6e
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon,  8 Feb 2021 15:15:38 -0500

os::exec: add fork()

Diffstat:
Mos/exec/+linux.ha | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/os/exec/+linux.ha b/os/exec/+linux.ha @@ -10,6 +10,14 @@ export type os_error = struct { data: *void, }; +// Forks the current process, returning the pid of the child (to the parent) and +// void (to the child), or an error. +export fn fork() (int | void | error) = match (rt::fork()) { + err: rt::errno => errno_to_os(err), + i: int => i, + void => void, +}; + fn errno_errstr(data: *void) str = { const errno = data: uintptr: int: rt::errno; return rt::errstr(errno);