summaryrefslogtreecommitdiff
path: root/ulib.c
diff options
context:
space:
mode:
authorkaashoek <kaashoek>2006-08-14 03:00:13 +0000
committerkaashoek <kaashoek>2006-08-14 03:00:13 +0000
commitd15f0d1033a7da6448966d9626ec2776781e4188 (patch)
tree21760376e140e637d48cb3a246b76f62650a454e /ulib.c
parente4bcd2a3a919ef040d2a577a1025f286c3b57168 (diff)
downloadxv6-labs-d15f0d1033a7da6448966d9626ec2776781e4188.tar.gz
xv6-labs-d15f0d1033a7da6448966d9626ec2776781e4188.tar.bz2
xv6-labs-d15f0d1033a7da6448966d9626ec2776781e4188.zip
start on mkdir
stat
Diffstat (limited to 'ulib.c')
-rw-r--r--ulib.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ulib.c b/ulib.c
index b759f45..eaa33d3 100644
--- a/ulib.c
+++ b/ulib.c
@@ -1,3 +1,6 @@
+#include "types.h"
+#include "stat.h"
+#include "fcntl.h"
#include "user.h"
int
@@ -54,3 +57,16 @@ gets(char *buf, int max)
buf[i] = '\0';
return buf;
}
+
+int
+stat(char *n, struct stat *st)
+{
+ int fd = open(n, O_RDONLY);
+ int r;
+
+ if (fd < 0) return -1;
+
+ r = fstat(fd, st);
+ close(fd);
+ return r;
+}