summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorrtm <rtm>2006-06-27 14:35:53 +0000
committerrtm <rtm>2006-06-27 14:35:53 +0000
commitc41f1de5d41a527a3fa2d1e94215766130eac456 (patch)
tree86f6a467be8b42aec42a05299789f39ace9cc5e2 /proc.c
parentb61c2547b8b489cab16984c0940a1cb6593a2a3d (diff)
downloadxv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.tar.gz
xv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.tar.bz2
xv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.zip
file descriptors
pipes
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/proc.c b/proc.c
index e8a911d..97e84e3 100644
--- a/proc.c
+++ b/proc.c
@@ -2,6 +2,7 @@
#include "mmu.h"
#include "x86.h"
#include "param.h"
+#include "fd.h"
#include "proc.h"
#include "defs.h"
@@ -49,6 +50,7 @@ newproc()
struct proc *np;
struct proc *op = curproc[cpu()];
unsigned *sp;
+ int fd;
for(np = &proc[1]; np < &proc[NPROC]; np++)
if(np->state == UNUSED)
@@ -80,6 +82,13 @@ newproc()
np->esp = (unsigned) sp;
np->ebp = (unsigned) sp;
+ // copy file descriptors
+ for(fd = 0; fd < NOFILE; fd++){
+ np->fds[fd] = op->fds[fd];
+ if(np->fds[fd])
+ np->fds[fd]->count += 1;
+ }
+
np->state = RUNNABLE;
cprintf("newproc %x\n", np);