summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/alpha/alpha/machdep.c4
-rw-r--r--sys/arch/amd64/amd64/machdep.c4
-rw-r--r--sys/arch/arm/arm/sig_machdep.c4
-rw-r--r--sys/arch/hppa/hppa/machdep.c4
-rw-r--r--sys/arch/hppa64/hppa64/machdep.c4
-rw-r--r--sys/arch/i386/i386/linux_machdep.c4
-rw-r--r--sys/arch/i386/i386/machdep.c4
-rw-r--r--sys/arch/m88k/m88k/sig_machdep.c4
-rw-r--r--sys/arch/macppc/macppc/machdep.c4
-rw-r--r--sys/arch/mips64/mips64/sendsig.c4
-rw-r--r--sys/arch/sh/sh/sh_machdep.c4
-rw-r--r--sys/arch/socppc/socppc/machdep.c4
-rw-r--r--sys/arch/solbourne/solbourne/machdep.c4
-rw-r--r--sys/arch/sparc/sparc/machdep.c4
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c4
-rw-r--r--sys/arch/vax/vax/machdep.c4
-rw-r--r--sys/kern/exec_elf.c6
-rw-r--r--sys/kern/init_main.c8
-rw-r--r--sys/kern/kern_exit.c15
-rw-r--r--sys/kern/kern_fork.c56
-rw-r--r--sys/kern/kern_sig.c68
-rw-r--r--sys/kern/kern_synch.c5
-rw-r--r--sys/kern/kern_sysctl.c4
-rw-r--r--sys/kern/tty.c8
-rw-r--r--sys/kern/tty_pty.c4
-rw-r--r--sys/nfs/nfs_socket.c6
-rw-r--r--sys/sys/proc.h4
-rw-r--r--sys/sys/signalvar.h17
-rw-r--r--sys/sys/sysctl.h4
29 files changed, 133 insertions, 136 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index 61c5dd8743a..a806c5f8a46 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.150 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.151 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -1427,7 +1427,7 @@ sendsig(catcher, sig, mask, code, type, val)
struct sigcontext *scp, ksc;
struct fpreg *fpregs = (struct fpreg *)&ksc.sc_fpregs;
struct trapframe *frame;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
unsigned long oldsp;
int fsize, rndfsize, kscsize;
siginfo_t *sip, ksi;
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index ff40d3346b1..f8b43ad877d 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.174 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.175 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -543,7 +543,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
{
struct proc *p = curproc;
struct trapframe *tf = p->p_md.md_regs;
- struct sigacts * psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct sigcontext ksc;
siginfo_t ksi;
register_t sp, scp, sip;
diff --git a/sys/arch/arm/arm/sig_machdep.c b/sys/arch/arm/arm/sig_machdep.c
index 7fa8e03c55a..87ce5695107 100644
--- a/sys/arch/arm/arm/sig_machdep.c
+++ b/sys/arch/arm/arm/sig_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sig_machdep.c,v 1.9 2013/05/10 10:20:23 patrick Exp $ */
+/* $OpenBSD: sig_machdep.c,v 1.10 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: sig_machdep.c,v 1.22 2003/10/08 00:28:41 thorpej Exp $ */
/*
@@ -81,7 +81,7 @@ sendsig(sig_t catcher, int sig, int returnmask, u_long code, int type,
struct proc *p = curproc;
struct trapframe *tf;
struct sigframe *fp, frame;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
tf = process_frame(p);
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index bbec65937c7..7b8670f650b 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.214 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.215 2014/03/22 06:05:45 guenther Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
@@ -1216,7 +1216,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
struct proc *p = curproc;
struct trapframe *tf = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct sigcontext ksc;
siginfo_t ksi;
register_t scp, sip;
diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c
index 46e628da809..724b82edc27 100644
--- a/sys/arch/hppa64/hppa64/machdep.c
+++ b/sys/arch/hppa64/hppa64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.54 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.55 2014/03/22 06:05:45 guenther Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -844,7 +844,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
struct proc *p = curproc;
struct trapframe *tf = p->p_md.md_regs;
struct pcb *pcb = &p->p_addr->u_pcb;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct sigcontext ksc;
siginfo_t ksi;
register_t scp, sip;
diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c
index 70f4c59ba52..ffa82f656f4 100644
--- a/sys/arch/i386/i386/linux_machdep.c
+++ b/sys/arch/i386/i386/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_machdep.c,v 1.43 2012/04/22 05:43:14 guenther Exp $ */
+/* $OpenBSD: linux_machdep.c,v 1.44 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */
/*
@@ -110,7 +110,7 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
struct proc *p = curproc;
struct trapframe *tf;
struct linux_sigframe *fp, frame;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
int oonstack;
tf = p->p_md.md_regs;
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 515551421dd..26c177d02f9 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.533 2014/03/16 05:19:44 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.534 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2304,7 +2304,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
struct proc *p = curproc;
struct trapframe *tf = p->p_md.md_regs;
struct sigframe *fp, frame;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
register_t sp;
/*
diff --git a/sys/arch/m88k/m88k/sig_machdep.c b/sys/arch/m88k/m88k/sig_machdep.c
index e634fbdfa18..518dad599e6 100644
--- a/sys/arch/m88k/m88k/sig_machdep.c
+++ b/sys/arch/m88k/m88k/sig_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sig_machdep.c,v 1.16 2012/12/02 07:03:31 guenther Exp $ */
+/* $OpenBSD: sig_machdep.c,v 1.17 2014/03/22 06:05:45 guenther Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -88,7 +88,7 @@ sendsig(sig_t catcher, int sig, int mask, unsigned long code, int type,
{
struct proc *p = curproc;
struct trapframe *tf;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct sigframe *fp;
int fsize;
struct sigframe sf;
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index 02a5ff8cf32..dcb9058cd41 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.145 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.146 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -532,7 +532,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
struct proc *p = curproc;
struct trapframe *tf;
struct sigframe *fp, frame;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
bzero(&frame, sizeof(frame));
frame.sf_signum = sig;
diff --git a/sys/arch/mips64/mips64/sendsig.c b/sys/arch/mips64/mips64/sendsig.c
index 74c238e5e57..826cf2157ff 100644
--- a/sys/arch/mips64/mips64/sendsig.c
+++ b/sys/arch/mips64/mips64/sendsig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendsig.c,v 1.20 2012/12/02 07:03:31 guenther Exp $ */
+/* $OpenBSD: sendsig.c,v 1.21 2014/03/22 06:05:45 guenther Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -111,7 +111,7 @@ sendsig(catcher, sig, mask, code, type, val)
struct proc *p = curproc;
struct sigframe *fp;
struct trap_frame *regs;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
int fsize;
struct sigcontext ksc;
diff --git a/sys/arch/sh/sh/sh_machdep.c b/sys/arch/sh/sh/sh_machdep.c
index 79eeb06ed47..f0033bacb79 100644
--- a/sys/arch/sh/sh/sh_machdep.c
+++ b/sys/arch/sh/sh/sh_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sh_machdep.c,v 1.34 2013/06/11 16:42:10 deraadt Exp $ */
+/* $OpenBSD: sh_machdep.c,v 1.35 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */
/*
@@ -460,7 +460,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
struct proc *p = curproc;
struct sigframe *fp, frame;
struct trapframe *tf = p->p_md.md_regs;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
siginfo_t *sip;
if ((p->p_sigstk.ss_flags & SS_DISABLE) == 0 &&
diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c
index 59d0c15e05c..f7c790a8114 100644
--- a/sys/arch/socppc/socppc/machdep.c
+++ b/sys/arch/socppc/socppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.40 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.41 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -880,7 +880,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
struct proc *p = curproc;
struct trapframe *tf;
struct sigframe *fp, frame;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
bzero(&frame, sizeof(frame));
frame.sf_signum = sig;
diff --git a/sys/arch/solbourne/solbourne/machdep.c b/sys/arch/solbourne/solbourne/machdep.c
index c5371c495c0..d408d37f222 100644
--- a/sys/arch/solbourne/solbourne/machdep.c
+++ b/sys/arch/solbourne/solbourne/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.28 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.29 2014/03/22 06:05:45 guenther Exp $ */
/* OpenBSD: machdep.c,v 1.105 2005/04/11 15:13:01 deraadt Exp */
/*
@@ -361,7 +361,7 @@ sendsig(catcher, sig, mask, code, type, val)
union sigval val;
{
struct proc *p = curproc;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct sigframe *fp;
struct trapframe *tf;
int caddr, oldsp, newsp;
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index d336fae3e45..42efbeccbfd 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.148 2014/03/13 03:52:55 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.149 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -370,7 +370,7 @@ sendsig(catcher, sig, mask, code, type, val)
union sigval val;
{
struct proc *p = curproc;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct sigframe *fp;
struct trapframe *tf;
int caddr, oldsp, newsp;
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 445f86c341e..4f3dca565ad 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.151 2014/03/21 03:56:49 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.152 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -424,7 +424,7 @@ sendsig(catcher, sig, mask, code, type, val)
union sigval val;
{
struct proc *p = curproc;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct sigframe *fp;
struct trapframe64 *tf;
vaddr_t addr, oldsp, newsp;
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index 79a451bf828..be2017947a6 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.131 2014/03/13 03:52:56 dlg Exp $ */
+/* $OpenBSD: machdep.c,v 1.132 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */
/*
@@ -443,7 +443,7 @@ sendsig(catcher, sig, mask, code, type, val)
union sigval val;
{
struct proc *p = curproc;
- struct sigacts *psp = p->p_sigacts;
+ struct sigacts *psp = p->p_p->ps_sigacts;
struct trapframe *syscf;
struct sigframe *sigf, gsigf;
unsigned int cursp;
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index 8b6f0720965..49a3d80783e 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.94 2014/01/21 01:48:44 tedu Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.95 2014/03/22 06:05:45 guenther Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -1158,8 +1158,8 @@ ELFNAMEEND(coredump_notes)(struct proc *p, void *iocookie, size_t *sizep)
cpi.cpi_sigpend = p->p_siglist;
cpi.cpi_sigmask = p->p_sigmask;
- cpi.cpi_sigignore = p->p_sigacts->ps_sigignore;
- cpi.cpi_sigcatch = p->p_sigacts->ps_sigcatch;
+ cpi.cpi_sigignore = pr->ps_sigacts->ps_sigignore;
+ cpi.cpi_sigcatch = pr->ps_sigacts->ps_sigcatch;
cpi.cpi_pid = pr->ps_pid;
cpi.cpi_ppid = pr->ps_pptr->ps_pid;
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 3e485ff18db..0e104a417f0 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.204 2014/02/12 05:47:36 guenther Exp $ */
+/* $OpenBSD: init_main.c,v 1.205 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -299,8 +299,8 @@ main(void *framep)
/* Initialize signal state for process 0. */
signal_init();
- p->p_sigacts = &sigacts0;
- siginit(p);
+ pr->ps_sigacts = &sigacts0;
+ siginit(pr);
/* Create the file descriptor table. */
p->p_fd = fdinit(NULL);
@@ -604,7 +604,7 @@ start_init(void *arg)
check_console(p);
/* process 0 ignores SIGCHLD, but we can't */
- p->p_sigacts->ps_flags = 0;
+ p->p_p->ps_sigacts->ps_flags = 0;
/*
* Need just enough stack to hold the faked-up "execve()" arguments.
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index cc28af15ec5..6505d739f41 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.135 2014/02/12 05:47:36 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.136 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -240,8 +240,7 @@ exit1(struct proc *p, int rv, int flags)
* If parent has the SAS_NOCLDWAIT flag set, we're not
* going to become a zombie.
*/
- if (pr->ps_pptr->ps_mainproc->p_sigacts->ps_flags &
- SAS_NOCLDWAIT)
+ if (pr->ps_pptr->ps_sigacts->ps_flags & SAS_NOCLDWAIT)
atomic_setbits_int(&pr->ps_flags, PS_NOZOMBIE);
}
@@ -347,12 +346,12 @@ exit1(struct proc *p, int rv, int flags)
proc_reparent(pr, initproc->p_p);
wakeup(ppr);
}
- }
- /*
- * Release the process's signal state.
- */
- sigactsfree(p);
+ /*
+ * Release the process's signal state.
+ */
+ sigactsfree(pr);
+ }
/* just a thread? detach it from its process */
if (p->p_flag & P_THREAD) {
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index d8a462dc907..22da80f01d6 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.158 2014/02/12 05:47:36 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.159 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -78,7 +78,7 @@ void fork_return(void *);
void tfork_child_return(void *);
int pidtaken(pid_t);
-void process_new(struct proc *, struct process *);
+void process_new(struct proc *, struct process *, int);
void
fork_return(void *arg)
@@ -152,7 +152,7 @@ tfork_child_return(void *arg)
* Allocate and initialize a new process.
*/
void
-process_new(struct proc *p, struct process *parent)
+process_new(struct proc *p, struct process *parent, int flags)
{
struct process *pr;
@@ -195,6 +195,21 @@ process_new(struct proc *p, struct process *parent)
p->p_p = pr;
+ /*
+ * Create signal actions for the child process.
+ */
+ if (flags & FORK_SIGHAND)
+ pr->ps_sigacts = sigactsshare(parent);
+ else
+ pr->ps_sigacts = sigactsinit(parent);
+
+ if (parent->ps_flags & PS_PROFIL)
+ startprofclock(pr);
+ if ((flags & FORK_PTRACE) && (parent->ps_flags & PS_TRACED))
+ atomic_setbits_int(&pr->ps_flags, PS_TRACED);
+ if (flags & FORK_NOZOMBIE)
+ atomic_setbits_int(&pr->ps_flags, PS_NOZOMBIE);
+
/* it's sufficiently inited to be globally visible */
LIST_INSERT_HEAD(&allprocess, pr, ps_list);
}
@@ -295,16 +310,6 @@ fork1(struct proc *curp, int flags, void *stack, pid_t *tidptr,
p->p_stat = SIDL; /* protect against others */
p->p_flag = 0;
- p->p_xstat = 0;
-
- if (flags & FORK_THREAD) {
- atomic_setbits_int(&p->p_flag, P_THREAD);
- p->p_p = pr = curpr;
- pr->ps_refcnt++;
- } else {
- process_new(p, curpr);
- pr = p->p_p;
- }
/*
* Make a proc table entry for the new process.
@@ -321,19 +326,19 @@ fork1(struct proc *curp, int flags, void *stack, pid_t *tidptr,
*/
timeout_set(&p->p_sleep_to, endtsleep, p);
+ if (flags & FORK_THREAD) {
+ atomic_setbits_int(&p->p_flag, P_THREAD);
+ p->p_p = pr = curpr;
+ pr->ps_refcnt++;
+ } else {
+ process_new(p, curpr, flags);
+ pr = p->p_p;
+ }
+
/*
* Duplicate sub-structures as needed.
* Increase reference counts on shared objects.
*/
- if ((flags & FORK_THREAD) == 0) {
- if (curpr->ps_flags & PS_PROFIL)
- startprofclock(pr);
- if ((flags & FORK_PTRACE) && (curpr->ps_flags & PS_TRACED))
- atomic_setbits_int(&pr->ps_flags, PS_TRACED);
- if (flags & FORK_NOZOMBIE)
- atomic_setbits_int(&pr->ps_flags, PS_NOZOMBIE);
- }
-
if (flags & FORK_SHAREFILES)
p->p_fd = fdshare(curp);
else
@@ -361,13 +366,6 @@ fork1(struct proc *curp, int flags, void *stack, pid_t *tidptr,
*/
scheduler_fork_hook(curp, p);
- /*
- * Create signal actions for the child process.
- */
- if (flags & FORK_SIGHAND)
- p->p_sigacts = sigactsshare(curp);
- else
- p->p_sigacts = sigactsinit(curp);
if (flags & FORK_THREAD)
sigstkinit(&p->p_sigstk);
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 4f0a6af6e89..31b98c6a45d 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.158 2014/02/09 11:17:19 kettenis Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.159 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -149,12 +149,12 @@ signal_init(void)
* as p.
*/
struct sigacts *
-sigactsinit(struct proc *p)
+sigactsinit(struct process *pr)
{
struct sigacts *ps;
ps = pool_get(&sigacts_pool, PR_WAITOK);
- memcpy(ps, p->p_sigacts, sizeof(struct sigacts));
+ memcpy(ps, pr->ps_sigacts, sizeof(struct sigacts));
ps->ps_refcnt = 1;
return (ps);
}
@@ -163,10 +163,12 @@ sigactsinit(struct proc *p)
* Share a sigacts structure.
*/
struct sigacts *
-sigactsshare(struct proc *p)
+sigactsshare(struct process *pr)
{
- p->p_sigacts->ps_refcnt++;
- return p->p_sigacts;
+ struct sigacts *ps = pr->ps_sigacts;
+
+ ps->ps_refcnt++;
+ return ps;
}
/*
@@ -185,30 +187,30 @@ sigstkinit(struct sigaltstack *ss)
* signal state.
*/
void
-sigactsunshare(struct proc *p)
+sigactsunshare(struct process *pr)
{
struct sigacts *newps;
- if (p->p_sigacts->ps_refcnt == 1)
+ if (pr->ps_sigacts->ps_refcnt == 1)
return;
- newps = sigactsinit(p);
- sigactsfree(p);
- p->p_sigacts = newps;
+ newps = sigactsinit(pr);
+ sigactsfree(pr);
+ pr->ps_sigacts = newps;
}
/*
* Release a sigacts structure.
*/
void
-sigactsfree(struct proc *p)
+sigactsfree(struct process *pr)
{
- struct sigacts *ps = p->p_sigacts;
+ struct sigacts *ps = pr->ps_sigacts;
if (--ps->ps_refcnt > 0)
return;
- p->p_sigacts = NULL;
+ pr->ps_sigacts = NULL;
pool_put(&sigacts_pool, ps);
}
@@ -229,7 +231,7 @@ sys_sigaction(struct proc *p, void *v, register_t *retval)
struct sigaction *sa;
const struct sigaction *nsa;
struct sigaction *osa;
- struct sigacts *ps = p->p_sigacts;
+ struct sigacts *ps = p->p_p->ps_sigacts;
int signum;
int bit, error;
@@ -291,7 +293,7 @@ sys_sigaction(struct proc *p, void *v, register_t *retval)
void
setsigvec(struct proc *p, int signum, struct sigaction *sa)
{
- struct sigacts *ps = p->p_sigacts;
+ struct sigacts *ps = p->p_p->ps_sigacts;
int bit;
int s;
@@ -315,8 +317,9 @@ setsigvec(struct proc *p, int signum, struct sigaction *sa)
* (init) which will reap the zombie. Because we use
* init to do our dirty work we never set SAS_NOCLDWAIT
* for PID 1.
+ * XXX exit1 rework means this is unnecessary?
*/
- if (initproc->p_sigacts != ps &&
+ if (initproc->p_p->ps_sigacts != ps &&
((sa->sa_flags & SA_NOCLDWAIT) ||
sa->sa_handler == SIG_IGN))
atomic_setbits_int(&ps->ps_flags, SAS_NOCLDWAIT);
@@ -366,9 +369,9 @@ setsigvec(struct proc *p, int signum, struct sigaction *sa)
* set to ignore signals that are ignored by default.
*/
void
-siginit(struct proc *p)
+siginit(struct process *pr)
{
- struct sigacts *ps = p->p_sigacts;
+ struct sigacts *ps = pr->ps_sigacts;
int i;
for (i = 0; i < NSIG; i++)
@@ -378,7 +381,7 @@ siginit(struct proc *p)
}
/*
- * Reset signals for an exec of the specified process.
+ * Reset signals for an exec by the specified thread.
*/
void
execsigs(struct proc *p)
@@ -386,8 +389,8 @@ execsigs(struct proc *p)
struct sigacts *ps;
int nc, mask;
- sigactsunshare(p);
- ps = p->p_sigacts;
+ sigactsunshare(p->p_p);
+ ps = p->p_p->ps_sigacts;
/*
* Reset caught signals. Held signals remain held
@@ -475,7 +478,8 @@ sys_sigsuspend(struct proc *p, void *v, register_t *retval)
struct sys_sigsuspend_args /* {
syscallarg(int) mask;
} */ *uap = v;
- struct sigacts *ps = p->p_sigacts;
+ struct process *pr = p->p_p;
+ struct sigacts *ps = pr->ps_sigacts;
/*
* When returning from sigpause, we want
@@ -721,11 +725,12 @@ void
trapsignal(struct proc *p, int signum, u_long trapno, int code,
union sigval sigval)
{
- struct sigacts *ps = p->p_sigacts;
+ struct process *pr = p->p_p;
+ struct sigacts *ps = pr->ps_sigacts;
int mask;
mask = sigmask(signum);
- if ((p->p_p->ps_flags & PS_TRACED) == 0 &&
+ if ((pr->ps_flags & PS_TRACED) == 0 &&
(ps->ps_sigcatch & mask) != 0 &&
(p->p_sigmask & mask) == 0) {
#ifdef KTRACE
@@ -874,11 +879,11 @@ ptsignal(struct proc *p, int signum, enum signal_type type)
* and if it is set to SIG_IGN,
* action will be SIG_DFL here.)
*/
- if (p->p_sigacts->ps_sigignore & mask)
+ if (pr->ps_sigacts->ps_sigignore & mask)
return;
if (p->p_sigmask & mask) {
action = SIG_HOLD;
- } else if (p->p_sigacts->ps_sigcatch & mask) {
+ } else if (pr->ps_sigacts->ps_sigcatch & mask) {
action = SIG_CATCH;
} else {
action = SIG_DFL;
@@ -1097,7 +1102,7 @@ issignal(struct proc *p)
* We should see pending but ignored signals
* only if PS_TRACED was on when they were posted.
*/
- if (mask & p->p_sigacts->ps_sigignore &&
+ if (mask & pr->ps_sigacts->ps_sigignore &&
(pr->ps_flags & PS_TRACED) == 0)
continue;
@@ -1153,7 +1158,7 @@ issignal(struct proc *p)
* Return the signal's number, or fall through
* to clear it from the pending mask.
*/
- switch ((long)p->p_sigacts->ps_sigact[signum]) {
+ switch ((long)pr->ps_sigacts->ps_sigact[signum]) {
case (long)SIG_DFL:
/*
* Don't take default actions on system processes.
@@ -1268,8 +1273,7 @@ proc_stop_sweep(void *v)
continue;
atomic_clearbits_int(&pr->ps_flags, PS_STOPPED);
- if ((pr->ps_pptr->ps_mainproc->p_sigacts->ps_flags &
- SAS_NOCLDSTOP) == 0)
+ if ((pr->ps_pptr->ps_sigacts->ps_flags & SAS_NOCLDSTOP) == 0)
prsignal(pr->ps_pptr, SIGCHLD);
wakeup(pr->ps_pptr);
}
@@ -1283,7 +1287,7 @@ void
postsig(int signum)
{
struct proc *p = curproc;
- struct sigacts *ps = p->p_sigacts;
+ struct sigacts *ps = p->p_p->ps_sigacts;
sig_t action;
u_long trapno;
int mask, returnmask;
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 50b3a851deb..d461fe2ec96 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.114 2014/01/23 01:48:44 guenther Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.115 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -310,7 +310,8 @@ sleep_finish_signal(struct sleep_state *sls)
if ((error = single_thread_check(p, 1)))
return (error);
if (sls->sls_sig != 0 || (sls->sls_sig = CURSIG(p)) != 0) {
- if (p->p_sigacts->ps_sigintr & sigmask(sls->sls_sig))
+ if (p->p_p->ps_sigacts->ps_sigintr &
+ sigmask(sls->sls_sig))
return (EINTR);
return (ERESTART);
}
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 05d18a40d1c..ae39c479078 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.244 2014/01/21 01:48:44 tedu Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.245 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1502,7 +1502,7 @@ fill_kproc(struct proc *p, struct kinfo_proc *ki, int isthread,
struct timespec ut, st;
FILL_KPROC(ki, strlcpy, p, pr, p->p_cred, p->p_ucred, pr->ps_pgrp,
- p, pr, s, p->p_vmspace, pr->ps_limit, p->p_sigacts, isthread,
+ p, pr, s, p->p_vmspace, pr->ps_limit, pr->ps_sigacts, isthread,
show_pointers);
/* stuff that's too painful to generalize into the macros */
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 8abd6bdb39a..00874e8f3d6 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.104 2013/12/16 18:46:39 millert Exp $ */
+/* $OpenBSD: tty.c,v 1.105 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -739,7 +739,7 @@ ttioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
case TIOCSWINSZ:
while (isbackground(pr, tp) &&
(pr->ps_flags & PS_PPWAIT) == 0 &&
- (p->p_sigacts->ps_sigignore & sigmask(SIGTTOU)) == 0 &&
+ (pr->ps_sigacts->ps_sigignore & sigmask(SIGTTOU)) == 0 &&
(p->p_sigmask & sigmask(SIGTTOU)) == 0) {
if (pr->ps_pgrp->pg_jobc == 0)
return (EIO);
@@ -1490,7 +1490,7 @@ loop: lflag = tp->t_lflag;
* Hang process if it's in the background.
*/
if (isbackground(pr, tp)) {
- if ((p->p_sigacts->ps_sigignore & sigmask(SIGTTIN)) ||
+ if ((pr->ps_sigacts->ps_sigignore & sigmask(SIGTTIN)) ||
(p->p_sigmask & sigmask(SIGTTIN)) ||
pr->ps_flags & PS_PPWAIT || pr->ps_pgrp->pg_jobc == 0) {
error = EIO;
@@ -1747,7 +1747,7 @@ loop:
pr = p->p_p;
if (isbackground(pr, tp) &&
ISSET(tp->t_lflag, TOSTOP) && (pr->ps_flags & PS_PPWAIT) == 0 &&
- (p->p_sigacts->ps_sigignore & sigmask(SIGTTOU)) == 0 &&
+ (pr->ps_sigacts->ps_sigignore & sigmask(SIGTTOU)) == 0 &&
(p->p_sigmask & sigmask(SIGTTOU)) == 0) {
if (pr->ps_pgrp->pg_jobc == 0) {
error = EIO;
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 2b4ba3c9155..e1379d4c9e7 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.63 2013/12/13 19:55:12 naddy Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.64 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -291,7 +291,7 @@ ptsread(dev_t dev, struct uio *uio, int flag)
again:
if (pti->pt_flags & PF_REMOTE) {
while (isbackground(pr, tp)) {
- if ((p->p_sigacts->ps_sigignore & sigmask(SIGTTIN)) ||
+ if ((pr->ps_sigacts->ps_sigignore & sigmask(SIGTTIN)) ||
(p->p_sigmask & sigmask(SIGTTIN)) ||
pr->ps_pgrp->pg_jobc == 0 ||
pr->ps_flags & PS_PPWAIT)
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 9905f0f845d..6946a2848dc 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.103 2014/01/19 03:04:54 claudio Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.104 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -1234,8 +1234,8 @@ nfs_sigintr(struct nfsmount *nmp, struct nfsreq *rep, struct proc *p)
if (!(nmp->nm_flag & NFSMNT_INT))
return (0);
if (p && p->p_siglist &&
- (((p->p_siglist & ~p->p_sigmask) & ~p->p_sigacts->ps_sigignore) &
- NFSINT_SIGMASK))
+ (((p->p_siglist & ~p->p_sigmask) &
+ ~p->p_p->ps_sigacts->ps_sigignore) & NFSINT_SIGMASK))
return (EINTR);
return (0);
}
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 804bde4f78c..bcb70cbac7b 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.177 2014/02/12 05:47:36 guenther Exp $ */
+/* $OpenBSD: proc.h,v 1.178 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -164,6 +164,7 @@ struct process {
LIST_ENTRY(process) ps_sibling; /* List of sibling processes. */
LIST_HEAD(, process) ps_children;/* Pointer to list of children. */
+ struct sigacts *ps_sigacts; /* Signal actions, state */
struct vnode *ps_textvp; /* Vnode of executable. */
/* The following fields are all zeroed upon creation in process_new. */
@@ -259,7 +260,6 @@ struct proc {
/* substructures: */
struct filedesc *p_fd; /* Ptr to open files structure. */
struct vmspace *p_vmspace; /* Address space. */
- struct sigacts *p_sigacts; /* Signal actions, state */
#define p_cred p_p->ps_cred
#define p_ucred p_cred->pc_ucred
#define p_rlimit p_p->ps_limit->pl_rlimit
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index 7f1e64da7c1..ede4326b1bd 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signalvar.h,v 1.26 2012/12/02 07:03:32 guenther Exp $ */
+/* $OpenBSD: signalvar.h,v 1.27 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */
/*
@@ -66,11 +66,6 @@ struct sigacts {
#define SIG_HOLD (void (*)(int))3
/*
- * get signal action for process and signal; currently only for current process
- */
-#define SIGACTION(p, sig) (p->p_sigacts->ps_sigact[(sig)])
-
-/*
* Determine signal that should be delivered to process p, the current
* process, 0 if none. If there is a pending stop signal with default
* action, the process stops in issignal().
@@ -160,7 +155,7 @@ void postsig(int sig);
void psignal(struct proc *p, int sig);
void ptsignal(struct proc *p, int sig, enum signal_type type);
#define prsignal(pr,sig) ptsignal((pr)->ps_mainproc, (sig), SPROCESS)
-void siginit(struct proc *p);
+void siginit(struct process *);
void trapsignal(struct proc *p, int sig, u_long code, int type,
union sigval val);
void sigexit(struct proc *, int);
@@ -170,11 +165,11 @@ int killpg1(struct proc *, int, int, int);
void signal_init(void);
-struct sigacts *sigactsinit(struct proc *);
-struct sigacts *sigactsshare(struct proc *);
+struct sigacts *sigactsinit(struct process *);
+struct sigacts *sigactsshare(struct process *);
void sigstkinit(struct sigaltstack *);
-void sigactsunshare(struct proc *);
-void sigactsfree(struct proc *);
+void sigactsunshare(struct process *);
+void sigactsfree(struct process *);
/*
* Machine-dependent functions:
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index b13bb4f5d34..188dac0b2f5 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.141 2014/02/12 05:47:36 guenther Exp $ */
+/* $OpenBSD: sysctl.h,v 1.142 2014/03/22 06:05:45 guenther Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -473,7 +473,7 @@ do { \
(kp)->p_fd = PTRTOINT64((p)->p_fd); \
(kp)->p_limit = PTRTOINT64((pr)->ps_limit); \
(kp)->p_vmspace = PTRTOINT64((p)->p_vmspace); \
- (kp)->p_sigacts = PTRTOINT64((p)->p_sigacts); \
+ (kp)->p_sigacts = PTRTOINT64((pr)->ps_sigacts); \
(kp)->p_sess = PTRTOINT64((pg)->pg_session); \
(kp)->p_ru = PTRTOINT64((pr)->ps_ru); \
} \