summaryrefslogtreecommitdiff
path: root/sys/compat/linux32
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2008-04-23 13:30:41 +0000
committerad <ad@NetBSD.org>2008-04-23 13:30:41 +0000
commit6bf00a454ded679cb2440b93c7387d08a8c343a6 (patch)
tree3546ec909d4b654a415de661ea5f5b8d461a30a8 /sys/compat/linux32
parent3b31064c9a55507e18785706944dec7b33c35b0b (diff)
Catch up with linux.
Diffstat (limited to 'sys/compat/linux32')
-rw-r--r--sys/compat/linux32/common/linux32_exec.c13
-rw-r--r--sys/compat/linux32/common/linux32_wait.c11
2 files changed, 17 insertions, 7 deletions
diff --git a/sys/compat/linux32/common/linux32_exec.c b/sys/compat/linux32/common/linux32_exec.c
index 3e7906d7f8d..200155237d7 100644
--- a/sys/compat/linux32/common/linux32_exec.c
+++ b/sys/compat/linux32/common/linux32_exec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_exec.c,v 1.9 2007/12/08 18:36:11 dsl Exp $ */
+/* $NetBSD: linux32_exec.c,v 1.10 2008/04/23 13:30:41 ad Exp $ */
/*-
* Copyright (c) 1994-2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_exec.c,v 1.9 2007/12/08 18:36:11 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_exec.c,v 1.10 2008/04/23 13:30:41 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -139,9 +139,11 @@ linux32_e_proc_init(p, parent, forkflags)
MALLOC(e, void *, sizeof(struct linux_emuldata),
M_EMULDATA, M_WAITOK);
} else {
+ mutex_enter(&proclist_lock);
e->s->refs--;
if (e->s->refs == 0)
FREE(e->s, M_EMULDATA);
+ mutex_exit(&proclist_lock);
}
memset(e, '\0', sizeof(struct linux_emuldata));
@@ -158,6 +160,7 @@ linux32_e_proc_init(p, parent, forkflags)
return;
}
#endif
+ mutex_enter(&proclist_lock);
s = ep->s;
s->refs++;
} else {
@@ -192,6 +195,7 @@ linux32_e_proc_init(p, parent, forkflags)
s->xstat = 0;
s->flags = 0;
+ mutex_enter(&proclist_lock);
}
e->s = s;
@@ -200,6 +204,7 @@ linux32_e_proc_init(p, parent, forkflags)
* Add this thread in the group thread list
*/
LIST_INSERT_HEAD(&s->threads, e, threads);
+ mutex_exit(&proclist_lock);
#ifdef LINUX32_NPTL
linux_nptl_proc_init(p, parent);
@@ -233,14 +238,16 @@ linux32_e_proc_exit(struct proc *p)
#endif /* LINUX32_NPTL */
/* Remove the thread for the group thread list */
+ mutex_enter(&proclist_lock);
LIST_REMOVE(e, threads);
/* free Linux emuldata and set the pointer to null */
e->s->refs--;
if (e->s->refs == 0)
FREE(e->s, M_EMULDATA);
- FREE(e, M_EMULDATA);
p->p_emuldata = NULL;
+ mutex_exit(&proclist_lock);
+ FREE(e, M_EMULDATA);
}
/*
diff --git a/sys/compat/linux32/common/linux32_wait.c b/sys/compat/linux32/common/linux32_wait.c
index ac8b20adb4e..6e924732ab8 100644
--- a/sys/compat/linux32/common/linux32_wait.c
+++ b/sys/compat/linux32/common/linux32_wait.c
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_wait.c,v 1.6 2007/12/20 23:02:59 dsl Exp $ */
+/* $NetBSD: linux32_wait.c,v 1.7 2008/04/23 13:30:41 ad Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.6 2007/12/20 23:02:59 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.7 2008/04/23 13:30:41 ad Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -100,6 +100,7 @@ linux32_sys_wait4(struct lwp *l, const struct linux32_sys_wait4_args *uap, regis
int error, status, linux_options, options, was_zombie;
struct rusage ru;
struct netbsd32_rusage ru32;
+ proc_t *p;
int pid;
linux_options = SCARG(uap, options);
@@ -123,8 +124,10 @@ linux32_sys_wait4(struct lwp *l, const struct linux32_sys_wait4_args *uap, regis
if (pid == 0)
return error;
- /* XXXAD ksiginfo leak */
- sigdelset(&l->l_proc->p_sigpend.sp_set, SIGCHLD);
+ p = curproc;
+ mutex_enter(&p->p_smutex);
+ sigdelset(&p->p_sigpend.sp_set, SIGCHLD); /* XXXAD ksiginfo leak */
+ mutex_exit(&p->p_smutex);
if (SCARG_P32(uap, rusage) != NULL) {
netbsd32_from_rusage(&ru, &ru32);