diff options
Diffstat (limited to 'ulib.c')
-rw-r--r-- | ulib.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; +} |