summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-12-03 01:22:34 +0000
committerjhb <jhb@FreeBSD.org>2000-12-03 01:22:34 +0000
commitfb0ab4bf941515f86765872b6c80f885c3ff6871 (patch)
treea874bcde3630ff28f40ad3113d0f2f79a6dccae9
parentd33c1d168c21cc363ad385b8c5a2cea928affa92 (diff)
downloadFreeBSD-src-fb0ab4bf941515f86765872b6c80f885c3ff6871.zip
FreeBSD-src-fb0ab4bf941515f86765872b6c80f885c3ff6871.tar.gz
- Add a mutex to the proc structure p_mtx that will be used to lock accesses
to each individual proc. - Initialize the lock during fork1(), and destroy it in wait1().
-rw-r--r--sys/kern/init_main.c1
-rw-r--r--sys/kern/kern_exit.c1
-rw-r--r--sys/kern/kern_fork.c1
-rw-r--r--sys/sys/proc.h1
4 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index c6110fa..81cde0d 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -285,6 +285,7 @@ proc0_init(void *dummy __unused)
/*
* Create process 0 (the swapper).
*/
+ mtx_init(&p->p_mtx, "process lock", MTX_DEF);
LIST_INSERT_HEAD(&allproc, p, p_list);
p->p_pgrp = &pgrp0;
LIST_INSERT_HEAD(PGRPHASH(0), &pgrp0, pg_hash);
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 69f526c..ce3cc21 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -539,6 +539,7 @@ loop:
* release while still running in process context.
*/
cpu_wait(p);
+ mtx_destroy(&p->p_mtx);
zfree(proc_zone, p);
nprocs--;
return (0);
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 6caa1d2..6d9c6c1 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -367,6 +367,7 @@ again:
bcopy(&p1->p_startcopy, &p2->p_startcopy,
(unsigned) ((caddr_t)&p2->p_endcopy - (caddr_t)&p2->p_startcopy));
+ mtx_init(&p2->p_mtx, "process lock", MTX_DEF);
p2->p_aioinfo = NULL;
/*
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 562dd09..1cb164b 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -193,6 +193,7 @@ struct proc {
struct vnode *p_textvp; /* Vnode of executable. */
char p_lock; /* Process lock (prevent swap) count. */
+ struct mtx p_mtx; /* Process stucture lock. */
u_char p_oncpu; /* Which cpu we are on */
u_char p_lastcpu; /* Last cpu we were on */
char p_rqindex; /* Run queue index */
OpenPOWER on IntegriCloud