ref: 220525edb769047fcba3faed66b041c97a752b70
parent: 8f0a2b6431382733d8289d2571a8735ea9d7213a
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Dec 28 17:05:21 EST 2014
Add wrapper for seek() on posixy systems.
--- a/libstd/sys+linux-x64.myr
+++ b/libstd/sys+linux-x64.myr
@@ -559,7 +559,7 @@
const unlink : (path:byte[:] -> int)
const read : (fd:fd, buf:byte[:] -> size)
const write : (fd:fd, buf:byte[:] -> size)
- const lseek : (fd:fd, off:uint64, whence:int64 -> int64)
+ const lseek : (fd:fd, off:off, whence:whence -> int64)
const stat : (path:byte[:], sb:statbuf# -> int64)
const lstat : (path:byte[:], sb:statbuf# -> int64)
const fstat : (fd:fd, sb:statbuf# -> int64)
--- a/libstd/syswrap+posixy.myr
+++ b/libstd/syswrap+posixy.myr
@@ -8,6 +8,10 @@
const Failmem : byte# = -1 castto(byte#)
+ const Seekset : seektype = 0
+ const Seekcur : seektype = 1
+ const Seekend : seektype = 2
+
const Ordonly : fdopt = sys.Ordonly castto(fdopt)
const Owronly : fdopt = sys.Owronly castto(fdopt)
const Ordwr : fdopt = sys.Ordwr castto(fdopt)
@@ -52,6 +56,7 @@
const read = {fd, buf; -> sys.read(fd castto(sys.fd), buf) castto(size)}
const write = {fd, buf; -> sys.write(fd castto(sys.fd), buf) castto(size)}
const pipe = {fds; -> sys.pipe(fds castto(sys.fd[2]#))}
+const seek = {fd, delta, whence; -> sys.lseek(fd castto(sys.fd), delta castto(sys.off), whence castto(sys.whence)) castto(off)}
const dup2 = {ofd, nfd; -> sys.dup2(ofd castto(sys.fd), nfd castto(sys.fd)) castto(fd)}
/* path manipulation */