shithub: mc

Download patch

ref: 20cbc5710d2c4a4df2cd426ae429c0ab632cb0a9
parent: 47860ff9a4411442997c2f8166aa6b24fbfeac2e
author: Ori Bernstein <[email protected]>
date: Thu Sep 25 09:42:50 EDT 2014

Add chdir() syscall.

--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -567,6 +567,7 @@
 	const mkdir	: (path : byte[:], mode : int64	-> int64)
 	const ioctl	: (fd:fd, req : int64, args:... -> int64)
 	const getdents64	: (fd:fd, buf : byte[:] -> int64)
+	const chdir	: (p : byte[:] -> int64)
 
 	/* fd stuff */
 	const pipe	: (fds : fd[:] -> int64)
@@ -688,6 +689,7 @@
 	-> syscall(Sysioctl, a(fd), a(req), a(arg)) castto(int64)
 }
 const getdents64	= {fd, buf;	-> syscall(Sysgetdents64, a(fd), buf castto(byte#), a(buf.len))}
+const chdir	= {dir;	-> syscall(Syschdir, dir)}
 
 /* file stuff */
 const pipe	= {fds;	-> syscall(Syspipe, fds castto(fd#))}
--- a/libstd/sys-osx.myr
+++ b/libstd/sys-osx.myr
@@ -577,6 +577,7 @@
 	const mkdir	: (path : byte[:], mode : int64	-> int64)
 	const ioctl	: (fd:fd, req : int64, args:... -> int64)
 	const getdirentries64	: (fd : fd, buf : byte[:], basep : int64# -> int64)
+	const chdir	: (p : byte[:] -> int64)
 
 	/* fd stuff */
 	const pipe	: (fd : fd[:] -> int64)
@@ -714,6 +715,7 @@
 	-> syscall(Sysioctl, a(fd), a(req), a(arg)) castto(int64)
 }
 const getdirentries64	= {fd, buf, basep;	-> syscall(Sysgetdirentries64, a(fd), buf castto(byte#), a(buf.len), a(basep))}
+const chdir	= {dir;	-> syscall(Syschdir, dir)}
 
 /* fd stuff */
 const pipe	= {fd;	-> __osx_pipe(fd castto(fd#))}