summaryrefslogtreecommitdiff
path: root/fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'fd.c')
-rw-r--r--fd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fd.c b/fd.c
index d162813..c5c3e57 100644
--- a/fd.c
+++ b/fd.c
@@ -1,4 +1,5 @@
#include "types.h"
+#include "stat.h"
#include "param.h"
#include "x86.h"
#include "mmu.h"
@@ -121,6 +122,18 @@ fd_close(struct fd *fd)
release(&fd_table_lock);
}
+int
+fd_stat(struct fd *fd, struct stat *st)
+{
+ if(fd->type == FD_FILE){
+ ilock(fd->ip);
+ stati(fd->ip, st);
+ iunlock(fd->ip);
+ return 0;
+ } else
+ return -1;
+}
+
void
fd_incref(struct fd *fd)
{