summaryrefslogtreecommitdiff
path: root/lib/std/syswrap-ss+freebsd.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-05-05 21:41:38 -0700
committerOri Bernstein <ori@eigenstate.org>2016-05-05 21:41:38 -0700
commit36b4210be2a5d51607ba614d08e8369b19ca1e65 (patch)
tree60d6b2eb822d3a232678530dc9bc43bcbcb81e9e /lib/std/syswrap-ss+freebsd.myr
parentabadb828b42e44dd0e50be143745a0c15d8c6c83 (diff)
downloadmc-36b4210be2a5d51607ba614d08e8369b19ca1e65.tar.gz
Pull sleep into system specific code.
Diffstat (limited to 'lib/std/syswrap-ss+freebsd.myr')
-rw-r--r--lib/std/syswrap-ss+freebsd.myr20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/std/syswrap-ss+freebsd.myr b/lib/std/syswrap-ss+freebsd.myr
index 679c2f9..2476beb 100644
--- a/lib/std/syswrap-ss+freebsd.myr
+++ b/lib/std/syswrap-ss+freebsd.myr
@@ -5,12 +5,28 @@ use "slcp"
use "die"
pkg std =
+ const nanosleep : (nsecs : uint64 -> errno)
$noret const exit : (status:int -> void)
+
pkglocal const bgetcwd : (buf : byte[:] -> errno)
;;
-const exit = {status; sys.exit(status)}
-const bgetcwd = {buf
+const nanosleep = {nsecs
+ var req, rem
+ var s, ns
+
+ s = nsecs / 1_000_000_000
+ ns = nsecs % 1_000_000_000
+ req = [.sec = s, .nsec = ns]
+
+ -> sys.nanosleep(&req, &rem) castto(errno)
+}
+
+const exit = {status
+ sys.exit(status)
+}
+
+const bgetcwd = {buf
var res
res = sys.__getcwd(buf) castto(errno)