summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-07-09 22:14:00 -0400
committerOri Bernstein <ori@eigenstate.org>2014-07-09 22:14:00 -0400
commit44e5ed3ebbb9c3a8e5e5d809e0f5a6991c4b9570 (patch)
tree7e5cade792c694c00c3f89af98305e7e59ee70b6
parente002242442a548429f014ec3a5c30f1d40799a7a (diff)
downloadmc-44e5ed3ebbb9c3a8e5e5d809e0f5a6991c4b9570.tar.gz
Return size from std.read
-rw-r--r--libstd/sys-linux.myr8
-rw-r--r--libstd/sys-osx.myr8
-rw-r--r--libstd/types.myr4
3 files changed, 10 insertions, 10 deletions
diff --git a/libstd/sys-linux.myr b/libstd/sys-linux.myr
index 3d90867..18d3feb 100644
--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -494,8 +494,8 @@ pkg std =
const openmode : (path:byte[:], opts:fdopt, mode:int64 -> fd)
const close : (fd:fd -> int64)
const creat : (path:byte[:], mode:int64 -> fd)
- const read : (fd:fd, buf:byte[:] -> int64)
- const write : (fd:fd, buf:byte[:] -> int64)
+ 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 lstat : (path:byte[:], sb:statbuf# -> int64)
@@ -587,8 +587,8 @@ const open = {path, opts; -> syscall(Sysopen, cstring(path), opts, 0o777) castt
const openmode = {path, opts, mode; -> syscall(Sysopen, cstring(path), opts, mode) castto(fd)}
const close = {fd; -> syscall(Sysclose, fd)}
const creat = {path, mode; -> syscall(Syscreat, cstring(path), mode) castto(fd)}
-const read = {fd, buf; -> syscall(Sysread, fd, buf castto(byte#), buf.len castto(size))}
-const write = {fd, buf; -> syscall(Syswrite, fd, buf castto(byte#), buf.len castto(size))}
+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)}
diff --git a/libstd/sys-osx.myr b/libstd/sys-osx.myr
index 76c706f..250d49a 100644
--- a/libstd/sys-osx.myr
+++ b/libstd/sys-osx.myr
@@ -526,8 +526,8 @@ pkg std =
const openmode : (path:byte[:], opts:fdopt, mode:int64 -> fd)
const close : (fd:fd -> int64)
const creat : (path:byte[:], mode:int64 -> fd)
- const read : (fd:fd, buf:byte[:] -> int64)
- const write : (fd:fd, buf:byte[:] -> int64)
+ 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 lstat : (path:byte[:], sb:statbuf# -> int64)
@@ -621,8 +621,8 @@ const open = {path, opts; -> syscall(Sysopen, cstring(path), opts, 0o777) castt
const openmode = {path, opts, mode; -> syscall(Sysopen, cstring(path), opts, mode) castto(fd)}
const close = {fd; -> syscall(Sysclose, fd)}
const creat = {path, mode; -> openmode(path, Ocreat | Otrunc | Owronly, mode) castto(fd)}
-const read = {fd, buf; -> syscall(Sysread, fd, buf castto(byte#), buf.len castto(size))}
-const write = {fd, buf; -> syscall(Syswrite, fd, buf castto(byte#), buf.len castto(size))}
+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(Sysstat64, cstring(path), sb)}
const lstat = {path, sb; -> syscall(Syslstat64, cstring(path), sb)}
diff --git a/libstd/types.myr b/libstd/types.myr
index c11cbd5..5f9b6b9 100644
--- a/libstd/types.myr
+++ b/libstd/types.myr
@@ -1,6 +1,6 @@
pkg std =
- type size = uint64 /* spans entire address space */
- type ssize = int64 /* signed size */
+ type size = int64 /* spans entire address space */
+ type usize = int64 /* signed size */
type off = uint64 /* file offsets */
type intptr = uint64 /* can hold any pointer losslessly */
type time = int64 /* milliseconds since epoch */