summaryrefslogtreecommitdiff
path: root/lib/sys
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-06-24 13:38:25 -0700
committerOri Bernstein <ori@eigenstate.org>2018-06-24 13:38:25 -0700
commit0f959a0c6f79986cc32d8456b503957476bdae83 (patch)
tree01e0abf2b8732ba50091107121494ca5a029846a /lib/sys
parentfde9deac883c3f2ae6ffb7d05b4f5e404f5c2249 (diff)
downloadmc-0f959a0c6f79986cc32d8456b503957476bdae83.tar.gz
Add recursive file removal.
Also makes `std.remove` remove directories the same way it removes leaf files.
Diffstat (limited to 'lib/sys')
-rw-r--r--lib/sys/sys+netbsd-x64.myr2
-rw-r--r--lib/sys/sys+osx-x64.myr2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/sys/sys+netbsd-x64.myr b/lib/sys/sys+netbsd-x64.myr
index 02f9a76..87c590a 100644
--- a/lib/sys/sys+netbsd-x64.myr
+++ b/lib/sys/sys+netbsd-x64.myr
@@ -853,6 +853,7 @@ pkg sys =
const close : (fd:fd -> int64)
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
+ const rmdir : (path:byte[:] -> int)
const read : (fd:fd, buf:byte[:] -> size)
const pread : (fd:fd, buf:byte[:], off : off -> size)
const readv : (fd:fd, iov:iovec[:] -> size)
@@ -985,6 +986,7 @@ const openmode = {path, opts, mode; -> (syscall(Sysopen, cstring(path), a(opts),
const close = {fd; -> syscall(Sysclose, a(fd))}
const creat = {path, mode; -> (openmode(path, Ocreat | Otrunc | Owronly, mode) : fd)}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
+const rmdir = {path; -> (syscall(Sysunlink, a(path)) : int)}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
const pread = {fd, buf, off; -> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const readv = {fd, vec; -> (syscall(Sysreadv, a(fd), (vec : iovec#), a(vec.len)) : size)}
diff --git a/lib/sys/sys+osx-x64.myr b/lib/sys/sys+osx-x64.myr
index bd1f427..e260889 100644
--- a/lib/sys/sys+osx-x64.myr
+++ b/lib/sys/sys+osx-x64.myr
@@ -773,6 +773,7 @@ pkg sys =
const rename : (from : byte[:], to : byte[:] -> int64)
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
+ const rmdir : (path:byte# -> int)
const read : (fd:fd, buf:byte[:] -> size)
const pread : (fd:fd, buf:byte[:], off : off -> size)
const write : (fd:fd, buf:byte[:] -> size)
@@ -945,6 +946,7 @@ 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) : fd)}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
+const rmdir = {path; -> (syscall(Sysunlink, a(path)) : int)}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
const pread = {fd, buf, off; -> (syscall(Syspread, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const write = {fd, buf; -> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}