summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2020-02-21 11:10:24 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2020-02-21 11:10:24 +0000
commit44f18b94170cd98c42626b69d8362d0e13a638ab (patch)
treec72c783c8d33841707638b976df9691ef5010bda /sys
parent60414df02f949212f37643473418202f197dd828 (diff)
Remove sigacts structure sharing. The only process that used sharing was
proc0 which is used for kthreads and idle threads. proc0 and all those other kernel threads don't handle signals so there is no benefit in sharing. Simplifies the code a fair bit since the refcnt is gone. OK kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_fork.c10
-rw-r--r--sys/kern/kern_kthread.c4
-rw-r--r--sys/kern/kern_sched.c4
-rw-r--r--sys/kern/kern_sig.c36
-rw-r--r--sys/sys/proc.h3
-rw-r--r--sys/sys/signalvar.h5
6 files changed, 10 insertions, 52 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 6308e037832..613ec3c8d8f 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.222 2020/01/30 08:51:27 mpi Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.223 2020/02/21 11:10:23 claudio Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -250,10 +250,7 @@ process_new(struct proc *p, struct process *parent, int flags)
pr->ps_fd = fdshare(parent);
else
pr->ps_fd = fdcopy(parent);
- if (flags & FORK_SIGHAND)
- pr->ps_sigacts = sigactsshare(parent);
- else
- pr->ps_sigacts = sigactsinit(parent);
+ pr->ps_sigacts = sigactsinit(parent);
if (flags & FORK_SHAREVM)
pr->ps_vmspace = uvmspace_share(parent);
else
@@ -335,8 +332,7 @@ fork1(struct proc *curp, int flags, void (*func)(void *), void *arg,
KASSERT((flags & ~(FORK_FORK | FORK_VFORK | FORK_PPWAIT | FORK_PTRACE
| FORK_IDLE | FORK_SHAREVM | FORK_SHAREFILES | FORK_NOZOMBIE
- | FORK_SYSTEM | FORK_SIGHAND)) == 0);
- KASSERT((flags & FORK_SIGHAND) == 0 || (flags & FORK_SHAREVM));
+ | FORK_SYSTEM)) == 0);
KASSERT(func != NULL);
if ((error = fork_check_maxthread(uid)))
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 5365695b40e..0de0cf83001 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_kthread.c,v 1.43 2019/12/11 07:30:09 guenther Exp $ */
+/* $OpenBSD: kern_kthread.c,v 1.44 2020/02/21 11:10:23 claudio Exp $ */
/* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */
/*-
@@ -67,7 +67,7 @@ kthread_create(void (*func)(void *), void *arg,
* parent to wait for.
*/
error = fork1(&proc0, FORK_SHAREVM|FORK_SHAREFILES|FORK_NOZOMBIE|
- FORK_SYSTEM|FORK_SIGHAND, func, arg, NULL, &p);
+ FORK_SYSTEM, func, arg, NULL, &p);
if (error) {
KERNEL_UNLOCK();
return (error);
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index 06185845521..85eb00c0206 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sched.c,v 1.65 2020/02/05 10:12:38 mpi Exp $ */
+/* $OpenBSD: kern_sched.c,v 1.66 2020/02/21 11:10:23 claudio Exp $ */
/*
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
*
@@ -118,7 +118,7 @@ sched_kthreads_create(void *v)
static int num;
if (fork1(&proc0, FORK_SHAREVM|FORK_SHAREFILES|FORK_NOZOMBIE|
- FORK_SYSTEM|FORK_SIGHAND|FORK_IDLE, sched_idle, ci, NULL,
+ FORK_SYSTEM|FORK_IDLE, sched_idle, ci, NULL,
&spc->spc_idleproc))
panic("fork idle");
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index fbe327d359d..bcf29942cd8 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.250 2020/02/21 06:08:42 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.251 2020/02/21 11:10:23 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -178,23 +178,10 @@ sigactsinit(struct process *pr)
ps = pool_get(&sigacts_pool, PR_WAITOK);
memcpy(ps, pr->ps_sigacts, sizeof(struct sigacts));
- ps->ps_refcnt = 1;
return (ps);
}
/*
- * Share a sigacts structure.
- */
-struct sigacts *
-sigactsshare(struct process *pr)
-{
- struct sigacts *ps = pr->ps_sigacts;
-
- ps->ps_refcnt++;
- return ps;
-}
-
-/*
* Initialize a new sigaltstack structure.
*/
void
@@ -206,23 +193,6 @@ sigstkinit(struct sigaltstack *ss)
}
/*
- * Make this process not share its sigacts, maintaining all
- * signal state.
- */
-void
-sigactsunshare(struct process *pr)
-{
- struct sigacts *newps;
-
- if (pr->ps_sigacts->ps_refcnt == 1)
- return;
-
- newps = sigactsinit(pr);
- sigactsfree(pr);
- pr->ps_sigacts = newps;
-}
-
-/*
* Release a sigacts structure.
*/
void
@@ -230,9 +200,6 @@ sigactsfree(struct process *pr)
{
struct sigacts *ps = pr->ps_sigacts;
- if (--ps->ps_refcnt > 0)
- return;
-
pr->ps_sigacts = NULL;
pool_put(&sigacts_pool, ps);
@@ -412,7 +379,6 @@ execsigs(struct proc *p)
struct sigacts *ps;
int nc, mask;
- sigactsunshare(p->p_p);
ps = p->p_p->ps_sigacts;
/*
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index d3dcb14cfef..3de46326551 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.288 2020/02/15 09:35:48 anton Exp $ */
+/* $OpenBSD: proc.h,v 1.289 2020/02/21 11:10:23 claudio Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -506,7 +506,6 @@ void uid_release(struct uidinfo *);
#define FORK_SYSTEM 0x00000020
#define FORK_NOZOMBIE 0x00000040
#define FORK_SHAREVM 0x00000080
-#define FORK_SIGHAND 0x00000200
#define FORK_PTRACE 0x00000400
#define EXIT_NORMAL 0x00000001
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index 3db07dab10e..7603cf60eab 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signalvar.h,v 1.37 2020/01/03 09:46:41 claudio Exp $ */
+/* $OpenBSD: signalvar.h,v 1.38 2020/02/21 11:10:23 claudio Exp $ */
/* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */
/*
@@ -54,7 +54,6 @@ struct sigacts {
sigset_t ps_sigignore; /* signals being ignored */
sigset_t ps_sigcatch; /* signals being caught by user */
int ps_flags; /* signal flags, below */
- int ps_refcnt; /* reference count */
};
/* signal flags */
@@ -177,9 +176,7 @@ int killpg1(struct proc *, int, int, int);
void signal_init(void);
struct sigacts *sigactsinit(struct process *);
-struct sigacts *sigactsshare(struct process *);
void sigstkinit(struct sigaltstack *);
-void sigactsunshare(struct process *);
void sigactsfree(struct process *);
/*