summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2017-05-16 12:11:30 -0700
committerOri Bernstein <ori@markovcorp.com>2017-05-16 12:11:30 -0700
commit74a19268887ba997f0ebb65c0572f74f524db2e1 (patch)
tree66694a6188062689d42049737998a23e8dc7597e
parentc67d39e69ed554efcd252af61179afa7a192ea1a (diff)
downloadmc-74a19268887ba997f0ebb65c0572f74f524db2e1.tar.gz
Add pread/pwrite syscalls.
-rw-r--r--lib/sys/sys+freebsd-x64.myr4
-rw-r--r--lib/sys/sys+linux-x64.myr4
-rw-r--r--lib/sys/sys+netbsd-x64.myr4
-rw-r--r--lib/sys/sys+openbsd-x64.myr4
-rw-r--r--lib/sys/sys+osx-x64.myr4
5 files changed, 20 insertions, 0 deletions
diff --git a/lib/sys/sys+freebsd-x64.myr b/lib/sys/sys+freebsd-x64.myr
index 122ed21..40d36f3 100644
--- a/lib/sys/sys+freebsd-x64.myr
+++ b/lib/sys/sys+freebsd-x64.myr
@@ -828,8 +828,10 @@ pkg sys =
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
const read : (fd:fd, buf:byte[:] -> size)
+ const pread : (fd:fd, buf:byte[:] -> size)
const readv : (fd:fd, iov:byte[:][:] -> size)
const write : (fd:fd, buf:byte[:] -> size)
+ const pwrite : (fd:fd, buf:byte[:] -> size)
const writev : (fd:fd, iov : byte[:][:] -> size)
const lseek : (fd:fd, off : off, whence : whence -> int64)
const stat : (path:byte[:], sb:statbuf# -> int64)
@@ -959,8 +961,10 @@ const close = {fd; -> syscall(Sysclose, a(fd))}
const creat = {path, mode; -> (openmode(path, Ocreat | Otrunc | Owronly, mode) : fd)}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread = {fd, buf, off; -> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const readv = {fd, vec; -> (syscall(Sysreadv, a(fd), (vec : byte[:]#), a(vec.len)) : size)}
const write = {fd, buf; -> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite = {fd, buf, off; -> (syscall(Syspwrite, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const writev = {fd, vec; -> (syscall(Syswritev, a(fd), (vec : byte[:]#), a(vec.len)) : size)}
const lseek = {fd, off, whence; -> syscall(Syslseek, a(fd), a(off), a(whence))}
const stat = {path, sb; -> syscall(Sysstat, cstring(path), a(sb))}
diff --git a/lib/sys/sys+linux-x64.myr b/lib/sys/sys+linux-x64.myr
index c89a26b..5aa3f01 100644
--- a/lib/sys/sys+linux-x64.myr
+++ b/lib/sys/sys+linux-x64.myr
@@ -728,7 +728,9 @@ pkg sys =
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
const read : (fd:fd, buf:byte[:] -> size)
+ const pread : (fd:fd, buf:byte[:], off : off -> size)
const write : (fd:fd, buf:byte[:] -> size)
+ const pwrite : (fd:fd, buf:byte[:], off : off -> size)
const lseek : (fd:fd, off:off, whence:whence -> int64)
const stat : (path:byte[:], sb:statbuf# -> int64)
const lstat : (path:byte[:], sb:statbuf# -> int64)
@@ -856,7 +858,9 @@ const creat = {path, mode; -> (syscall(Syscreat, cstring(path), a(mode)) : fd)}
const rename = {from, to; -> syscall(Sysrename, cstring(from), cstring(to))}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread = {fd, buf, off; -> (syscall(Syspread64, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const write = {fd, buf; -> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite = {fd, buf, off; -> (syscall(Syspwrite64, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const lseek = {fd, off, whence; -> syscall(Syslseek, a(fd), a(off), a(whence))}
const stat = {path, sb; -> syscall(Sysstat, cstring(path), a(sb))}
const lstat = {path, sb; -> syscall(Syslstat, cstring(path), a(sb))}
diff --git a/lib/sys/sys+netbsd-x64.myr b/lib/sys/sys+netbsd-x64.myr
index e3cf78d..b5285ac 100644
--- a/lib/sys/sys+netbsd-x64.myr
+++ b/lib/sys/sys+netbsd-x64.myr
@@ -847,8 +847,10 @@ pkg sys =
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
const read : (fd:fd, buf:byte[:] -> size)
+ const pread : (fd:fd, buf:byte[:], off : off -> size)
const readv : (fd:fd, iov:byte[:][:] -> size)
const write : (fd:fd, buf:byte[:] -> size)
+ const pwrite : (fd:fd, buf:byte[:], off : off -> size)
const writev : (fd:fd, iov : byte[:][:] -> size)
const lseek : (fd:fd, off : off, whence : whence -> int64)
const stat : (path:byte[:], sb:statbuf# -> int64)
@@ -977,8 +979,10 @@ const close = {fd; -> syscall(Sysclose, a(fd))}
const creat = {path, mode; -> (openmode(path, Ocreat | Otrunc | Owronly, mode) : fd)}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread = {fd, buf, off; -> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const readv = {fd, vec; -> (syscall(Sysreadv, a(fd), (vec : byte[:]#), a(vec.len)) : size)}
const write = {fd, buf; -> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite = {fd, buf, off; -> (syscall(Syspwrite, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const writev = {fd, vec; -> (syscall(Syswritev, a(fd), (vec : byte[:]#), a(vec.len)) : size)}
const lseek = {fd, off, whence; -> syscall(Syslseek, a(fd), a(off), a(whence))}
const stat = {path, sb; -> syscall(Sys__stat50, cstring(path), a(sb))}
diff --git a/lib/sys/sys+openbsd-x64.myr b/lib/sys/sys+openbsd-x64.myr
index 6e8f41f..c977594 100644
--- a/lib/sys/sys+openbsd-x64.myr
+++ b/lib/sys/sys+openbsd-x64.myr
@@ -554,8 +554,10 @@ pkg sys =
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
const read : (fd:fd, buf:byte[:] -> size)
+ const pread : (fd:fd, buf:byte[:], off : off -> size)
const readv : (fd:fd, iov:byte[:][:] -> size)
const write : (fd:fd, buf:byte[:] -> size)
+ const pwrite : (fd:fd, buf:byte[:], off : off -> size)
const writev : (fd:fd, iov : byte[:][:] -> size)
const lseek : (fd:fd, off : off, whence : whence -> int64)
const stat : (path:byte[:], sb:statbuf# -> int64)
@@ -680,8 +682,10 @@ const close = {fd; -> syscall(Sysclose, a(fd))}
const creat = {path, mode; -> (openmode(path, Ocreat | Otrunc | Owronly, mode) : fd)}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread = {fd, buf, off; -> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const readv = {fd, vec; -> (syscall(Sysreadv, a(fd), (vec : byte[:]#), a(vec.len)) : size)}
const write = {fd, buf; -> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite = {fd, buf, off; -> (syscall(Syspwrite, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const writev = {fd, vec; -> (syscall(Syswritev, a(fd), (vec : byte[:]#), a(vec.len)) : size)}
const lseek = {fd, off, whence; -> syscall(Syslseek, a(fd), a(off), a(whence))}
const stat = {path, sb; -> syscall(Sysstat, cstring(path), a(sb))}
diff --git a/lib/sys/sys+osx-x64.myr b/lib/sys/sys+osx-x64.myr
index 9d2b747..d9b09a8 100644
--- a/lib/sys/sys+osx-x64.myr
+++ b/lib/sys/sys+osx-x64.myr
@@ -759,7 +759,9 @@ pkg sys =
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
const read : (fd:fd, buf:byte[:] -> size)
+ const pread : (fd:fd, buf:byte[:], off : off -> size)
const write : (fd:fd, buf:byte[:] -> size)
+ const pwrite : (fd:fd, buf:byte[:], off : off -> size)
const lseek : (fd:fd, off:off, whence:whence -> off)
const stat : (path:byte[:], sb:statbuf# -> int64)
const lstat : (path:byte[:], sb:statbuf# -> int64)
@@ -925,7 +927,9 @@ const rename = {from, to; -> syscall(Sysrename, cstring(from), cstring(to))}
const creat = {path, mode; -> (openmode(path, Ocreat | Otrunc | Owronly, mode) : fd)}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pread = {fd, buf, off; -> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const write = {fd, buf; -> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}
+const pwrite = {fd, buf, off; -> (syscall(Syspwrite, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const lseek = {fd, off, whence; -> __osx_lseek(fd, off, whence)}
const stat = {path, sb; -> syscall(Sysstat64, cstring(path), a(sb))}
const lstat = {path, sb; -> syscall(Syslstat64, cstring(path), a(sb))}