summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1999-01-07 21:23:50 +0000
committerjulian <julian@FreeBSD.org>1999-01-07 21:23:50 +0000
commita7b385889ec602ef4648e627bcb67bf0fd8d539d (patch)
tree1272156e48dfdcff77f2732eaba7e964197de3bb /sys/kern/kern_exit.c
parent4cb6632c89aa14d9544a8ffe3e463e6e21aec1f3 (diff)
downloadFreeBSD-src-a7b385889ec602ef4648e627bcb67bf0fd8d539d.zip
FreeBSD-src-a7b385889ec602ef4648e627bcb67bf0fd8d539d.tar.gz
Changes to the LINUX_THREADS support to only allocate extra memory for
shared signal handling when there is shared signal handling being used. This removes the main objection to making the shared signal handling a standard ability in rfork() and friends and 'unconditionalising' this code. (i.e. the allocation of an extra 328 bytes per process). Signal handling information remains in the U area until such a time as it's reference count would be incremented to > 1. At that point a new struct is malloc'd and maintained in KVM so that it can be shared between the processes (threads) using it. A function to check the reference count and move the struct back to the U area when it drops back to 1 is also supplied. Signal information is therefore now swapable for all processes that are not sharing that information with other processes. THis should addres the concerns raised by Garrett and others. Submitted by: "Richard Seaman, Jr." <dick@tar.com>
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 7de0c48..7be01af 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
- * $Id: kern_exit.c,v 1.69 1998/11/11 10:03:54 truckman Exp $
+ * $Id: kern_exit.c,v 1.70 1998/12/19 02:55:33 julian Exp $
*/
#include "opt_compat.h"
@@ -73,6 +73,9 @@
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_zone.h>
+#ifdef COMPAT_LINUX_THREADS
+#include <sys/user.h>
+#endif
static MALLOC_DEFINE(M_ZOMBIE, "zombie", "zombie proc status");
@@ -438,14 +441,6 @@ loop:
if (uap->pid != WAIT_ANY &&
p->p_pid != uap->pid && p->p_pgid != -uap->pid)
continue;
-#ifdef COMPAT_LINUX_THREADS
- #if 0
- if ((p->p_sigparent != 0) ^ ((uap->options & WLINUXCLONE) != 0)) {
- continue;
- }
- #endif
-
-#endif /* COMPAT_LINUX_THREADS */
nfound++;
if (p->p_stat == SZOMB) {
/* charge childs scheduling cpu usage to parent */
@@ -515,11 +510,11 @@ loop:
#ifdef COMPAT_LINUX_THREADS
if (--p->p_procsig->ps_refcnt == 0) {
- free(p->p_procsig, M_TEMP);
+ if (p->p_sigacts != &p->p_addr->u_sigacts)
+ FREE(p->p_sigacts, M_SUBPROC);
+ FREE(p->p_procsig, M_SUBPROC);
p->p_procsig = NULL;
- p->p_sigacts = NULL;
}
-
#endif /* COMPAT_LINUX_THREADS */
/*
* Give machine-dependent layer a chance
@@ -576,11 +571,6 @@ proc_reparent(child, parent)
LIST_REMOVE(child, p_sibling);
LIST_INSERT_HEAD(&parent->p_children, child, p_sibling);
child->p_pptr = parent;
-#ifdef COMPAT_LINUX_THREADS
- #if 0
- child->p_sigparent = 0;
- #endif
-#endif /* COMPAT_LINUX_THREADS */
}
/*
@@ -636,3 +626,22 @@ rm_at_exit(function)
}
return (count);
}
+
+#ifdef COMPAT_LINUX_THREADS
+void check_sigacts (void)
+{
+ struct proc *p = curproc;
+ struct sigacts *pss;
+ int s;
+
+ if (p->p_procsig->ps_refcnt == 1 &&
+ p->p_sigacts != &p->p_addr->u_sigacts) {
+ pss = p->p_sigacts;
+ s = splhigh();
+ p->p_addr->u_sigacts = *pss;
+ p->p_sigacts = &p->p_addr->u_sigacts;
+ splx(s);
+ FREE(pss, M_SUBPROC);
+ }
+}
+#endif
OpenPOWER on IntegriCloud