summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-03-27 21:36:18 +0000
committeralfred <alfred@FreeBSD.org>2002-03-27 21:36:18 +0000
commitc513408927799beb8e88e8b08ae677bd46e77762 (patch)
treed0767f02bd164a185d51f517305b003af562e955 /sys/kern/kern_exec.c
parent706e613c585af652438c7e21c1741947752de3b8 (diff)
downloadFreeBSD-src-c513408927799beb8e88e8b08ae677bd46e77762.zip
FreeBSD-src-c513408927799beb8e88e8b08ae677bd46e77762.tar.gz
Make the reference counting of 'struct pargs' SMP safe.
There is still some locations where the PROC lock should be held in order to prevent inconsistent views from outside (like the proc->p_fd fix for kern/vfs_syscalls.c:checkdirs()) that can be fixed later. Submitted by: Jonathan Mini <mini@haikugeek.com>
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 8e88de6..fe0be73 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -441,8 +441,7 @@ interpret:
pa = p->p_args;
p->p_args = NULL;
PROC_UNLOCK(p);
- if (pa != NULL && --pa->ar_ref == 0)
- FREE(pa, M_PARGS);
+ pargs_drop(pa);
/* Set values passed into the program in registers. */
setregs(td, imgp->entry_addr, (u_long)(uintptr_t)stack_base,
@@ -451,10 +450,7 @@ interpret:
/* Cache arguments if they fit inside our allowance */
i = imgp->endargs - imgp->stringbase;
if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
- MALLOC(pa, struct pargs *, sizeof(struct pargs) + i,
- M_PARGS, M_WAITOK);
- pa->ar_ref = 1;
- pa->ar_length = i;
+ pa = pargs_alloc(i);
bcopy(imgp->stringbase, pa->ar_args, i);
PROC_LOCK(p);
p->p_args = pa;
OpenPOWER on IntegriCloud