Fix proc refcounting comments
The comment in __proc_startcore() was old (2009), and did not get updated
in commit d705057abc58 ("cur_proc broken up into owning_proc and
cur_proc"), which is also old (2011).
proc_destroy() used to not return if it was trying to kill the calling
process. That changed a long time ago too, but the comment didn't.
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/src/process.c b/kern/src/process.c
index b7f076c..43a18c0 100644
--- a/kern/src/process.c
+++ b/kern/src/process.c
@@ -753,14 +753,8 @@
* bypass the routine_kmsg check. Interrupts should be off when you call this.
*
* A note on refcnting: this function will not return, and your proc reference
- * will end up stored in current. This will make no changes to p's refcnt, so
- * do your accounting such that there is only the +1 for current. This means if
- * it is already in current (like in the trap return path), don't up it. If
- * it's already in current and you have another reference (like pid2proc or from
- * an IPI), then down it (which is what happens in __startcore()). If it's not
- * in current and you have one reference, like proc_run(non_current_p), then
- * also do nothing. The refcnt for your *p will count for the reference stored
- * in current. */
+ * will be ignored (not decreffed). It may be incref'd, if cur_proc was not
+ * set. Pass in an already-accounted-for ref, such as owning_proc. */
void __proc_startcore(struct proc *p, struct user_context *ctx)
{
struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
diff --git a/kern/src/syscall.c b/kern/src/syscall.c
index af1ebeb..beb6e1d 100644
--- a/kern/src/syscall.c
+++ b/kern/src/syscall.c
@@ -683,7 +683,6 @@
printd("[%d] destroying proc %d\n", p->pid, p_to_die->pid);
}
proc_destroy(p_to_die);
- /* we only get here if we weren't the one to die */
proc_decref(p_to_die);
return 0;
}