shithub: mc

Download patch

ref: 9fa92a3ac5c7d6c52da80d8314a51d592645ad79
parent: ebbc1ee33bf9750437462d9a92e1a84fe9350bc8
author: Ori Bernstein <[email protected]>
date: Tue May 27 18:37:33 EDT 2014

Add 'ioctl' syscall to Linux.

    It's going to be needed by BPF. Note, I am not sure about how the
    ABI will work for varargs, and the code may need revisiting and/or
    compatibility shims.

    I'm with the plan 9 folks: Fuck ioctl.

--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -475,6 +475,7 @@
 	const stat	: (path:byte[:], sb:statbuf# -> int64)
 	const fstat	: (fd:fd, sb:statbuf# -> int64)
 	const mkdir	: (path : byte[:], mode : int64	-> int64)
+	const ioctl	: (fd:fd, req : int64, args:... -> int64)
 
 	/* networking */
 	const socket	: (dom : sockfam, stype : socktype, proto : sockproto	-> fd)
@@ -564,6 +565,7 @@
 const stat	= {path, sb;		-> syscall(Sysstat, cstring(path), sb)}
 const fstat	= {fd, sb;		-> syscall(Sysfstat, fd, sb)}
 const mkdir	= {path, mode;		-> syscall(Sysmkdir, cstring(path), mode) castto(int64)}
+const ioctl	= {fd, req, args	-> syscall(Sysioctl, fd, req, &args) castto(int64)}
 
 /* networking */
 const socket	= {dom, stype, proto;	-> syscall(Syssocket, dom castto(int64), stype, proto) castto(fd)}