diff options
author | Rob Kendrick (monotony) <rjek@rjek.com> | 2012-08-11 11:58:51 +0100 |
---|---|---|
committer | Rob Kendrick (monotony) <rjek@rjek.com> | 2012-08-11 11:58:51 +0100 |
commit | 757a7e576073a1a338cab6df735fdca1b25cc012 (patch) | |
tree | 6b9cff6ca0bf4a318b36e28b190f380227a118e9 | |
parent | 21a8b0b015ea427c010b3e3904397ea7a28b8a29 (diff) | |
download | luxio-757a7e576073a1a338cab6df735fdca1b25cc012.tar.gz |
sio: link, mkfifo, unlink, rmdir, rename
-rw-r--r-- | luxio/simple.lua | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/luxio/simple.lua b/luxio/simple.lua index d4a5cd1..81c5b11 100644 --- a/luxio/simple.lua +++ b/luxio/simple.lua @@ -199,6 +199,12 @@ local l_lseek = l.lseek local l_chmod = l.chmod local l_fchmod = l.fchmod local l_umask = l.umask +local l_link = l.link +local l_mkdir = l.mkdir +local l_mkfifo = l.mkfifo +local l_unlink = l.unlink +local l_rmdir = l.rmdir +local l_rename = l.rename local l_fcntl = l.fcntl local l_setsockopt = l.setsockopt local l_getsockopt = l.getsockopt @@ -609,6 +615,57 @@ local function umask(mask) return l_umask(sio_mode_flags(mask)) end +local function link(existing, new) + local r, errno = l_link(existing, new) + + if r ~= 0 then + return err("link", errno) + end + + return true +end + +local function mkfifo(pathname, mode) + local mode = sio_mode_flags(mode) + local r, errno = l_mkfifo(pathname, mode) + + if r ~= 0 then + return err("mkfifo", errno) + end + + return true +end + +local function unlink(pathname) + local r, errno = l_unlink(pathname) + + if r ~= 0 then + return err("unlink", errno) + end + + return true +end + +local function rmdir(pathname) + local r, errno = l_rmdir(pathname) + + if r ~= 0 then + return err("rmdir", errno) + end + + return true +end + +local function rename(old, new) + local r, errno = l_rename(old, new) + + if r ~= 0 then + return err("rename", errno) + end + + return true +end + local function luxio_socket_create(family, socktype) socktype = socktype or "tcp" -- default to tcp socket local st @@ -1098,7 +1155,12 @@ return { tomode = sio_mode_flags, umask = umask, chmod = chmod, + link = link, mkdir = mkdir, + mkfifo = mkfifo, + unlink = unlink, + rmdir = rmdir, + rename = rename, fork = fork, exec = exec, execp = execp, |