ref: 18a02fb4c1dc435eb40d8e51c50611e2122333ee
parent: 427b9849fae0c94709a2ae3a43e17d5fe938ecc6
author: Ori Bernstein <[email protected]>
date: Fri Jan 10 13:30:10 EST 2014
Add 'stat()' syscall
--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -470,6 +470,7 @@
const read : (fd:fd, buf:byte[:] -> size)
const write : (fd:fd, buf:byte[:] -> size)
const lseek : (fd:fd, off:uint64, whence:int64 -> int64)
+ const stat : (path:byte[:], sb:statbuf# -> int64)
const fstat : (fd:fd, sb:statbuf# -> int64)
const mkdir : (path : byte[:], mode : int64 -> int64)
@@ -554,6 +555,7 @@
const read = {fd, buf; -> syscall(Sysread, fd, buf castto(byte#), buf.len castto(size)) castto(size)}
const write = {fd, buf; -> syscall(Syswrite, fd, buf castto(byte#), buf.len castto(size)) castto(size)}
const lseek = {fd, off, whence; -> syscall(Syslseek, fd, off, whence)}
+const stat = {path, sb; -> syscall(Sysstat, cstring(path), sb)}
const fstat = {fd, sb; -> syscall(Sysfstat, fd, sb)}
const mkdir = {path, mode; -> syscall(Sysmkdir, cstring(path), mode) castto(int64)}