summaryrefslogtreecommitdiff
path: root/kernel/proc.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-07-20 18:51:31 -0400
committerRobert Morris <[email protected]>2019-07-20 18:51:31 -0400
commit328204d9cc3995a44bb3cce2f5206e392a8601a7 (patch)
treee15cf9f430297f54e52aac040428c9cfe0304af7 /kernel/proc.c
parent06e49a58dcc8ba3f898ba5399449312cd129b0fe (diff)
downloadxv6-labs-328204d9cc3995a44bb3cce2f5206e392a8601a7.tar.gz
xv6-labs-328204d9cc3995a44bb3cce2f5206e392a8601a7.tar.bz2
xv6-labs-328204d9cc3995a44bb3cce2f5206e392a8601a7.zip
not much
Diffstat (limited to 'kernel/proc.c')
-rw-r--r--kernel/proc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/proc.c b/kernel/proc.c
index bd39c4b..edb6001 100644
--- a/kernel/proc.c
+++ b/kernel/proc.c
@@ -319,13 +319,12 @@ void
exit(void)
{
struct proc *p = myproc();
- int fd;
if(p == initproc)
panic("init exiting");
// Close all open files.
- for(fd = 0; fd < NOFILE; fd++){
+ for(int fd = 0; fd < NOFILE; fd++){
if(p->ofile[fd]){
struct file *f = p->ofile[fd];
fileclose(f);
@@ -342,14 +341,14 @@ exit(void)
acquire(&p->lock);
- // Give our children to init.
+ // Give any children to init.
reparent(p, p->parent);
- p->state = ZOMBIE;
-
// Parent might be sleeping in wait().
wakeup1(p->parent);
+ p->state = ZOMBIE;
+
release(&p->parent->lock);
// Jump into the scheduler, never to return.