shithub: mc

Download patch

ref: 762cc86bee0020fac7636e6a2cc662a8dc200616
parent: 8113f1c494f6430de52b5d005ceb6bda50091a09
author: Ori Bernstein <[email protected]>
date: Tue May 27 21:56:33 EDT 2014

Fix ioctls.

    The '...' is a lie.

--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -1,5 +1,5 @@
 use "types.use"
-use "sleq.use"
+use "varargs.use"
 
 pkg std =
 	type pid	= int64
@@ -565,7 +565,14 @@
 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)}
+const ioctl	= {fd, req, args
+	var arg : byte#
+	var ap
+
+	ap = vastart(&args)
+	(arg, ap) = vanext(ap)
+	-> syscall(Sysioctl, fd, req, arg) castto(int64)
+}
 
 /* networking */
 const socket	= {dom, stype, proto;	-> syscall(Syssocket, dom castto(int64), stype, proto) castto(fd)}
--- a/libstd/sys-osx.myr
+++ b/libstd/sys-osx.myr
@@ -1,4 +1,5 @@
 use "types.use"
+use "varargs.use"
 
 pkg std =
 	type scno 	= int64	/* syscall */
@@ -600,7 +601,14 @@
 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)}
+const ioctl	= {fd, req, args
+	var arg : byte#
+	var ap
+
+	ap = vastart(&args)
+	(arg, ap) = vanext(ap)
+	-> syscall(Sysioctl, fd, req, arg) castto(int64)
+}
 
 /* networking */
 const socket	= {dom, stype, proto;	-> syscall(Syssocket, dom castto(int64), stype, proto) castto(fd) }