shithub: mc

Download patch

ref: e4832da74d8722e6313a64db829473f4f5a3b3e6
parent: 241b498591ec1c86165c4e749f5e74ce7a03dd2a
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Aug 6 10:40:56 EDT 2017

Bring back memfd.

--- a/support/syscall-gen/specials+linux-x64.frag
+++ b/support/syscall-gen/specials+linux-x64.frag
@@ -1,3 +1,6 @@
+/* syscalls that aren't in freebsd's syscalls.master */
+const Sysmemfd_create           : scno = 319
+
 /* getting to the os */
 extern const syscall	: (sc:scno, args:... -> int64)
 extern const sigreturn	: (-> void)
@@ -49,6 +52,7 @@
 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)
+const memfdcreate       : (name:byte[:], flags:mfdflags -> fd)
 
 /* signals */
 const sigaction	: (sig : signo, act : sigaction#, oact : sigaction# -> int)
@@ -186,6 +190,7 @@
 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))}
+const memfdcreate      = {name, flags; -> (syscall(Sysmemfd_create, cstring(name), a(flags)) : fd)}
 
 /* file stuff */
 const pipe	= {fds;	-> syscall(Syspipe, a(fds))}