shithub: mc

Download patch

ref: 314b2c1651a2c946a3d9e3ccdd9fff739e603b2b
parent: eee4c338620c5ed0bf64b7e90866a18598d75ec2
author: Ori Bernstein <[email protected]>
date: Thu Jun 19 09:46:18 EDT 2014

Fix getdents() syscall.

--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -64,10 +64,11 @@
 		 ino		: uint64
 	;;
 
-	type dirent = struct
+	type dirent64 = struct
 		ino	: uint64
 		off	: uint64
 		reclen	: uint16
+		etype	: byte
 		name	: byte[0]
 	;;
 
@@ -107,6 +108,7 @@
 	const Onofollow	: fdopt = 0x20000
 	const Ondelay  	: fdopt = 0x800
 	const Otrunc   	: fdopt = 0x200
+	const Odir	: fdopt = 0x10000
 
 	/* mmap protection */
 	const Mprotnone	: mprot = 0x0
@@ -492,7 +494,7 @@
 	const fstat	: (fd:fd, sb:statbuf# -> int64)
 	const mkdir	: (path : byte[:], mode : int64	-> int64)
 	const ioctl	: (fd:fd, req : int64, args:... -> int64)
-	const getdents64	: (fd:fd, dent : dirent#, count : uint64 -> int64)
+	const getdents64	: (fd:fd, buf : byte[:] -> int64)
 
 	/* networking */
 	const socket	: (dom : sockfam, stype : socktype, proto : sockproto	-> fd)
@@ -591,7 +593,7 @@
 	(arg, ap) = vanext(ap)
 	-> syscall(Sysioctl, fd, req, arg) castto(int64)
 }
-const getdents64	= {fd, dent, count;	-> syscall(Sysgetdents64, fd, dent, count)}
+const getdents64	= {fd, buf;	-> syscall(Sysgetdents64, fd, buf castto(byte#), buf.len)}
 
 /* networking */
 const socket	= {dom, stype, proto;	-> syscall(Syssocket, dom castto(int64), stype, proto) castto(fd)}