summaryrefslogtreecommitdiff
path: root/lib/sys
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-06-17 11:21:08 -0700
committerOri Bernstein <ori@eigenstate.org>2017-06-17 11:21:08 -0700
commit8ccd239d70ff98001c857e8ebf8fb509b64477d4 (patch)
treef0cd8a2ee448520bcbfecc027aee6aaba1ad1587 /lib/sys
parente12f1d5c28797ee73fba56e4adf86a40491fc779 (diff)
downloadmc-8ccd239d70ff98001c857e8ebf8fb509b64477d4.tar.gz
Misc 9front fixes.
Diffstat (limited to 'lib/sys')
-rw-r--r--lib/sys/sys+plan9-x64.myr20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/sys/sys+plan9-x64.myr b/lib/sys/sys+plan9-x64.myr
index 808ca21..a42a0a2 100644
--- a/lib/sys/sys+plan9-x64.myr
+++ b/lib/sys/sys+plan9-x64.myr
@@ -146,6 +146,7 @@ pkg sys =
const segflush : (va : void#, len : uint32 -> int64)
const unmount : (name : byte[:], old : byte[:] -> int64)
const errstr : (buf : byte[:] -> int64)
+ const _errstr : (buf : byte[:] -> int64)
const stat : (name : byte[:], edir : byte[:] -> int64)
const fstat : (fd : fd, edir : byte[:] -> int64)
const wstat : (name : byte[:], edir : byte[:] -> int64)
@@ -207,7 +208,7 @@ const segdetach = {va; -> syscall(Syssegdetach, a(va))}
const segfree = {va, len; -> syscall(Syssegfree, a(va), a(len))}
const segflush = {va, len; -> syscall(Syssegfree, a(va), a(len))}
const unmount = {name, old; -> syscall(Sysunmount, cstring(name), cstring(old))}
-const errstr = {buf; -> syscall(Syserrstr, p(buf), a(buf.len))}
+const _errstr = {buf; -> syscall(Syserrstr, p(buf), a(buf.len))}
const stat = {name, edir; -> syscall(Sysstat, cstring(name), p(edir), a(edir.len))}
const fstat = {fd, edir; -> syscall(Sysstat, a(fd), p(edir), a(edir.len))}
const wstat = {name, edir; -> syscall(Syswstat, cstring(name), p(edir), a(edir.len))}
@@ -237,6 +238,23 @@ const exec = {bin, args
-> syscall(Sysexec, cstring(bin), a(cargs))
}
+const errstr = {eb
+ var tmp : byte[128]
+ var n
+
+ n = 128
+ if eb.len < tmp.len
+ n = eb.len
+ ;;
+ _errstr(tmp[:])
+ for var i = 0; i < n; i++
+ eb[i] = tmp[i]
+ ;;
+ _errstr(tmp[:])
+ -> 0
+}
+
+
/*const fversion = {fd, bufsz, vers, nvers; -> syscall(Sysfversion, fd, bufsz, }*/
const semacquire = {addr, block; -> (syscall(Syssemacquire, a(addr), a(block)) : int)}
const tsemacquire = {addr, ms; -> (syscall(Systsemacquire, a(addr), a(ms)) : int)}