summaryrefslogtreecommitdiff
path: root/lib/sys
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-06-24 13:38:57 -0700
committerOri Bernstein <ori@eigenstate.org>2017-06-25 01:08:54 -0700
commita588eed92c2ce168e21c802f491674a71d03ce58 (patch)
tree8eea811307065f166dbc3a904bce6b91bbf8b8a7 /lib/sys
parenteadf2bcb3c9dbe20b8bef1cf7e6059703f1e5ac6 (diff)
downloadmc-a588eed92c2ce168e21c802f491674a71d03ce58.tar.gz
Add fallocate for linux-x64
Diffstat (limited to 'lib/sys')
-rw-r--r--lib/sys/sys+linux-x64.myr12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sys/sys+linux-x64.myr b/lib/sys/sys+linux-x64.myr
index 4349c82..e2a8aa0 100644
--- a/lib/sys/sys+linux-x64.myr
+++ b/lib/sys/sys+linux-x64.myr
@@ -33,6 +33,8 @@ pkg sys =
type signo = int32
type sigflags = int64
+ type fallocmode = uint32
+
type clock = union
`Clockrealtime
`Clockmonotonic
@@ -423,6 +425,14 @@ pkg sys =
const Sigio : signo = 29
const Sigpoll : signo = Sigio
+ /* fallocate mode */
+ const Fallockeepsize : fallocmode = 0x01
+ const Fallocpunchhole : fallocmode = 0x02
+ const Fallocnohidestale : fallocmode = 0x04
+ const Falloccollapserange : fallocmode = 0x08
+ const Falloczerorange : fallocmode = 0x10
+ const Fallocinsertrange : fallocmode = 0x20
+
/* syscalls */
const Sysread : scno = 0
const Syswrite : scno = 1
@@ -806,6 +816,7 @@ pkg sys =
const getcwd : (buf : byte[:] -> int64)
const sendmsg : (fd:fd, msg:msghdr#, flags:msgflags -> int64)
const recvmsg : (fd:fd, msg:msghdr#, flags:msgflags -> int64)
+ const fallocate : (fd:fd, mode:fallocmode, off:off, len:off -> int64)
/* signals */
const sigaction : (sig : signo, act : sigaction#, oact : sigaction# -> int)
@@ -938,6 +949,7 @@ const chdir = {dir; -> syscall(Syschdir, cstring(dir))}
const getcwd = {buf; -> syscall(Sysgetcwd, a(buf), a(buf.len))}
const sendmsg = {fd, msg, flags; -> syscall(Syssendmsg, a(fd), msg, a(flags))}
const recvmsg = {fd, msg, flags; -> syscall(Sysrecvmsg, a(fd), msg, a(flags))}
+const fallocate = {fd, mode, off, len; -> syscall(Sysfallocate, a(fd), a(mode), a(off), a(len))}
/* file stuff */
const pipe = {fds; -> syscall(Syspipe, a(fds))}