summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/alpha/alpha/machdep.c4
-rw-r--r--sys/arch/alpha/alpha/trap.c8
-rw-r--r--sys/arch/amd64/amd64/machdep.c4
-rw-r--r--sys/arch/amd64/amd64/trap.c8
-rw-r--r--sys/arch/arm/arm/sig_machdep.c4
-rw-r--r--sys/arch/arm/arm/syscall.c8
-rw-r--r--sys/arch/hppa/hppa/machdep.c4
-rw-r--r--sys/arch/hppa/hppa/trap.c8
-rw-r--r--sys/arch/hppa64/hppa64/machdep.c4
-rw-r--r--sys/arch/hppa64/hppa64/trap.c8
-rw-r--r--sys/arch/i386/i386/linux_machdep.c10
-rw-r--r--sys/arch/i386/i386/machdep.c4
-rw-r--r--sys/arch/i386/i386/trap.c16
-rw-r--r--sys/arch/m88k/m88k/sig_machdep.c4
-rw-r--r--sys/arch/m88k/m88k/trap.c14
-rw-r--r--sys/arch/macppc/macppc/machdep.c7
-rw-r--r--sys/arch/mips64/mips64/sendsig.c4
-rw-r--r--sys/arch/mips64/mips64/trap.c10
-rw-r--r--sys/arch/powerpc/powerpc/trap.c8
-rw-r--r--sys/arch/sh/sh/sh_machdep.c4
-rw-r--r--sys/arch/sh/sh/trap.c10
-rw-r--r--sys/arch/socppc/socppc/machdep.c7
-rw-r--r--sys/arch/solbourne/solbourne/machdep.c4
-rw-r--r--sys/arch/solbourne/solbourne/trap.c8
-rw-r--r--sys/arch/sparc/sparc/machdep.c4
-rw-r--r--sys/arch/sparc/sparc/trap.c8
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c4
-rw-r--r--sys/arch/sparc64/sparc64/trap.c12
-rw-r--r--sys/arch/vax/vax/machdep.c4
-rw-r--r--sys/arch/vax/vax/trap.c8
-rw-r--r--sys/compat/common/compat_util.c4
-rw-r--r--sys/compat/common/compat_util.h6
-rw-r--r--sys/compat/linux/linux_cdrom.c6
-rw-r--r--sys/compat/linux/linux_exec.c16
-rw-r--r--sys/compat/linux/linux_file.c40
-rw-r--r--sys/compat/linux/linux_file64.c12
-rw-r--r--sys/compat/linux/linux_hdio.c4
-rw-r--r--sys/compat/linux/linux_ipc.c14
-rw-r--r--sys/compat/linux/linux_misc.c14
-rw-r--r--sys/compat/linux/linux_signal.c10
-rw-r--r--sys/compat/linux/linux_socket.c10
-rw-r--r--sys/compat/linux/linux_termios.c4
-rw-r--r--sys/dev/systrace.c25
-rw-r--r--sys/kern/exec_elf.c6
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_exec.c18
-rw-r--r--sys/kern/kern_exit.c8
-rw-r--r--sys/kern/kern_fork.c8
-rw-r--r--sys/kern/kern_ktrace.c68
-rw-r--r--sys/kern/kern_proc.c4
-rw-r--r--sys/kern/kern_sig.c20
-rw-r--r--sys/kern/kern_xxx.c6
-rw-r--r--sys/kern/sys_process.c4
-rw-r--r--sys/sys/ktrace.h4
-rw-r--r--sys/sys/proc.h6
-rw-r--r--sys/sys/sysctl.h4
-rw-r--r--sys/uvm/uvm_unix.c6
57 files changed, 273 insertions, 268 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index a806c5f8a46..55c135ee2d1 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.151 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.152 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -1524,7 +1524,7 @@ trash:
/*
* Set up the registers to return to sigcode.
*/
- frame->tf_regs[FRAME_PC] = p->p_sigcode;
+ frame->tf_regs[FRAME_PC] = p->p_p->ps_sigcode;
frame->tf_regs[FRAME_A0] = sig;
frame->tf_regs[FRAME_A1] = (u_int64_t)sip;
frame->tf_regs[FRAME_A2] = (u_int64_t)scp;
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index 4c945408157..4187e09b57b 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.69 2014/02/06 05:14:12 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.70 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -549,8 +549,8 @@ syscall(code, framep)
p->p_md.md_tf = framep;
opc = framep->tf_regs[FRAME_PC] - 4;
- callp = p->p_emul->e_sysent;
- numsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ numsys = p->p_p->ps_emul->e_nsysent;
switch(code) {
case SYS_syscall:
@@ -570,7 +570,7 @@ syscall(code, framep)
if (code < numsys)
callp += code;
else
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
nargs = callp->sy_narg + hidden;
switch (nargs) {
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index f8b43ad877d..bf473a4d68e 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.175 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.176 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -608,7 +608,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->tf_rsi = sip;
tf->tf_rdx = scp;
- tf->tf_rip = (u_int64_t)p->p_sigcode;
+ tf->tf_rip = (u_int64_t)p->p_p->ps_sigcode;
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
tf->tf_rflags &= ~(PSL_T|PSL_D|PSL_VM|PSL_AC);
tf->tf_rsp = scp;
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index 52e32c5a5ad..0478cd12e99 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.33 2014/02/13 23:11:06 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.34 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@@ -507,8 +507,8 @@ syscall(struct trapframe *frame)
p = curproc;
code = frame->tf_rax;
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
argp = &args[0];
argoff = 0;
@@ -527,7 +527,7 @@ syscall(struct trapframe *frame)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else
callp += code;
diff --git a/sys/arch/arm/arm/sig_machdep.c b/sys/arch/arm/arm/sig_machdep.c
index 87ce5695107..77f19178d33 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.10 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: sig_machdep.c,v 1.11 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: sig_machdep.c,v 1.22 2003/10/08 00:28:41 thorpej Exp $ */
/*
@@ -162,7 +162,7 @@ sendsig(sig_t catcher, int sig, int returnmask, u_long code, int type,
tf->tf_pc = (int)frame.sf_handler;
tf->tf_usr_sp = (int)fp;
- tf->tf_usr_lr = (int)p->p_sigcode;
+ tf->tf_usr_lr = (int)p->p_p->ps_sigcode;
}
/*
diff --git a/sys/arch/arm/arm/syscall.c b/sys/arch/arm/arm/syscall.c
index 45ec8ebcfe5..4e808e329cf 100644
--- a/sys/arch/arm/arm/syscall.c
+++ b/sys/arch/arm/arm/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.15 2012/08/07 05:16:53 guenther Exp $ */
+/* $OpenBSD: syscall.c,v 1.16 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: syscall.c,v 1.24 2003/11/14 19:03:17 scw Exp $ */
/*-
@@ -112,7 +112,7 @@ swi_handler(trapframe_t *frame)
code = frame->tf_r12;
ap = &frame->tf_r0;
- callp = p->p_emul->e_sysent;
+ callp = p->p_p->ps_emul->e_sysent;
switch (code) {
case SYS_syscall:
@@ -126,8 +126,8 @@ swi_handler(trapframe_t *frame)
break;
}
- if (code < 0 || code >= p->p_emul->e_nsysent) {
- callp += p->p_emul->e_nosys;
+ if (code < 0 || code >= p->p_p->ps_emul->e_nsysent) {
+ callp += p->p_p->ps_emul->e_nosys;
} else {
callp += code;
}
diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c
index 7b8670f650b..ae373be5f2d 100644
--- a/sys/arch/hppa/hppa/machdep.c
+++ b/sys/arch/hppa/hppa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.215 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.216 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 1999-2003 Michael Shalayeff
@@ -1302,7 +1302,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->tf_arg2 = tf->tf_r4 = scp;
tf->tf_arg3 = (register_t)catcher;
tf->tf_ipsw &= ~(PSL_N|PSL_B|PSL_T);
- tf->tf_iioq_head = HPPA_PC_PRIV_USER | p->p_sigcode;
+ tf->tf_iioq_head = HPPA_PC_PRIV_USER | p->p_p->ps_sigcode;
tf->tf_iioq_tail = tf->tf_iioq_head + 4;
tf->tf_iisq_tail = tf->tf_iisq_head = pcb->pcb_space;
/* disable tracing in the trapframe */
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index 66f6c5b6e28..ae6384a8e44 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.127 2013/04/10 20:55:34 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.128 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -798,8 +798,8 @@ syscall(struct trapframe *frame)
panic("syscall");
p->p_md.md_regs = frame;
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
argoff = 4; retq = 0;
switch (code = frame->tf_t1) {
@@ -833,7 +833,7 @@ syscall(struct trapframe *frame)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* bad syscall # */
+ callp += p->p_p->ps_emul->e_nosys; /* bad syscall # */
else
callp += code;
diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c
index 724b82edc27..b9b5427fcc0 100644
--- a/sys/arch/hppa64/hppa64/machdep.c
+++ b/sys/arch/hppa64/hppa64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.55 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.56 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -900,7 +900,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->tf_args[2] = tf->tf_r4 = scp;
tf->tf_args[3] = (register_t)catcher;
tf->tf_ipsw &= ~(PSL_N|PSL_B|PSL_T);
- tf->tf_iioq[0] = HPPA_PC_PRIV_USER | p->p_sigcode;
+ tf->tf_iioq[0] = HPPA_PC_PRIV_USER | p->p_p->ps_sigcode;
tf->tf_iioq[1] = tf->tf_iioq[0] + 4;
tf->tf_iisq[0] = tf->tf_iisq[1] = pcb->pcb_space;
/* disable tracing in the trapframe */
diff --git a/sys/arch/hppa64/hppa64/trap.c b/sys/arch/hppa64/hppa64/trap.c
index 8646247343c..acd1c5948da 100644
--- a/sys/arch/hppa64/hppa64/trap.c
+++ b/sys/arch/hppa64/hppa64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.33 2012/12/31 06:46:13 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.34 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -574,8 +574,8 @@ syscall(struct trapframe *frame)
panic("syscall");
p->p_md.md_regs = frame;
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
switch (code = frame->tf_r1) {
case SYS_syscall:
@@ -602,7 +602,7 @@ syscall(struct trapframe *frame)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* bad syscall # */
+ callp += p->p_p->ps_emul->e_nosys; /* bad syscall # */
else
callp += code;
diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c
index ffa82f656f4..81d4081d6f0 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.44 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: linux_machdep.c,v 1.45 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */
/*
@@ -179,7 +179,7 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
*/
tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
- tf->tf_eip = p->p_sigcode;
+ tf->tf_eip = p->p_p->ps_sigcode;
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
tf->tf_eflags &= ~(PSL_T|PSL_D|PSL_VM|PSL_AC);
tf->tf_esp = (int)fp;
@@ -283,7 +283,7 @@ linux_read_ldt(struct proc *p, struct linux_sys_modify_ldt_args *uap,
if (user_ldt_enable == 0)
return (ENOSYS);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
gl.start = 0;
gl.desc = SCARG(uap, ptr);
@@ -333,7 +333,7 @@ linux_write_ldt(struct proc *p, struct linux_sys_modify_ldt_args *uap,
if (ldt_info.contents == 3)
return (EINVAL);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
sd.sd_lobase = ldt_info.base_addr & 0xffffff;
sd.sd_hibase = (ldt_info.base_addr >> 24) & 0xff;
@@ -529,7 +529,7 @@ linux_machdepioctl(struct proc *p, void *v, register_t *retval)
return error;
lvt.frsig = sig;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bvtp = stackgap_alloc(&sg, sizeof (struct vt_mode));
if ((error = copyout(&lvt, bvtp, sizeof (struct vt_mode))))
return error;
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 26c177d02f9..fca0ad8b2b0 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.534 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.535 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -2401,7 +2401,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->tf_gs = GSEL(GUGS_SEL, SEL_UPL);
tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
- tf->tf_eip = p->p_sigcode;
+ tf->tf_eip = p->p_p->ps_sigcode;
tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL);
tf->tf_eflags &= ~(PSL_T|PSL_D|PSL_VM|PSL_AC);
tf->tf_esp = (int)fp;
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 73f4d190ebd..216d16656fa 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.112 2014/03/07 07:47:14 gerhard Exp $ */
+/* $OpenBSD: trap.c,v 1.113 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -562,8 +562,8 @@ syscall(struct trapframe *frame)
opc = frame->tf_eip;
code = frame->tf_eax;
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
params = (caddr_t)frame->tf_esp + sizeof(int);
@@ -582,7 +582,7 @@ syscall(struct trapframe *frame)
case SYS_syscall:
#ifdef COMPAT_LINUX
/* Linux has a special system setup call as number 0 */
- if (p->p_emul == &emul_linux_elf)
+ if (p->p_p->ps_emul == &emul_linux_elf)
break;
#endif
/*
@@ -605,13 +605,13 @@ syscall(struct trapframe *frame)
break;
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
+ callp += p->p_p->ps_emul->e_nosys; /* illegal */
else
callp += code;
argsize = callp->sy_argsize;
#ifdef COMPAT_LINUX
/* XXX extra if() for every emul type.. */
- if (p->p_emul == &emul_linux_elf) {
+ if (p->p_p->ps_emul == &emul_linux_elf) {
/*
* Linux passes the args in ebx, ecx, edx, esi, edi, ebp, in
* increasing order.
@@ -666,8 +666,8 @@ syscall(struct trapframe *frame)
break;
default:
bad:
- if (p->p_emul->e_errno && error >= 0 && error <= ELAST)
- frame->tf_eax = p->p_emul->e_errno[error];
+ if (p->p_p->ps_emul->e_errno && error >= 0 && error <= ELAST)
+ frame->tf_eax = p->p_p->ps_emul->e_errno[error];
else
frame->tf_eax = error;
frame->tf_eflags |= PSL_C; /* carry bit */
diff --git a/sys/arch/m88k/m88k/sig_machdep.c b/sys/arch/m88k/m88k/sig_machdep.c
index 518dad599e6..95a558177c9 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.17 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: sig_machdep.c,v 1.18 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -154,7 +154,7 @@ sendsig(sig_t catcher, int sig, int mask, unsigned long code, int type,
/*
* Set up registers for the signal handler invocation.
*/
- tf->tf_r[1] = p->p_sigcode; /* return to sigcode */
+ tf->tf_r[1] = p->p_p->ps_sigcode; /* return to sigcode */
tf->tf_r[2] = sig; /* first arg is signo */
tf->tf_r[3] = psp->ps_siginfo & sigmask(sig) ? (vaddr_t)&fp->sf_si : 0;
tf->tf_r[4] = (vaddr_t)&fp->sf_sc;
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index d5207d50c51..e9c90127a41 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.88 2013/09/05 20:40:32 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.89 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -1181,8 +1181,8 @@ m88100_syscall(register_t code, struct trapframe *tf)
uvmexp.syscalls++;
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
p->p_md.md_tf = tf;
@@ -1211,7 +1211,7 @@ m88100_syscall(register_t code, struct trapframe *tf)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else
callp += code;
@@ -1302,8 +1302,8 @@ m88110_syscall(register_t code, struct trapframe *tf)
uvmexp.syscalls++;
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
p->p_md.md_tf = tf;
@@ -1332,7 +1332,7 @@ m88110_syscall(register_t code, struct trapframe *tf)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else
callp += code;
diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c
index dcb9058cd41..344e2e83593 100644
--- a/sys/arch/macppc/macppc/machdep.c
+++ b/sys/arch/macppc/macppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.146 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.147 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -571,11 +571,12 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->fixreg[3] = (int)sig;
tf->fixreg[4] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : 0;
tf->fixreg[5] = (int)&fp->sf_sc;
- tf->srr0 = p->p_sigcode;
+ tf->srr0 = p->p_p->ps_sigcode;
#if WHEN_WE_ONLY_FLUSH_DATA_WHEN_DOING_PMAP_ENTER
pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),tf->srr0, &pa);
- syncicache(pa, (p->p_emul->e_esigcode - p->p_emul->e_sigcode));
+ syncicache(pa, (p->p_p->ps_emul->e_esigcode -
+ p->p_p->ps_emul->e_sigcode));
#endif
}
diff --git a/sys/arch/mips64/mips64/sendsig.c b/sys/arch/mips64/mips64/sendsig.c
index 826cf2157ff..48bfcb1bd4b 100644
--- a/sys/arch/mips64/mips64/sendsig.c
+++ b/sys/arch/mips64/mips64/sendsig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendsig.c,v 1.21 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: sendsig.c,v 1.22 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -191,7 +191,7 @@ bail:
regs->t9 = (register_t)catcher;
regs->sp = (register_t)fp;
- regs->ra = p->p_sigcode;
+ regs->ra = p->p_p->ps_sigcode;
#ifdef DEBUG
if ((sigdebug & SDB_FOLLOW) ||
((sigdebug & SDB_KSTACK) && (p->p_pid == sigpid)))
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index 100dc2a647d..24d345a72b9 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.89 2014/03/22 00:01:04 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.90 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -490,8 +490,8 @@ fault_common_no_miss:
trapframe->pc, 0, 0);
else
locr0->pc += 4;
- callp = p->p_emul->e_sysent;
- numsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ numsys = p->p_p->ps_emul->e_nsysent;
code = locr0->v0;
switch (code) {
case SYS_syscall:
@@ -504,7 +504,7 @@ fault_common_no_miss:
*/
code = locr0->a0;
if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
+ callp += p->p_p->ps_emul->e_nosys; /* (illegal) */
else
callp += code;
i = callp->sy_argsize / sizeof(register_t);
@@ -524,7 +524,7 @@ fault_common_no_miss:
break;
default:
if (code >= numsys)
- callp += p->p_emul->e_nosys; /* (illegal) */
+ callp += p->p_p->ps_emul->e_nosys; /* (illegal) */
else
callp += code;
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 584c98fc2df..7d4e23d7222 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.94 2012/12/31 06:46:13 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.95 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -402,8 +402,8 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr);
uvmexp.syscalls++;
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
code = frame->fixreg[0];
params = frame->fixreg + FIRSTARG;
@@ -431,7 +431,7 @@ printf("isi iar %x lr %x\n", frame->srr0, frame->lr);
break;
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else
callp += code;
argsize = callp->sy_argsize;
diff --git a/sys/arch/sh/sh/sh_machdep.c b/sys/arch/sh/sh/sh_machdep.c
index f0033bacb79..ff2a40384dc 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.35 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: sh_machdep.c,v 1.36 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */
/*
@@ -506,7 +506,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->tf_r6 = (int)&fp->sf_uc; /* "ucp" argument for handler */
tf->tf_spc = (int)catcher;
tf->tf_r15 = (int)fp;
- tf->tf_pr = (int)p->p_sigcode;
+ tf->tf_pr = (int)p->p_p->ps_sigcode;
}
/*
diff --git a/sys/arch/sh/sh/trap.c b/sys/arch/sh/sh/trap.c
index f013f866f50..da2be62bb9c 100644
--- a/sys/arch/sh/sh/trap.c
+++ b/sys/arch/sh/sh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.21 2012/12/31 06:46:14 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.22 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: exception.c,v 1.32 2006/09/04 23:57:52 uwe Exp $ */
/* $NetBSD: syscall.c,v 1.6 2006/03/07 07:21:50 thorpej Exp $ */
@@ -528,8 +528,8 @@ syscall(struct proc *p, struct trapframe *tf)
opc = tf->tf_spc;
ocode = code = tf->tf_r0;
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
params = (caddr_t)tf->tf_r15;
@@ -557,13 +557,13 @@ syscall(struct proc *p, struct trapframe *tf)
break;
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
+ callp += p->p_p->ps_emul->e_nosys; /* illegal */
else
callp += code;
argsize = callp->sy_argsize;
#ifdef DIAGNOSTIC
if (argsize > sizeof args) {
- callp += p->p_emul->e_nosys - code;
+ callp += p->p_p->ps_emul->e_nosys - code;
argsize = callp->sy_argsize;
}
#endif
diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c
index 86cacdadbe5..0848597ab1f 100644
--- a/sys/arch/socppc/socppc/machdep.c
+++ b/sys/arch/socppc/socppc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.42 2014/03/23 15:28:10 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.43 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -927,11 +927,12 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type,
tf->fixreg[3] = (int)sig;
tf->fixreg[4] = (psp->ps_siginfo & sigmask(sig)) ? (int)&fp->sf_si : 0;
tf->fixreg[5] = (int)&fp->sf_sc;
- tf->srr0 = p->p_sigcode;
+ tf->srr0 = p->p_p->ps_sigcode;
#if WHEN_WE_ONLY_FLUSH_DATA_WHEN_DOING_PMAP_ENTER
pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),tf->srr0, &pa);
- syncicache(pa, (p->p_emul->e_esigcode - p->p_emul->e_sigcode));
+ syncicache(pa, (p->p_p->ps_emul->e_esigcode -
+ p->p_p->ps_emul->e_sigcode));
#endif
}
diff --git a/sys/arch/solbourne/solbourne/machdep.c b/sys/arch/solbourne/solbourne/machdep.c
index d408d37f222..145f0e4401d 100644
--- a/sys/arch/solbourne/solbourne/machdep.c
+++ b/sys/arch/solbourne/solbourne/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.29 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.30 2014/03/26 05:23:42 guenther Exp $ */
/* OpenBSD: machdep.c,v 1.105 2005/04/11 15:13:01 deraadt Exp */
/*
@@ -447,7 +447,7 @@ sendsig(catcher, sig, mask, code, type, val)
* Arrange to continue execution at the code copied out in exec().
* It needs the function to call in %g1, and a new stack pointer.
*/
- caddr = p->p_sigcode;
+ caddr = p->p_p->ps_sigcode;
tf->tf_global[1] = (int)catcher;
tf->tf_pc = caddr;
tf->tf_npc = caddr + 4;
diff --git a/sys/arch/solbourne/solbourne/trap.c b/sys/arch/solbourne/solbourne/trap.c
index 14fe1445b3a..1796ae3a74b 100644
--- a/sys/arch/solbourne/solbourne/trap.c
+++ b/sys/arch/solbourne/solbourne/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.17 2012/12/31 06:46:14 guenther Exp $ */
+/* $OpenBSD: trap.c,v 1.18 2014/03/26 05:23:42 guenther Exp $ */
/* OpenBSD: trap.c,v 1.42 2004/12/06 20:12:25 miod Exp */
/*
@@ -788,8 +788,8 @@ syscall(code, tf, pc)
new = code & (SYSCALL_G7RFLAG | SYSCALL_G2RFLAG);
code &= ~(SYSCALL_G7RFLAG | SYSCALL_G2RFLAG);
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
/*
* The first six system call arguments are in the six %o registers.
@@ -820,7 +820,7 @@ syscall(code, tf, pc)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else {
callp += code;
i = callp->sy_argsize / sizeof(register_t);
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 42efbeccbfd..130149abda7 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.149 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.150 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -456,7 +456,7 @@ sendsig(catcher, sig, mask, code, type, val)
* Arrange to continue execution at the code copied out in exec().
* It needs the function to call in %g1, and a new stack pointer.
*/
- caddr = p->p_sigcode;
+ caddr = p->p_p->ps_sigcode;
tf->tf_global[1] = (int)catcher;
tf->tf_pc = caddr;
tf->tf_npc = caddr + 4;
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index e17766cc8be..8c65ce5f30e 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.63 2013/06/03 18:46:02 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.64 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */
/*
@@ -971,8 +971,8 @@ syscall(code, tf, pc)
new = code & SYSCALL_G2RFLAG;
code &= ~SYSCALL_G2RFLAG;
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
/*
* The first six system call arguments are in the six %o registers.
@@ -1003,7 +1003,7 @@ syscall(code, tf, pc)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else {
callp += code;
i = callp->sy_argsize / sizeof(register_t);
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 4f3dca565ad..a18a9c03a64 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.152 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.153 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -510,7 +510,7 @@ sendsig(catcher, sig, mask, code, type, val)
* Arrange to continue execution at the code copied out in exec().
* It needs the function to call in %g1, and a new stack pointer.
*/
- addr = p->p_sigcode;
+ addr = p->p_p->ps_sigcode;
tf->tf_global[1] = (vaddr_t)catcher;
tf->tf_pc = addr;
tf->tf_npc = addr + 4;
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 75c11621e25..51eab3abc0d 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.78 2013/04/02 13:24:57 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.79 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -1241,8 +1241,8 @@ syscall(tf, code, pc)
new = code & SYSCALL_G2RFLAG;
code &= ~SYSCALL_G2RFLAG;
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
/*
* The first six system call arguments are in the six %o registers.
@@ -1264,8 +1264,8 @@ syscall(tf, code, pc)
nap--;
break;
case SYS___syscall:
- if (code < nsys &&
- callp[code].sy_call != callp[p->p_emul->e_nosys].sy_call)
+ if (code < nsys && callp[code].sy_call !=
+ callp[p->p_p->ps_emul->e_nosys].sy_call)
break; /* valid system call */
if (tf->tf_out[6] & 1L) {
/* longs *are* quadwords */
@@ -1281,7 +1281,7 @@ syscall(tf, code, pc)
}
if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else if (tf->tf_out[6] & 1L) {
register_t *argp;
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index be2017947a6..38103d863c9 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.132 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.133 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */
/*
@@ -493,7 +493,7 @@ sendsig(catcher, sig, mask, code, type, val)
if (copyout(&gsigf, sigf, sizeof(gsigf)))
sigexit(p, SIGILL);
- syscf->pc = p->p_sigcode;
+ syscf->pc = p->p_p->ps_sigcode;
syscf->psl = PSL_U | PSL_PREVU;
/*
* Place sp at the beginning of sigf; this ensures that possible
diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c
index 4a04db7c0b8..c20b397b083 100644
--- a/sys/arch/vax/vax/trap.c
+++ b/sys/arch/vax/vax/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.48 2013/11/24 22:08:25 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.49 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -336,8 +336,8 @@ if(startsysc)printf("trap syscall %s pc %lx, psl %lx, sp %lx, pid %d, frame %p\n
uvmexp.syscalls++;
exptr = p->p_addr->u_pcb.framep = frame;
- callp = p->p_emul->e_sysent;
- nsys = p->p_emul->e_nsysent;
+ callp = p->p_p->ps_emul->e_sysent;
+ nsys = p->p_p->ps_emul->e_nsysent;
if(frame->code == SYS___syscall){
int g = *(int *)(frame->ap);
@@ -348,7 +348,7 @@ if(startsysc)printf("trap syscall %s pc %lx, psl %lx, sp %lx, pid %d, frame %p\n
}
if(frame->code < 0 || frame->code >= nsys)
- callp += p->p_emul->e_nosys;
+ callp += p->p_p->ps_emul->e_nosys;
else
callp += frame->code;
diff --git a/sys/compat/common/compat_util.c b/sys/compat/common/compat_util.c
index ec45ce78421..4bc1cb4dadd 100644
--- a/sys/compat/common/compat_util.c
+++ b/sys/compat/common/compat_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat_util.c,v 1.11 2014/01/15 05:31:51 deraadt Exp $ */
+/* $OpenBSD: compat_util.c,v 1.12 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: compat_util.c,v 1.4 1996/03/14 19:31:45 christos Exp $ */
/*
@@ -172,7 +172,7 @@ bad:
}
caddr_t
-stackgap_init(struct emul *e)
+stackgap_init(struct proc *p)
{
return STACKGAPBASE;
}
diff --git a/sys/compat/common/compat_util.h b/sys/compat/common/compat_util.h
index 03df1662f2a..782902a5d1a 100644
--- a/sys/compat/common/compat_util.h
+++ b/sys/compat/common/compat_util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat_util.h,v 1.8 2014/01/15 05:31:51 deraadt Exp $ */
+/* $OpenBSD: compat_util.h,v 1.9 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: compat_util.h,v 1.1 1995/06/24 20:16:05 christos Exp $ */
/*
@@ -35,9 +35,9 @@
#include <sys/exec.h>
-struct emul;
+struct proc;
-caddr_t stackgap_init(struct emul *);
+caddr_t stackgap_init(struct proc *);
void *stackgap_alloc(caddr_t *, size_t);
int emul_find(struct proc *, caddr_t *, const char *, char *, char **, int);
diff --git a/sys/compat/linux/linux_cdrom.c b/sys/compat/linux/linux_cdrom.c
index 7c74d8d91b0..b1ca8e16af0 100644
--- a/sys/compat/linux/linux_cdrom.c
+++ b/sys/compat/linux/linux_cdrom.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: linux_cdrom.c,v 1.10 2014/01/21 01:49:13 tedu Exp $ */
+/* $OpenBSD: linux_cdrom.c,v 1.11 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
* All rights reserved.
@@ -135,7 +135,7 @@ linux_ioctl_cdrom(p, v, retval)
if (error)
goto out;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
memset(&tmpb.tes, 0, sizeof tmpb.tes);
tmpb.tes.starting_track = tmpl.te.cdte_track;
@@ -164,7 +164,7 @@ linux_ioctl_cdrom(p, v, retval)
if (error)
goto out;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
memset(&tmpb.sc, 0, sizeof tmpb.sc);
tmpb.sc.data_format = CD_CURRENT_POSITION;
diff --git a/sys/compat/linux/linux_exec.c b/sys/compat/linux/linux_exec.c
index 71a13372d6f..919fe63c7f8 100644
--- a/sys/compat/linux/linux_exec.c
+++ b/sys/compat/linux/linux_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_exec.c,v 1.40 2013/12/02 19:47:28 deraadt Exp $ */
+/* $OpenBSD: linux_exec.c,v 1.41 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_exec.c,v 1.13 1996/04/05 00:01:10 christos Exp $ */
/*-
@@ -165,7 +165,7 @@ void
linux_e_proc_fork(struct proc *p, struct proc *parent)
{
struct linux_emuldata *emul;
- struct linux_emuldata *p_emul;
+ struct linux_emuldata *parent_emul;
/* Allocate new emuldata for the new process. */
p->p_emuldata = NULL;
@@ -174,12 +174,12 @@ linux_e_proc_fork(struct proc *p, struct proc *parent)
linux_e_proc_init(p, parent->p_vmspace);
emul = p->p_emuldata;
- p_emul = parent->p_emuldata;
+ parent_emul = parent->p_emuldata;
- emul->my_set_tid = p_emul->child_set_tid;
- emul->my_clear_tid = p_emul->child_clear_tid;
- emul->my_tls_base = p_emul->child_tls_base;
- emul->set_tls_base = p_emul->set_tls_base;
+ emul->my_set_tid = parent_emul->child_set_tid;
+ emul->my_clear_tid = parent_emul->child_clear_tid;
+ emul->my_tls_base = parent_emul->child_tls_base;
+ emul->set_tls_base = parent_emul->set_tls_base;
}
int
@@ -256,7 +256,7 @@ linux_sys_execve(struct proc *p, void *v, register_t *retval)
struct sys_execve_args ap;
caddr_t sg;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
SCARG(&ap, path) = SCARG(uap, path);
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 090a84b6c9a..96df18a5e4e 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_file.c,v 1.29 2014/01/23 23:46:42 pirofti Exp $ */
+/* $OpenBSD: linux_file.c,v 1.30 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_file.c,v 1.15 1996/05/20 01:59:09 fvdl Exp $ */
/*
@@ -138,7 +138,7 @@ linux_sys_creat(p, v, retval)
struct sys_open_args oa;
caddr_t sg;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
SCARG(&oa, path) = SCARG(uap, path);
@@ -169,7 +169,7 @@ linux_sys_open(p, v, retval)
struct sys_open_args boa;
caddr_t sg;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
fl = linux_to_bsd_ioflags(SCARG(uap, flags));
@@ -374,7 +374,7 @@ linux_sys_fcntl(p, v, retval)
SCARG(&fca, arg) = (caddr_t) val;
return sys_fcntl(p, &fca, retval);
case LINUX_F_GETLK:
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
if ((error = copyin(arg, &lfl, sizeof lfl)))
return error;
linux_to_bsd_flock(&lfl, &bfl);
@@ -398,7 +398,7 @@ linux_sys_fcntl(p, v, retval)
if ((error = copyin(arg, &lfl, sizeof lfl)))
return error;
linux_to_bsd_flock(&lfl, &bfl);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bfp = (struct flock *) stackgap_alloc(&sg, sizeof *bfp);
if ((error = copyout(&bfl, bfp, sizeof bfl)))
return error;
@@ -514,7 +514,7 @@ linux_sys_fstat(p, v, retval)
caddr_t sg;
int error;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
st = stackgap_alloc(&sg, sizeof (struct stat));
@@ -550,7 +550,7 @@ linux_stat1(p, v, retval, dolstat)
int error;
struct linux_sys_stat_args *uap = v;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
st = stackgap_alloc(&sg, sizeof (struct stat));
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -615,7 +615,7 @@ linux_sys_access(p, v, retval)
syscallarg(char *) path;
syscallarg(int) flags;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -632,7 +632,7 @@ linux_sys_unlink(p, v, retval)
struct linux_sys_unlink_args /* {
syscallarg(char *) path;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -648,7 +648,7 @@ linux_sys_chdir(p, v, retval)
struct linux_sys_chdir_args /* {
syscallarg(char *) path;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -666,7 +666,7 @@ linux_sys_mknod(p, v, retval)
syscallarg(int) mode;
syscallarg(int) dev;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
struct sys_mkfifo_args bma;
LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
@@ -692,7 +692,7 @@ linux_sys_chmod(p, v, retval)
syscallarg(char *) path;
syscallarg(int) mode;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -707,7 +707,7 @@ linux_sys_chown(struct proc *p, void *v, register_t *retval)
syscallarg(uid_t) uid;
syscallarg(gid_t) gid;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -726,7 +726,7 @@ linux_sys_chown16(p, v, retval)
syscallarg(int) gid;
} */ *uap = v;
struct sys_chown_args bca;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -793,7 +793,7 @@ linux_sys_rename(p, v, retval)
syscallarg(char *) from;
syscallarg(char *) to;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
@@ -811,7 +811,7 @@ linux_sys_mkdir(p, v, retval)
syscallarg(char *) path;
syscallarg(int) mode;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
@@ -827,7 +827,7 @@ linux_sys_rmdir(p, v, retval)
struct linux_sys_rmdir_args /* {
syscallarg(char *) path;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -844,7 +844,7 @@ linux_sys_symlink(p, v, retval)
syscallarg(char *) path;
syscallarg(char *) to;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
LINUX_CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
@@ -863,7 +863,7 @@ linux_sys_readlink(p, v, retval)
syscallarg(char *) buf;
syscallarg(int) count;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, name));
@@ -898,7 +898,7 @@ linux_sys_truncate(p, v, retval)
syscallarg(char *) path;
syscallarg(long) length;
} */ *uap = v;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
struct sys_truncate_args sta;
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
diff --git a/sys/compat/linux/linux_file64.c b/sys/compat/linux/linux_file64.c
index 5d7b8961c0c..7a2f91fc89b 100644
--- a/sys/compat/linux/linux_file64.c
+++ b/sys/compat/linux/linux_file64.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_file64.c,v 1.8 2013/05/10 10:31:16 pirofti Exp $ */
+/* $OpenBSD: linux_file64.c,v 1.9 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_file64.c,v 1.2 2000/12/12 22:24:56 jdolecek Exp $ */
/*-
@@ -123,7 +123,7 @@ linux_sys_fstat64(p, v, retval)
caddr_t sg;
int error;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
st = stackgap_alloc(&sg, sizeof (struct stat));
@@ -159,7 +159,7 @@ linux_do_stat64(p, v, retval, dolstat)
int error;
struct linux_sys_stat64_args *uap = v;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
st = stackgap_alloc(&sg, sizeof (struct stat));
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -221,7 +221,7 @@ linux_sys_truncate64(p, v, retval)
syscallarg(off_t) length;
} */ *uap = v;
struct sys_truncate_args ta;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -321,7 +321,7 @@ linux_sys_fcntl64(p, v, retval)
switch (cmd) {
case LINUX_F_GETLK64:
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
if ((error = copyin(arg, &lfl, sizeof lfl)))
return error;
linux_to_bsd_flock64(&lfl, &bfl);
@@ -344,7 +344,7 @@ linux_sys_fcntl64(p, v, retval)
if ((error = copyin(arg, &lfl, sizeof lfl)))
return error;
linux_to_bsd_flock64(&lfl, &bfl);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bfp = (struct flock *) stackgap_alloc(&sg, sizeof *bfp);
if ((error = copyout(&bfl, bfp, sizeof bfl)))
return error;
diff --git a/sys/compat/linux/linux_hdio.c b/sys/compat/linux/linux_hdio.c
index 3071eea93e0..bb4c4cde98e 100644
--- a/sys/compat/linux/linux_hdio.c
+++ b/sys/compat/linux/linux_hdio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_hdio.c,v 1.8 2012/04/22 05:43:14 guenther Exp $ */
+/* $OpenBSD: linux_hdio.c,v 1.9 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_hdio.c,v 1.1 2000/12/10 14:12:17 fvdl Exp $ */
/*
@@ -91,7 +91,7 @@ linux_ioctl_hdio(struct proc *p, struct linux_sys_ioctl_args *uap,
switch (com) {
case LINUX_HDIO_OBSOLETE_IDENTITY:
case LINUX_HDIO_GET_IDENTITY:
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
atap = stackgap_alloc(&sg, DEV_BSIZE);
if (atap == NULL) {
error = ENOMEM;
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index 0d63c3abe50..4afb6d94293 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_ipc.c,v 1.16 2013/05/10 10:31:16 pirofti Exp $ */
+/* $OpenBSD: linux_ipc.c,v 1.17 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_ipc.c,v 1.10 1996/04/05 00:01:44 christos Exp $ */
/*
@@ -323,7 +323,7 @@ linux_semctl(p, v, retval)
if ((error = copyin(ldsp, (caddr_t)&lm, sizeof lm)))
return error;
linux_to_bsd_semid_ds(&lm, &bm);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
unptr = stackgap_alloc(&sg, sizeof (union semun));
dsp = stackgap_alloc(&sg, sizeof (struct semid_ds));
if ((error = copyout((caddr_t)&bm, dsp, sizeof bm)))
@@ -333,7 +333,7 @@ linux_semctl(p, v, retval)
SCARG(&bsa, arg) = (union semun *)unptr;
return sys___semctl(p, &bsa, retval);
case LINUX_IPC_STAT:
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
unptr = stackgap_alloc(&sg, sizeof (union semun));
dsp = stackgap_alloc(&sg, sizeof (struct semid_ds));
if ((error = copyout((caddr_t)&dsp, unptr, sizeof dsp)))
@@ -507,14 +507,14 @@ linux_msgctl(p, v, retval)
if ((error = copyin(SCARG(uap, ptr), (caddr_t)&lm, sizeof lm)))
return error;
linux_to_bsd_msqid_ds(&lm, &bm);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
umsgptr = stackgap_alloc(&sg, sizeof bm);
if ((error = copyout((caddr_t)&bm, umsgptr, sizeof bm)))
return error;
SCARG(&bma, buf) = (struct msqid_ds *)umsgptr;
return sys_msgctl(p, &bma, retval);
case LINUX_IPC_STAT:
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
umsgptr = stackgap_alloc(&sg, sizeof (struct msqid_ds));
SCARG(&bma, buf) = (struct msqid_ds *)umsgptr;
if ((error = sys_msgctl(p, &bma, retval)))
@@ -693,7 +693,7 @@ linux_shmctl(p, v, retval)
switch (SCARG(uap, a2)) {
case LINUX_IPC_STAT:
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bsp = stackgap_alloc(&sg, sizeof (struct shmid_ds));
SCARG(&bsa, shmid) = SCARG(uap, a1);
SCARG(&bsa, cmd) = IPC_STAT;
@@ -710,7 +710,7 @@ linux_shmctl(p, v, retval)
sizeof lseg)))
return error;
linux_to_bsd_shmid_ds(&lseg, &bs);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bsp = stackgap_alloc(&sg, sizeof (struct shmid_ds));
if ((error = copyout((caddr_t) &bs, (caddr_t) bsp, sizeof bs)))
return error;
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 0a1b4d74355..f372f573ffc 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_misc.c,v 1.87 2014/03/24 03:48:00 guenther Exp $ */
+/* $OpenBSD: linux_misc.c,v 1.88 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */
/*-
@@ -463,7 +463,7 @@ linux_sys_statfs(p, v, retval)
caddr_t sg;
int error;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -539,7 +539,7 @@ linux_sys_statfs64(struct proc *p, void *v, register_t *retval)
caddr_t sg;
int error;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -574,7 +574,7 @@ linux_sys_fstatfs(p, v, retval)
caddr_t sg;
int error;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
SCARG(&bsa, fd) = SCARG(uap, fd);
@@ -604,7 +604,7 @@ linux_sys_fstatfs64(struct proc *p, void *v, register_t *retval)
caddr_t sg;
int error;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
bsp = (struct statfs *) stackgap_alloc(&sg, sizeof (struct statfs));
SCARG(&bsa, fd) = SCARG(uap, fd);
@@ -1022,7 +1022,7 @@ linux_sys_utime(p, v, retval)
struct timeval tv[2], *tvp;
struct linux_utimbuf lut;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
tvp = (struct timeval *) stackgap_alloc(&sg, sizeof(tv));
LINUX_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
@@ -1308,7 +1308,7 @@ linux_select1(struct proc *p, register_t *retval, int nfds, fd_set *readfds,
timerclear(&utv);
}
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
tvp = stackgap_alloc(&sg, sizeof(utv));
if ((error = copyout(&utv, tvp, sizeof(utv))))
return error;
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c
index af5666317f7..22a03ae8dc9 100644
--- a/sys/compat/linux/linux_signal.c
+++ b/sys/compat/linux/linux_signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_signal.c,v 1.16 2014/01/21 01:49:13 tedu Exp $ */
+/* $OpenBSD: linux_signal.c,v 1.17 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_signal.c,v 1.10 1996/04/04 23:51:36 christos Exp $ */
/*
@@ -397,7 +397,7 @@ linux_sys_sigaction(p, v, retval)
if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= LINUX__NSIG)
return (EINVAL);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
nlsa = SCARG(uap, nsa);
olsa = SCARG(uap, osa);
@@ -468,7 +468,7 @@ linux_sys_rt_sigaction(p, v, retval)
if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= LINUX__NSIG)
return (EINVAL);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
nlsa = SCARG(uap, nsa);
olsa = SCARG(uap, osa);
@@ -540,7 +540,7 @@ linux_sys_signal(p, v, retval)
if (SCARG(uap, sig) < 0 || SCARG(uap, sig) >= LINUX__NSIG)
return (EINVAL);
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
nsa = stackgap_alloc(&sg, sizeof *nsa);
osa = stackgap_alloc(&sg, sizeof *osa);
@@ -844,7 +844,7 @@ linux_sys_sigaltstack(p, v, retval)
int error;
caddr_t sg;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
if (SCARG(uap, nss) != NULL) {
bsd_nss = stackgap_alloc(&sg, sizeof *bsd_nss);
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 3a9f77fc1be..caab7b4fbcf 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_socket.c,v 1.48 2014/02/13 13:10:34 mpi Exp $ */
+/* $OpenBSD: linux_socket.c,v 1.49 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_socket.c,v 1.14 1996/04/05 00:01:50 christos Exp $ */
/*
@@ -308,7 +308,7 @@ linux_bind(p, v, retval)
namlen = lba.namelen;
if (lba.name) {
struct sockaddr *sa;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
error = linux_sa_get(p, &sg, &sa, lba.name, &namlen);
if (error)
@@ -335,7 +335,7 @@ linux_connect(p, v, retval)
struct linux_connect_args lca;
struct sys_connect_args bca;
struct sockaddr *sa;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
int namlen;
int error;
@@ -816,7 +816,7 @@ linux_sendto(p, v, retval)
struct sys_sendto_args bsa;
int error;
int tolen;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
if ((error = copyin((caddr_t) uap, (caddr_t) &lsa, sizeof lsa)))
return error;
@@ -1224,7 +1224,7 @@ linux_sendmsg(p, v, retval)
if (msg.msg_name) {
struct sockaddr *sa;
- caddr_t sg = stackgap_init(p->p_emul);
+ caddr_t sg = stackgap_init(p);
nmsg = (struct msghdr *)stackgap_alloc(&sg,
sizeof(struct msghdr));
diff --git a/sys/compat/linux/linux_termios.c b/sys/compat/linux/linux_termios.c
index cda6f1aeb51..1baae7e2f6d 100644
--- a/sys/compat/linux/linux_termios.c
+++ b/sys/compat/linux/linux_termios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_termios.c,v 1.16 2012/04/22 05:43:14 guenther Exp $ */
+/* $OpenBSD: linux_termios.c,v 1.17 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: linux_termios.c,v 1.3 1996/04/05 00:01:54 christos Exp $ */
/*
@@ -693,7 +693,7 @@ linux_ioctl_termios(p, v, retval)
if (c == _POSIX_VDISABLE)
goto out;
- sg = stackgap_init(p->p_emul);
+ sg = stackgap_init(p);
cp = (char *) stackgap_alloc(&sg, 1);
if ((error = copyout(&c, cp, 1)))
goto out;
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c
index 3fc6d98c81c..a69e282bceb 100644
--- a/sys/dev/systrace.c
+++ b/sys/dev/systrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace.c,v 1.63 2012/04/22 05:43:14 guenther Exp $ */
+/* $OpenBSD: systrace.c,v 1.64 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -660,6 +660,7 @@ systrace_fork(struct proc *oldproc, struct proc *p, struct str_process *newstrp)
int
systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
{
+ struct process *pr = p->p_p;
struct sysent *callp;
struct str_process *strp;
struct str_policy *strpolicy;
@@ -677,7 +678,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
return (EINVAL);
}
- if (code < 0 || code >= p->p_emul->e_nsysent) {
+ if (code < 0 || code >= pr->ps_emul->e_nsysent) {
systrace_unlock();
return (EINVAL);
}
@@ -699,7 +700,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
if (fst->issuser) {
maycontrol = 1;
issuser = 1;
- } else if (!ISSET(p->p_p->ps_flags, PS_SUGID | PS_SUGIDEXEC)) {
+ } else if (!ISSET(pr->ps_flags, PS_SUGID | PS_SUGIDEXEC)) {
maycontrol = fst->p_ruid == p->p_cred->p_ruid &&
fst->p_rgid == p->p_cred->p_rgid;
}
@@ -718,7 +719,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
}
}
- callp = p->p_emul->e_sysent + code;
+ callp = pr->ps_emul->e_sysent + code;
/* Fast-path */
if (policy != SYSTR_POLICY_ASK) {
@@ -734,7 +735,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
if (policy == SYSTR_POLICY_KILL) {
error = EPERM;
DPRINTF(("systrace: pid %u killed on syscall %d\n",
- p->p_pid, code));
+ pr->ps_pid, code));
psignal(p, SIGKILL);
} else if (policy == SYSTR_POLICY_PERMIT)
error = (*callp->sy_call)(p, v, retval);
@@ -747,7 +748,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
* base; i.e. that stackgap_init() is idempotent.
*/
systrace_inject(strp, 0 /* Just reset internal state */);
- strp->sg = stackgap_init(p->p_emul);
+ strp->sg = stackgap_init(p);
/* Puts the current process to sleep, return unlocked */
error = systrace_msg_ask(fst, strp, code, callp->sy_argsize, v);
@@ -785,7 +786,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
if (error)
goto out_unlock;
- oldemul = p->p_emul;
+ oldemul = pr->ps_emul;
pc = p->p_cred;
olduid = pc->p_ruid;
oldgid = pc->p_rgid;
@@ -825,7 +826,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
systrace_replacefree(strp);
- if (ISSET(p->p_p->ps_flags, PS_SUGID | PS_SUGIDEXEC)) {
+ if (ISSET(pr->ps_flags, PS_SUGID | PS_SUGIDEXEC)) {
if ((fst = strp->parent) == NULL || !fst->issuser) {
systrace_unlock();
return (error);
@@ -845,7 +846,7 @@ systrace_redirect(int code, struct proc *p, void *v, register_t *retval)
rw_enter_write(&fst->lock);
systrace_unlock();
- if (p->p_emul != oldemul) {
+ if (pr->ps_emul != oldemul) {
/* Old policy is without meaning now */
if (strp->policy) {
systrace_closepolicy(fst, strp->policy);
@@ -1059,7 +1060,7 @@ systrace_policy(struct fsystrace *fst, struct systrace_policy *pol)
return (EINVAL);
/* Check that emulation matches */
- if (strpol->emul && strpol->emul != strp->proc->p_emul)
+ if (strpol->emul && strpol->emul != strp->proc->p_p->ps_emul)
return (EINVAL);
if (strp->policy)
@@ -1073,7 +1074,7 @@ systrace_policy(struct fsystrace *fst, struct systrace_policy *pol)
/* Record emulation for this policy */
if (strpol->emul == NULL)
- strpol->emul = strp->proc->p_emul;
+ strpol->emul = strp->proc->p_p->ps_emul;
break;
case SYSTR_POLICY_MODIFY:
@@ -1703,7 +1704,7 @@ systrace_msg_emul(struct fsystrace *fst, struct str_process *strp)
struct str_msg_emul *msg_emul = &strp->msg.msg_data.msg_emul;
struct proc *p = strp->proc;
- memcpy(msg_emul->emul, p->p_emul->e_name, SYSTR_EMULEN);
+ memcpy(msg_emul->emul, p->p_p->ps_emul->e_name, SYSTR_EMULEN);
return (systrace_make_msg(strp, SYSTR_MSG_EMUL));
}
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c
index 49a3d80783e..8d521876505 100644
--- a/sys/kern/exec_elf.c
+++ b/sys/kern/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.95 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.96 2014/03/26 05:23:42 guenther Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@@ -1192,7 +1192,7 @@ ELFNAMEEND(coredump_notes)(struct proc *p, void *iocookie, size_t *sizep)
/* Second, write an NT_OPENBSD_AUXV note. */
notesize = sizeof(nhdr) + elfround(sizeof("OpenBSD")) +
- elfround(p->p_emul->e_arglen * sizeof(char *));
+ elfround(pr->ps_emul->e_arglen * sizeof(char *));
if (iocookie) {
iov.iov_base = &pss;
iov.iov_len = sizeof(pss);
@@ -1212,7 +1212,7 @@ ELFNAMEEND(coredump_notes)(struct proc *p, void *iocookie, size_t *sizep)
return (EIO);
nhdr.namesz = sizeof("OpenBSD");
- nhdr.descsz = p->p_emul->e_arglen * sizeof(char *);
+ nhdr.descsz = pr->ps_emul->e_arglen * sizeof(char *);
nhdr.type = NT_OPENBSD_AUXV;
error = coredump_write(iocookie, UIO_SYSSPACE,
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 0e104a417f0..724f6c49f81 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.205 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: init_main.c,v 1.206 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -285,7 +285,7 @@ main(void *framep)
atomic_setbits_int(&p->p_flag, P_SYSTEM);
p->p_stat = SONPROC;
pr->ps_nice = NZERO;
- p->p_emul = &emul_native;
+ pr->ps_emul = &emul_native;
bcopy("swapper", p->p_comm, sizeof ("swapper"));
/* Init timeouts. */
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index a6faedd19fe..b0118c6f481 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.138 2014/03/19 00:01:56 deraadt Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.139 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -658,9 +658,9 @@ sys_execve(struct proc *p, void *v, register_t *retval)
* same, the exec hook code should deallocate any old emulation
* resources held previously by this process.
*/
- if (p->p_emul && p->p_emul->e_proc_exit &&
- p->p_emul != pack.ep_emul)
- (*p->p_emul->e_proc_exit)(p);
+ if (pr->ps_emul && pr->ps_emul->e_proc_exit &&
+ pr->ps_emul != pack.ep_emul)
+ (*pr->ps_emul->e_proc_exit)(p);
p->p_descfd = 255;
if ((pack.ep_flags & EXEC_HASFD) && pack.ep_fd < 255)
@@ -673,12 +673,12 @@ sys_execve(struct proc *p, void *v, register_t *retval)
if (pack.ep_emul->e_proc_exec)
(*pack.ep_emul->e_proc_exec)(p, &pack);
- /* update p_emul, the old value is no longer needed */
- p->p_emul = pack.ep_emul;
+ /* update ps_emul, the old value is no longer needed */
+ pr->ps_emul = pack.ep_emul;
#ifdef KTRACE
if (KTRPOINT(p, KTR_EMUL))
- ktremul(p, p->p_emul->e_name);
+ ktremul(p);
#endif
atomic_clearbits_int(&pr->ps_flags, PS_INEXEC);
@@ -832,9 +832,9 @@ exec_sigcode_map(struct proc *p, struct emul *e)
uvm_unmap(kernel_map, va, va + round_page(sz));
}
- p->p_sigcode = 0; /* no hint */
+ p->p_p->ps_sigcode = 0; /* no hint */
uao_reference(e->e_sigobject);
- if (uvm_map(&p->p_vmspace->vm_map, &p->p_sigcode, round_page(sz),
+ if (uvm_map(&p->p_vmspace->vm_map, &p->p_p->ps_sigcode, round_page(sz),
e->e_sigobject, 0, 0, UVM_MAPFLAG(UVM_PROT_RX, UVM_PROT_RX,
UVM_INH_SHARE, UVM_ADV_RANDOM, 0))) {
uao_detach(e->e_sigobject);
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 6505d739f41..1dbac28a8b5 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.136 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.137 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -250,10 +250,10 @@ exit1(struct proc *p, int rv, int flags)
#endif
/*
- * If emulation has process exit hook, call it now.
+ * If emulation has thread exit hook, call it now.
*/
- if (p->p_emul->e_proc_exit)
- (*p->p_emul->e_proc_exit)(p);
+ if (pr->ps_emul->e_proc_exit)
+ (*pr->ps_emul->e_proc_exit)(p);
/*
* Remove proc from pidhash chain and allproc so looking
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 22da80f01d6..b9a7fb13d49 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.159 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.160 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -370,10 +370,10 @@ fork1(struct proc *curp, int flags, void *stack, pid_t *tidptr,
sigstkinit(&p->p_sigstk);
/*
- * If emulation has process fork hook, call it now.
+ * If emulation has thread fork hook, call it now.
*/
- if (p->p_emul->e_proc_fork)
- (*p->p_emul->e_proc_fork)(p, curp);
+ if (pr->ps_emul->e_proc_fork)
+ (*pr->ps_emul->e_proc_fork)(p, curp);
p->p_addr = (struct user *)uaddr;
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 8d3960f61e0..de0c2d55861 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_ktrace.c,v 1.63 2014/01/21 01:48:44 tedu Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.64 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
@@ -50,8 +50,10 @@
#include <uvm/uvm_extern.h>
+void ktrinitheaderraw(struct ktr_header *, uint, pid_t, pid_t);
void ktrinitheader(struct ktr_header *, struct proc *, int);
void ktrstart(struct proc *, struct vnode *, struct ucred *);
+void ktremulraw(struct proc *, struct process *, pid_t);
int ktrops(struct proc *, struct process *, int, int, struct vnode *,
struct ucred *);
int ktrsetchildren(struct proc *, struct process *, int, int,
@@ -118,13 +120,20 @@ ktrsettrace(struct process *pr, int facs, struct vnode *newvp,
}
void
-ktrinitheader(struct ktr_header *kth, struct proc *p, int type)
+ktrinitheaderraw(struct ktr_header *kth, uint type, pid_t pid, pid_t tid)
{
memset(kth, 0, sizeof(struct ktr_header));
kth->ktr_type = type;
nanotime(&kth->ktr_time);
- kth->ktr_pid = p->p_p->ps_pid;
- kth->ktr_tid = p->p_pid + THREAD_PID_OFFSET;
+ kth->ktr_pid = pid;
+ kth->ktr_tid = tid;
+}
+
+void
+ktrinitheader(struct ktr_header *kth, struct proc *p, int type)
+{
+ ktrinitheaderraw(kth, type, p->p_p->ps_pid,
+ p->p_pid + THREAD_PID_OFFSET);
bcopy(p->p_comm, kth->ktr_comm, MAXCOMLEN);
}
@@ -133,14 +142,8 @@ ktrstart(struct proc *p, struct vnode *vp, struct ucred *cred)
{
struct ktr_header kth;
- memset(&kth, 0, sizeof(kth));
- kth.ktr_type = htobe32(KTR_START);
- nanotime(&kth.ktr_time);
- kth.ktr_pid = (pid_t)-1;
- kth.ktr_tid = (pid_t)-1;
- atomic_setbits_int(&p->p_flag, P_INKTR);
+ ktrinitheaderraw(&kth, htobe32(KTR_START), -1, -1);
ktrwriteraw(p, vp, cred, &kth, NULL);
- atomic_clearbits_int(&p->p_flag, P_INKTR);
}
void
@@ -153,7 +156,7 @@ ktrsyscall(struct proc *p, register_t code, size_t argsize, register_t args[])
u_int nargs = 0;
int i;
- if (code == SYS___sysctl && (p->p_emul->e_flags & EMUL_NATIVE)) {
+ if (code == SYS___sysctl && (p->p_p->ps_emul->e_flags & EMUL_NATIVE)) {
/*
* The native sysctl encoding stores the mib[]
* array because it is interesting.
@@ -170,9 +173,7 @@ ktrsyscall(struct proc *p, register_t code, size_t argsize, register_t args[])
argp = (register_t *)((char *)ktp + sizeof(struct ktr_syscall));
for (i = 0; i < (argsize / sizeof *argp); i++)
*argp++ = args[i];
- if (code == SYS___sysctl && (p->p_emul->e_flags & EMUL_NATIVE) &&
- nargs &&
- copyin((void *)args[0], argp, nargs * sizeof(int)))
+ if (nargs && copyin((void *)args[0], argp, nargs * sizeof(int)))
memset(argp, 0, nargs * sizeof(int));
kth.ktr_len = len;
ktrwrite(p, &kth, ktp);
@@ -212,15 +213,22 @@ ktrnamei(struct proc *p, char *path)
}
void
-ktremul(struct proc *p, char *emul)
+ktremulraw(struct proc *curp, struct process *pr, pid_t tid)
{
struct ktr_header kth;
+ char *emul = pr->ps_emul->e_name;
- atomic_setbits_int(&p->p_flag, P_INKTR);
- ktrinitheader(&kth, p, KTR_EMUL);
+ ktrinitheaderraw(&kth, KTR_EMUL, pr->ps_pid, tid);
kth.ktr_len = strlen(emul);
- ktrwrite(p, &kth, emul);
+ ktrwriteraw(curp, pr->ps_tracevp, pr->ps_tracecred, &kth, emul);
+}
+
+void
+ktremul(struct proc *p)
+{
+ atomic_setbits_int(&p->p_flag, P_INKTR);
+ ktremulraw(p, p->p_p, p->p_pid + THREAD_PID_OFFSET);
atomic_clearbits_int(&p->p_flag, P_INKTR);
}
@@ -413,7 +421,6 @@ sys_ktrace(struct proc *curp, void *v, register_t *retval)
int error = 0;
struct nameidata nd;
- atomic_setbits_int(&curp->p_flag, P_INKTR);
if (ops != KTROP_CLEAR) {
/*
* an operation which requires a file argument.
@@ -498,7 +505,6 @@ done:
(void) vn_close(vp, FREAD|FWRITE, cred, curp);
if (cred != NULL)
crfree(cred);
- atomic_clearbits_int(&curp->p_flag, P_INKTR);
return (error);
}
@@ -506,8 +512,6 @@ int
ktrops(struct proc *curp, struct process *pr, int ops, int facs,
struct vnode *vp, struct ucred *cred)
{
- struct proc *p;
-
if (!ktrcanset(curp, pr))
return (0);
if (ops == KTROP_SET)
@@ -522,15 +526,11 @@ ktrops(struct proc *curp, struct process *pr, int ops, int facs,
}
/*
- * Emit an emulation record, every time there is a ktrace
- * change/attach request.
- * XXX an EMUL record for each thread? Perhaps should have
- * XXX a record type to say "this pid is really a thread of this
- * XXX other pid" and only generate an EMUL record for the main pid
+ * Emit an emulation record every time there is a ktrace
+ * change/attach request.
*/
- TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link)
- if (KTRPOINT(p, KTR_EMUL))
- ktremul(p, p->p_emul->e_name);
+ if (pr->ps_traceflag & KTRFAC_EMUL)
+ ktremulraw(curp, pr, -1);
return (1);
}
@@ -581,7 +581,7 @@ ktrwrite(struct proc *p, struct ktr_header *kth, void *aux)
}
int
-ktrwriteraw(struct proc *p, struct vnode *vp, struct ucred *cred,
+ktrwriteraw(struct proc *curp, struct vnode *vp, struct ucred *cred,
struct ktr_header *kth, void *aux)
{
struct uio auio;
@@ -597,14 +597,14 @@ ktrwriteraw(struct proc *p, struct vnode *vp, struct ucred *cred,
aiov[0].iov_len = sizeof(struct ktr_header);
auio.uio_resid = sizeof(struct ktr_header);
auio.uio_iovcnt = 1;
- auio.uio_procp = p;
+ auio.uio_procp = curp;
if (kth->ktr_len > 0) {
auio.uio_iovcnt++;
aiov[1].iov_base = aux;
aiov[1].iov_len = kth->ktr_len;
auio.uio_resid += kth->ktr_len;
}
- vget(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vget(vp, LK_EXCLUSIVE | LK_RETRY, curp);
error = VOP_WRITE(vp, &auio, IO_UNIT|IO_APPEND, cred);
if (!error) {
vput(vp);
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index a22597aa23e..9512e05f925 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_proc.c,v 1.55 2014/01/20 21:19:28 guenther Exp $ */
+/* $OpenBSD: kern_proc.c,v 1.56 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
@@ -485,7 +485,7 @@ db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif)
case 'w':
db_printf("%-16s %-8s %18p %s\n", p->p_comm,
- p->p_emul->e_name, p->p_wchan,
+ pr->ps_emul->e_name, p->p_wchan,
(p->p_wchan && p->p_wmesg) ?
p->p_wmesg : "");
break;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 64467a55dac..0d8ae331f10 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.160 2014/03/24 03:48:00 guenther Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.161 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -742,7 +742,7 @@ trapsignal(struct proc *p, int signum, u_long trapno, int code,
}
#endif
p->p_ru.ru_nsignals++;
- (*p->p_emul->e_sendsig)(ps->ps_sigact[signum], signum,
+ (*pr->ps_emul->e_sendsig)(ps->ps_sigact[signum], signum,
p->p_sigmask, trapno, code, sigval);
p->p_sigmask |= ps->ps_catchmask[signum];
if ((ps->ps_sigreset & mask) != 0) {
@@ -1286,7 +1286,8 @@ void
postsig(int signum)
{
struct proc *p = curproc;
- struct sigacts *ps = p->p_p->ps_sigacts;
+ struct process *pr = p->p_p;
+ struct sigacts *ps = pr->ps_sigacts;
sig_t action;
u_long trapno;
int mask, returnmask;
@@ -1375,7 +1376,7 @@ postsig(int signum)
p->p_sigval.sival_ptr = NULL;
}
- (*p->p_emul->e_sendsig)(action, signum, returnmask, trapno,
+ (*pr->ps_emul->e_sendsig)(action, signum, returnmask, trapno,
code, sigval);
}
@@ -1431,6 +1432,7 @@ coredump(struct proc *p)
#ifdef SMALL_KERNEL
return EPERM;
#else
+ struct process *pr = p->p_p;
struct vnode *vp;
struct ucred *cred = p->p_ucred;
struct vmspace *vm = p->p_vmspace;
@@ -1441,15 +1443,15 @@ coredump(struct proc *p)
char name[sizeof("/var/crash/") + MAXCOMLEN + sizeof(".core")];
char *dir = "";
- p->p_p->ps_flags |= PS_COREDUMP;
+ pr->ps_flags |= PS_COREDUMP;
/*
* Don't dump if not root and the process has used set user or
* group privileges, unless the nosuidcoredump sysctl is set to 2,
* in which case dumps are put into /var/crash/.
*/
- if (((p->p_p->ps_flags & PS_SUGID) && (error = suser(p, 0))) ||
- ((p->p_p->ps_flags & PS_SUGID) && nosuidcoredump)) {
+ if (((pr->ps_flags & PS_SUGID) && (error = suser(p, 0))) ||
+ ((pr->ps_flags & PS_SUGID) && nosuidcoredump)) {
if (nosuidcoredump == 2)
dir = "/var/crash/";
else
@@ -1500,7 +1502,7 @@ coredump(struct proc *p)
VATTR_NULL(&vattr);
vattr.va_size = 0;
VOP_SETATTR(vp, &vattr, cred, p);
- p->p_p->ps_acflag |= ACORE;
+ pr->ps_acflag |= ACORE;
io.io_proc = p;
io.io_vp = vp;
@@ -1510,7 +1512,7 @@ coredump(struct proc *p)
vref(vp);
error = vn_close(vp, FWRITE, cred, p);
if (error == 0)
- error = (*p->p_emul->e_coredump)(p, &io);
+ error = (*pr->ps_emul->e_coredump)(p, &io);
vrele(vp);
out:
crfree(cred);
diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c
index 063385c4be3..cc03d48d8fb 100644
--- a/sys/kern/kern_xxx.c
+++ b/sys/kern/kern_xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_xxx.c,v 1.23 2012/08/07 05:16:54 guenther Exp $ */
+/* $OpenBSD: kern_xxx.c,v 1.24 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: kern_xxx.c,v 1.32 1996/04/22 01:38:41 christos Exp $ */
/*
@@ -92,7 +92,7 @@ scdebug_call(struct proc *p, register_t code, const register_t args[])
if (!(scdebug & SCDEBUG_CALLS))
return;
- em = p->p_emul;
+ em = p->p_p->ps_emul;
sy = &em->e_sysent[code];
if (!(scdebug & SCDEBUG_ALL || code < 0 || code >= em->e_nsysent ||
sy->sy_call == sys_nosys))
@@ -125,7 +125,7 @@ scdebug_ret(struct proc *p, register_t code, int error,
if (!(scdebug & SCDEBUG_RETURNS))
return;
- em = p->p_emul;
+ em = p->p_p->ps_emul;
sy = &em->e_sysent[code];
if (!(scdebug & SCDEBUG_ALL || code < 0 || code >= em->e_nsysent ||
sy->sy_call == sys_nosys))
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index f23171157f8..499210728a6 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.58 2014/01/21 01:48:45 tedu Exp $ */
+/* $OpenBSD: sys_process.c,v 1.59 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -397,7 +397,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
case PIOD_READ_AUXV:
req = PT_READ_D;
uio.uio_rw = UIO_READ;
- temp = t->p_emul->e_arglen * sizeof(char *);
+ temp = tr->ps_emul->e_arglen * sizeof(char *);
if (uio.uio_offset > temp)
return (EIO);
if (uio.uio_resid > temp - uio.uio_offset)
diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h
index 6ca27fecea2..2ea13cf514f 100644
--- a/sys/sys/ktrace.h
+++ b/sys/sys/ktrace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ktrace.h,v 1.18 2014/01/24 04:26:51 guenther Exp $ */
+/* $OpenBSD: ktrace.h,v 1.19 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: ktrace.h,v 1.12 1996/02/04 02:12:29 christos Exp $ */
/*
@@ -195,7 +195,7 @@ __END_DECLS
#else
void ktrcsw(struct proc *, int, int);
-void ktremul(struct proc *, char *);
+void ktremul(struct proc *);
void ktrgenio(struct proc *, int, enum uio_rw, struct iovec *, ssize_t);
void ktrnamei(struct proc *, char *);
void ktrpsig(struct proc *, int, sig_t, int, int, siginfo_t *);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index bcb70cbac7b..5e2b5de593b 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.178 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: proc.h,v 1.179 2014/03/26 05:23:41 guenther Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -196,6 +196,8 @@ struct process {
struct plimit *ps_limit; /* Process limits. */
struct pgrp *ps_pgrp; /* Pointer to process group. */
+ struct emul *ps_emul; /* Emulation information */
+ vaddr_t ps_sigcode; /* User pointer to the signal code */
u_int ps_rtableid; /* Process routing table/domain. */
char ps_nice; /* Process "nice" value. */
@@ -324,9 +326,7 @@ struct proc {
# define TCB_GET(p) ((p)->p_tcb)
#endif
- struct emul *p_emul; /* Emulation information */
struct sigaltstack p_sigstk; /* sp & on stack state variable */
- vaddr_t p_sigcode; /* user pointer to the signal code. */
u_long p_prof_addr; /* tmp storage for profiling addr until AST */
u_long p_prof_ticks; /* tmp storage for profiling ticks until AST */
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 188dac0b2f5..d7c695b52a9 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.142 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: sysctl.h,v 1.143 2014/03/26 05:23:41 guenther Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -532,7 +532,7 @@ do { \
(kp)->p_acflag = (pr)->ps_acflag; \
\
/* XXX depends on e_name being an array and not a pointer */ \
- copy_str((kp)->p_emul, (char *)(p)->p_emul + \
+ copy_str((kp)->p_emul, (char *)(pr)->ps_emul + \
offsetof(struct emul, e_name), sizeof((kp)->p_emul)); \
strlcpy((kp)->p_comm, (p)->p_comm, sizeof((kp)->p_comm)); \
strlcpy((kp)->p_login, (sess)->s_login, \
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index 7bc42a14119..1aa9fcebdb4 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.47 2013/01/16 21:47:08 deraadt Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.48 2014/03/26 05:23:42 guenther Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -174,7 +174,7 @@ uvm_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
}
if (!(entry->protection & VM_PROT_WRITE) &&
- entry->start != p->p_sigcode)
+ entry->start != p->p_p->ps_sigcode)
continue;
/*
@@ -287,7 +287,7 @@ uvm_coredump_walkmap(struct proc *p, void *iocookie,
}
if (!(entry->protection & VM_PROT_WRITE) &&
- entry->start != p->p_sigcode)
+ entry->start != p->p_p->ps_sigcode)
continue;
/*