shithub: mc

Download patch

ref: 083432b480b73587dd8381f072c0a3072d9c2b26
parent: 197018681ecff082c348b5954a69a18e12bcbd50
author: Ori Bernstein <[email protected]>
date: Wed Jun 18 22:19:03 EDT 2014

Add getdents function to linux.

--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -64,6 +64,13 @@
 		 ino		: uint64
 	;;
 
+	type dirent = struct
+		ino	: uint64
+		off	: uint64
+		reclen	: uint16
+		name	: byte[0]
+	;;
+
 	type utsname = struct
 		system	: byte[65]
 		node	: byte[65]
@@ -485,6 +492,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)
 
 	/* networking */
 	const socket	: (dom : sockfam, stype : socktype, proto : sockproto	-> fd)
@@ -583,6 +591,7 @@
 	(arg, ap) = vanext(ap)
 	-> syscall(Sysioctl, fd, req, arg) castto(int64)
 }
+const getdents64	= {fd, dent, count;	-> syscall(Sysgetdents64, fd, dent, count)}
 
 /* networking */
 const socket	= {dom, stype, proto;	-> syscall(Syssocket, dom castto(int64), stype, proto) castto(fd)}