shithub: mc

Download patch

ref: 3ecd3ce8929a1eb9a3632b7e4d85769d72babc9a
parent: 4f1ea224da009a6174db526eabb4ddb3fdac5558
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Jan 1 08:11:38 EST 2015

Fix stat and getsysinfo.

    Stat wasn't giving the length of the buffer to a()
    Getsysinfo() was using the wrong env var.

--- a/libstd/sys+plan9-x64.myr
+++ b/libstd/sys+plan9-x64.myr
@@ -202,10 +202,10 @@
 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 stat	= {name, edir;	-> syscall(Sysstat, cstring(name), a(edir), a(edir))}
-const fstat	= {fd, edir;	-> syscall(Sysstat, a(fd), a(edir), a(edir))}
-const wstat	= {name, edir;	-> syscall(Syswstat, cstring(name), a(edir), a(edir))}
-const fwstat	= {fd, edir;	-> syscall(Sysfwstat, a(fd), a(edir), a(edir))}
+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))}
+const fwstat	= {fd, edir;	-> syscall(Sysfwstat, a(fd), p(edir), a(edir.len))}
 const mount	= {fd, afd, old, flag, aname;	-> syscall(Sysmount, a(fd), a(afd), cstring(old), a(flag), cstring(aname))}
 const pread	= {fd, buf, off;	-> syscall(Syspread, a(fd), p(buf), a(buf.len), off) castto(size)}
 const pwrite	= {fd, buf, off;	-> syscall(Syspwrite, a(fd), p(buf), a(buf.len), s(off)) castto(size)}
--- a/libstd/syswrap+plan9.myr
+++ b/libstd/syswrap+plan9.myr
@@ -126,7 +126,7 @@
 	si.system = getenvv("osname", "Plan9")
 	si.release = "4"
 	si.version = "0"
-	si.arch = getenvv("cputype", "unknown")
+	si.arch = getenvv("objtype", "unknown")
 }
 
 const close	= {fd;		-> sys.close(fd castto(sys.fd)) castto(int64)}
--- a/libstd/wait+plan9.myr
+++ b/libstd/wait+plan9.myr
@@ -36,7 +36,7 @@
 		statusmap = mkht(pidhash, pideq)
 		statusinit = true
 	;;
-
+		
 	match htget(statusmap, pid)
 	| `Some st:
 		htdel(statusmap, pid)
@@ -89,4 +89,4 @@
 }
 
 const pidhash	= {x;	-> inthash(x castto(int32))}
-const pideq	= {a, b;	-> a == b}
+const pideq	= {a, b;	-> a == b}
\ No newline at end of file