From 0e84a0ec6e7893dad13dff9a958c5bc987b79c82 Mon Sep 17 00:00:00 2001 From: rtm Date: Tue, 8 Aug 2006 19:58:06 +0000 Subject: fix race in holding() check in acquire() give cpu1 a TSS and gdt for when it enters scheduler() and a pseudo proc[] entry for each cpu cpu0 waits for each other cpu to start up read() for files --- fd.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'fd.c') diff --git a/fd.c b/fd.c index 9ce6bae..8332454 100644 --- a/fd.c +++ b/fd.c @@ -69,6 +69,13 @@ fd_read(struct fd *fd, char *addr, int n) return -1; if(fd->type == FD_PIPE){ return pipe_read(fd->pipe, addr, n); + } else if(fd->type == FD_FILE){ + ilock(fd->ip); + int cc = readi(fd->ip, addr, fd->off, n); + if(cc > 0) + fd->off += cc; + iunlock(fd->ip); + return cc; } else { panic("fd_read"); return -1; -- cgit v1.2.3