ref: fd6413695a72cde96cbf0644083e06f65ecdec9f
parent: 4e4f36fcf5177b0c51c4bcb5a203c5f86edf6e00
author: Ryan Gonzalez <rymg19@gmail.com>
date: Thu Aug 3 10:06:05 EDT 2017
Add readlink syscall
--- a/lib/sys/sys+linux-x64.myr
+++ b/lib/sys/sys+linux-x64.myr
@@ -807,6 +807,7 @@
const rename : (from : byte[:], to : byte[:] -> int64)
const creat : (path:byte[:], mode:int64 -> fd)
const unlink : (path:byte[:] -> int)
+ const readlink : (path:byte[:], buf:byte[:] -> int64)
const read : (fd:fd, buf:byte[:] -> size)
const pread : (fd:fd, buf:byte[:], off : off -> size)
const write : (fd:fd, buf:byte[:] -> size)
@@ -947,6 +948,7 @@
const creat = {path, mode; -> (syscall(Syscreat, cstring(path), a(mode)) : fd)}
const rename = {from, to; -> syscall(Sysrename, cstring(from), cstring(to))}
const unlink = {path; -> (syscall(Sysunlink, cstring(path)) : int)}
+const readlink = {path, buf; -> syscall(Sysreadlink, cstring(path), (buf : byte#), a(buf.len))}
const read = {fd, buf; -> (syscall(Sysread, a(fd), (buf : byte#), a(buf.len)) : size)}
const pread = {fd, buf, off; -> (syscall(Syspread64, a(fd), (buf : byte#), a(buf.len), a(off)) : size)}
const write = {fd, buf; -> (syscall(Syswrite, a(fd), (buf : byte#), a(buf.len)) : size)}