aboutsummaryrefslogtreecommitdiff
path: root/src/lib9pclient
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-01-27 04:11:37 +0000
committerrsc <devnull@localhost>2006-01-27 04:11:37 +0000
commit1ac60148eb818857ad667789cb84973e76f02a4f (patch)
treeb3542a1e37de7cb92330d001462b2a5e8bf17873 /src/lib9pclient
parent86122474029f9aa85a6d036d23e8a4fa60d5ed4b (diff)
downloadplan9port-1ac60148eb818857ad667789cb84973e76f02a4f.tar.gz
plan9port-1ac60148eb818857ad667789cb84973e76f02a4f.tar.bz2
plan9port-1ac60148eb818857ad667789cb84973e76f02a4f.zip
add
Diffstat (limited to 'src/lib9pclient')
-rwxr-xr-xsrc/lib9pclient/access.c36
-rw-r--r--src/lib9pclient/mkfile1
2 files changed, 37 insertions, 0 deletions
diff --git a/src/lib9pclient/access.c b/src/lib9pclient/access.c
new file mode 100755
index 00000000..210b1684
--- /dev/null
+++ b/src/lib9pclient/access.c
@@ -0,0 +1,36 @@
+#include <u.h>
+#include <libc.h>
+#include <fcall.h>
+#include <9pclient.h>
+#include "fsimpl.h"
+
+int
+fsaccess(CFsys *fsys, char *name, int mode)
+{
+ CFid *fid;
+ Dir *db;
+ static char omode[] = {
+ 0,
+ OEXEC,
+ OWRITE,
+ ORDWR,
+ OREAD,
+ OEXEC, /* only approximate */
+ ORDWR,
+ ORDWR /* only approximate */
+ };
+
+ if(mode == AEXIST){
+ db = fsdirstat(fsys, name);
+ free(db);
+ if(db != nil)
+ return 0;
+ return -1;
+ }
+ fid = fsopen(fsys, name, omode[mode&7]);
+ if(fid != nil){
+ fsclose(fid);
+ return 0;
+ }
+ return -1;
+}
diff --git a/src/lib9pclient/mkfile b/src/lib9pclient/mkfile
index 5f1eb78c..55882cae 100644
--- a/src/lib9pclient/mkfile
+++ b/src/lib9pclient/mkfile
@@ -3,6 +3,7 @@
LIB=lib9pclient.a
OFILES=\
+ access.$O\
auth.$O\
close.$O\
create.$O\