summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/std/syswrap+plan9.myr8
-rw-r--r--lib/std/syswrap-ss+freebsd.myr7
-rw-r--r--lib/std/syswrap-ss+linux.myr7
-rw-r--r--lib/std/syswrap-ss+openbsd.myr15
-rw-r--r--lib/std/syswrap-ss+plan9.myr9
5 files changed, 25 insertions, 21 deletions
diff --git a/lib/std/syswrap+plan9.myr b/lib/std/syswrap+plan9.myr
index cb7841c..bbabf22 100644
--- a/lib/std/syswrap+plan9.myr
+++ b/lib/std/syswrap+plan9.myr
@@ -66,7 +66,6 @@ pkg std =
const fork : (-> pid)
const execv : (cmd : byte[:], args : byte[:][:] -> errno)
const execve : (cmd : byte[:], args : byte[:][:], env : byte[:][:] -> errno)
- const nanosleep : (nsecs : uint64 -> errno)
pkglocal const Canunmap : bool = true
pkglocal const getmem : (sz : size -> byte#)
@@ -206,13 +205,6 @@ const execve = {cmd, args, env;
-> lasterr()
}
-const nanosleep = {nsecs
- if sys.sleep((nsecs/1_000_000 : uint32)) < 0
- -> lasterr()
- ;;
- -> 0
-}
-
/* memory stuff */
const getmem = {sz
var endp, oldp
diff --git a/lib/std/syswrap-ss+freebsd.myr b/lib/std/syswrap-ss+freebsd.myr
index 15928f4..4818f5c 100644
--- a/lib/std/syswrap-ss+freebsd.myr
+++ b/lib/std/syswrap-ss+freebsd.myr
@@ -1,11 +1,12 @@
use sys
+use "types"
use "errno"
use "cstrconv"
use "slcp"
use "die"
pkg std =
- const nanosleep : (nsecs : uint64 -> errno)
+ const nanosleep : (nsecs : time -> errno)
$noret const exit : (status:int -> void)
pkglocal const bgetcwd : (buf : byte[:] -> errno)
@@ -15,8 +16,8 @@ const nanosleep = {nsecs
var req, rem
var s, ns
- s = nsecs / 1_000_000_000
- ns = nsecs % 1_000_000_000
+ s = (nsecs : uint64) / 1_000_000_000
+ ns = (nsecs : uint64) % 1_000_000_000
req = [.sec = s, .nsec = ns]
-> (sys.nanosleep(&req, &rem) : errno)
diff --git a/lib/std/syswrap-ss+linux.myr b/lib/std/syswrap-ss+linux.myr
index f6ac9a3..b80f768 100644
--- a/lib/std/syswrap-ss+linux.myr
+++ b/lib/std/syswrap-ss+linux.myr
@@ -1,8 +1,9 @@
use sys
+use "types"
use "errno"
pkg std =
- const nanosleep : (nsecs : uint64 -> errno)
+ const nanosleep : (nsecs : time -> errno)
$noret const exit : (status:int -> void)
pkglocal const bgetcwd : (buf : byte[:] -> errno)
@@ -12,8 +13,8 @@ const nanosleep = {nsecs
var req, rem
var s, ns
- s = nsecs / 1_000_000_000
- ns = nsecs % 1_000_000_000
+ s = (nsecs : uint64) / 1_000_000_000
+ ns = (nsecs : uint64) % 1_000_000_000
req = [.sec = s, .nsec = ns]
-> (sys.nanosleep(&req, &rem) : errno)
diff --git a/lib/std/syswrap-ss+openbsd.myr b/lib/std/syswrap-ss+openbsd.myr
index aac53a8..6178617 100644
--- a/lib/std/syswrap-ss+openbsd.myr
+++ b/lib/std/syswrap-ss+openbsd.myr
@@ -1,11 +1,12 @@
use sys
-use "errno.use"
-use "cstrconv.use"
-use "slcp.use"
-use "die.use"
+use "types"
+use "errno"
+use "cstrconv"
+use "slcp"
+use "die"
pkg std =
- const nanosleep : (nsecs : uint64 -> errno)
+ const nanosleep : (nsecs : time -> errno)
$noret const exit : (status:int -> void)
pkglocal const bgetcwd : (buf : byte[:] -> errno)
@@ -21,8 +22,8 @@ const nanosleep = {nsecs
var req, rem
var s, ns
- s = nsecs / 1_000_000_000
- ns = nsecs % 1_000_000_000
+ s = (nsecs : uint64) / 1_000_000_000
+ ns = (nsecs : uint64) % 1_000_000_000
req = [.sec = s, .nsec = ns]
-> (sys.nanosleep(&req, &rem) : errno)
diff --git a/lib/std/syswrap-ss+plan9.myr b/lib/std/syswrap-ss+plan9.myr
index 33c555a..17fac5b 100644
--- a/lib/std/syswrap-ss+plan9.myr
+++ b/lib/std/syswrap-ss+plan9.myr
@@ -1,13 +1,22 @@
use sys
+use "types"
use "errno"
use "cstrconv"
pkg std =
+ const nanosleep : (nsecs : time -> errno)
$noret const exit : (status : int -> void)
pkglocal const bgetcwd : (buf : byte[:] -> errno)
;;
+const nanosleep = {nsecs
+ if sys.sleep((nsecs/1_000_000 : uint32)) < 0
+ -> lasterr()
+ ;;
+ -> 0
+}
+
const bgetcwd = {buf
var fd