shithub: mc

Download patch

ref: d16071e98377886ce745978334cf73767c85d96c
parent: cd9b841faedd7d142dc43993ad78918ee8ed1fe6
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Feb 10 06:35:25 EST 2016

Add rename syscall.

--- a/lib/sys/sys+osx-x64.myr
+++ b/lib/sys/sys+osx-x64.myr
@@ -641,6 +641,7 @@
 	const open	: (path:byte[:], opts:fdopt -> fd)
 	const openmode	: (path:byte[:], opts:fdopt, mode:int64 -> fd)
 	const close	: (fd:fd -> int64)
+	const rename	: (from : byte[:], to : byte[:] -> int64)
 	const creat	: (path:byte[:], mode:int64 -> fd)
 	const unlink	: (path:byte[:] -> int)
 	const read	: (fd:fd, buf:byte[:] -> size)
@@ -787,6 +788,7 @@
 const open	= {path, opts;		-> syscall(Sysopen, cstring(path), a(opts), a(0o777)) castto(fd)}
 const openmode	= {path, opts, mode;	-> syscall(Sysopen, cstring(path), a(opts), a(mode)) castto(fd)}
 const close	= {fd;			-> syscall(Sysclose, a(fd))}
+const rename	= {from, to;		-> syscall(Sysrename, cstring(from), cstring(to))}
 const creat	= {path, mode;		-> openmode(path, Ocreat | Otrunc | Owronly, mode) castto(fd)}
 const unlink	= {path;		-> syscall(Sysunlink, cstring(path)) castto(int)}
 const read	= {fd, buf;		-> syscall(Sysread, a(fd), buf castto(byte#), a(buf.len)) castto(size)}