From d15f0d1033a7da6448966d9626ec2776781e4188 Mon Sep 17 00:00:00 2001 From: kaashoek Date: Mon, 14 Aug 2006 03:00:13 +0000 Subject: start on mkdir stat --- ulib.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ulib.c') 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; +} -- cgit v1.2.3