hare

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

commit 07662479286fd2a042818452035fe3e70362769c
parent e4152692af34b7adffa5bf49f707b7a06865bd0b
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Tue, 20 Apr 2021 16:03:05 -0400

os::exec: drop +linux.ha

We have working forward declarations

Diffstat:
Dos/exec/+linux.ha | 24------------------------
Mos/exec/exec+linux.ha | 2++
Mos/exec/process+linux.ha | 20++++++++++++++++++++
Mscripts/gen-stdlib | 1-
Mstdlib.mk | 2--
5 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/os/exec/+linux.ha b/os/exec/+linux.ha @@ -1,24 +0,0 @@ -// TODO: This file doesn't need to exist once we have working forward -// declarations - -export type platform_cmd = int; - -// Stores information about a child process. -export type process = int; - -// Stores information about an exited process. -export type status = struct { - status: int, - // Not all of these members are supported on all operating systems. - // Only utime and stime are guaranteed to be available. - rusage: struct { - // TODO: utime, stime - maxrss: u64, - minflt: u64, - majflt: u64, - inblock: u64, - oublock: u64, - nvcsw: u64, - nivcsw: u64, - }, -}; diff --git a/os/exec/exec+linux.ha b/os/exec/exec+linux.ha @@ -3,6 +3,8 @@ use rt; use strings; use os; +export type platform_cmd = int; + // 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()) { diff --git a/os/exec/process+linux.ha b/os/exec/process+linux.ha @@ -3,6 +3,26 @@ use rt; use fmt; // TODO: Add function to wait on all/any children +// Stores information about a child process. +export type process = int; + +// Stores information about an exited process. +export type status = struct { + status: int, + // Not all of these members are supported on all operating systems. + // Only utime and stime are guaranteed to be available. + rusage: struct { + // TODO: utime, stime + maxrss: u64, + minflt: u64, + majflt: u64, + inblock: u64, + oublock: u64, + nvcsw: u64, + nivcsw: u64, + }, +}; + fn rusage(st: *status, ru: *rt::rusage) void = { st.rusage.maxrss = ru.ru_maxrss; st.rusage.minflt = ru.ru_minflt; diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib @@ -517,7 +517,6 @@ os() { os_exec() { gen_srcs os::exec \ - '$(PLATFORM).ha' \ 'exec$(PLATFORM).ha' \ 'process$(PLATFORM).ha' \ types.ha \ diff --git a/stdlib.mk b/stdlib.mk @@ -689,7 +689,6 @@ $(HARECACHE)/os/os.ssa: $(stdlib_os_srcs) $(stdlib_rt) $(stdlib_io) $(stdlib_str # os::exec stdlib_os_exec_srcs= \ - $(STDLIB)/os/exec/$(PLATFORM).ha \ $(STDLIB)/os/exec/exec$(PLATFORM).ha \ $(STDLIB)/os/exec/process$(PLATFORM).ha \ $(STDLIB)/os/exec/types.ha \ @@ -1571,7 +1570,6 @@ $(TESTCACHE)/os/os.ssa: $(testlib_os_srcs) $(testlib_rt) $(testlib_io) $(testlib # os::exec testlib_os_exec_srcs= \ - $(STDLIB)/os/exec/$(PLATFORM).ha \ $(STDLIB)/os/exec/exec$(PLATFORM).ha \ $(STDLIB)/os/exec/process$(PLATFORM).ha \ $(STDLIB)/os/exec/types.ha \