summaryrefslogtreecommitdiff
path: root/kernel/proc.c
diff options
context:
space:
mode:
pi for pipe, rather than p, to avoid confusion with proc's p->lock
Diffstat (limited to 'kernel/proc.c')
-rw-r--r--kernel/proc.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/kernel/proc.c b/kernel/proc.c
index e63cc9f..bd39c4b 100644
--- a/kernel/proc.c
+++ b/kernel/proc.c
@@ -510,12 +510,6 @@ sleep(void *chan, struct spinlock *lk)
{
struct proc *p = myproc();
- if(p == 0)
- panic("sleep");
-
- if(lk == 0)
- panic("sleep without lk");
-
// Must acquire p->lock in order to
// change p->state and then call sched.
// Once we hold p->lock, we can be
@@ -543,17 +537,6 @@ sleep(void *chan, struct spinlock *lk)
}
}
-//PAGEBREAK!
-// Wake up p if it is sleeping in wait(); used by exit().
-// Caller must hold p->lock.
-static void
-wakeup1(struct proc *p)
-{
- if(p->chan == p && p->state == SLEEPING) {
- p->state = RUNNABLE;
- }
-}
-
// Wake up all processes sleeping on chan.
// Must be called without any p->lock.
void
@@ -570,6 +553,16 @@ wakeup(void *chan)
}
}
+// Wake up p if it is sleeping in wait(); used by exit().
+// Caller must hold p->lock.
+static void
+wakeup1(struct proc *p)
+{
+ if(p->chan == p && p->state == SLEEPING) {
+ p->state = RUNNABLE;
+ }
+}
+
// Kill the process with the given pid.
// The victim won't exit until it tries to return
// to user space (see usertrap() in trap.c).