Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Remove p_oppid from struct proc
details: https://anonhg.NetBSD.org/src/rev/6eed38febc96
branches: trunk
changeset: 1004090:6eed38febc96
user: kamil <kamil%NetBSD.org@localhost>
date: Sat Oct 12 10:55:23 2019 +0000
description:
Remove p_oppid from struct proc
This field is not needed as it duplicated p_opptr that is alread safe to
use, unless proven otherwise.
eventswitch() already contained a check for != initproc (pid1).
Ride ABI bump for 9.99.16.
diffstat:
sys/kern/kern_exec.c | 7 +++----
sys/kern/kern_fork.c | 10 ++++------
sys/kern/kern_proc.c | 5 ++---
sys/kern/kern_sig.c | 6 ++++--
4 files changed, 13 insertions(+), 15 deletions(-)
diffs (127 lines):
diff -r db0493973406 -r 6eed38febc96 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Sat Oct 12 09:46:18 2019 +0000
+++ b/sys/kern/kern_exec.c Sat Oct 12 10:55:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.482 2019/09/30 21:13:33 kamil Exp $ */
+/* $NetBSD: kern_exec.c,v 1.483 2019/10/12 10:55:23 kamil Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.482 2019/09/30 21:13:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.483 2019/10/12 10:55:23 kamil Exp $");
#include "opt_exec.h"
#include "opt_execfmt.h"
@@ -2249,7 +2249,7 @@
}
mutex_enter(p->p_lock);
- eventswitch(TRAP_CHLD, PTRACE_POSIX_SPAWN, p->p_oppid);
+ eventswitch(TRAP_CHLD, PTRACE_POSIX_SPAWN, p->p_opptr->p_pid);
}
cpu_return:
@@ -2630,7 +2630,6 @@
if ((p1->p_slflag & (PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) ==
(PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) {
proc_changeparent(p2, p1->p_pptr);
- p2->p_oppid = p1->p_pid;
}
LIST_INSERT_AFTER(p1, p2, p_pglist);
diff -r db0493973406 -r 6eed38febc96 sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c Sat Oct 12 09:46:18 2019 +0000
+++ b/sys/kern/kern_fork.c Sat Oct 12 10:55:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_fork.c,v 1.214 2019/09/30 21:13:33 kamil Exp $ */
+/* $NetBSD: kern_fork.c,v 1.215 2019/10/12 10:55:23 kamil Exp $ */
/*-
* Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.214 2019/09/30 21:13:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.215 2019/10/12 10:55:23 kamil Exp $");
#include "opt_ktrace.h"
#include "opt_dtrace.h"
@@ -510,10 +510,8 @@
/*
* Trace fork(2) and vfork(2)-like events on demand in a debugger.
*/
- if (tracefork(p1, flags) || tracevfork(p1, flags)) {
+ if (tracefork(p1, flags) || tracevfork(p1, flags))
proc_changeparent(p2, p1->p_pptr);
- p2->p_oppid = p1->p_pid;
- }
LIST_INSERT_AFTER(p1, p2, p_pglist);
LIST_INSERT_HEAD(&allproc, p2, p_list);
@@ -640,7 +638,7 @@
mutex_enter(p->p_lock);
eventswitch(TRAP_CHLD,
ISSET(p->p_lflag, PL_PPWAIT) ? PTRACE_VFORK : PTRACE_FORK,
- p->p_oppid);
+ p->p_opptr->p_pid);
}
my_tracer_is_gone:
diff -r db0493973406 -r 6eed38febc96 sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c Sat Oct 12 09:46:18 2019 +0000
+++ b/sys/kern/kern_proc.c Sat Oct 12 10:55:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_proc.c,v 1.235 2019/09/30 21:13:33 kamil Exp $ */
+/* $NetBSD: kern_proc.c,v 1.236 2019/10/12 10:55:23 kamil Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.235 2019/09/30 21:13:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.236 2019/10/12 10:55:23 kamil Exp $");
#ifdef _KERNEL_OPT
#include "opt_kstack.h"
@@ -2263,7 +2263,6 @@
COND_SET_VALUE(p->p_sigpend, psrc->p_sigpend, allowaddr);
COND_SET_VALUE(p->p_lwpctl, psrc->p_lwpctl, allowaddr);
p->p_ppid = psrc->p_ppid;
- p->p_oppid = psrc->p_oppid;
COND_SET_VALUE(p->p_path, psrc->p_path, allowaddr);
COND_SET_VALUE(p->p_sigctx, psrc->p_sigctx, allowaddr);
p->p_nice = psrc->p_nice;
diff -r db0493973406 -r 6eed38febc96 sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c Sat Oct 12 09:46:18 2019 +0000
+++ b/sys/kern/kern_sig.c Sat Oct 12 10:55:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sig.c,v 1.367 2019/10/08 18:02:46 kamil Exp $ */
+/* $NetBSD: kern_sig.c,v 1.368 2019/10/12 10:55:23 kamil Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.367 2019/10/08 18:02:46 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.368 2019/10/12 10:55:23 kamil Exp $");
#include "opt_ptrace.h"
#include "opt_dtrace.h"
@@ -1599,6 +1599,8 @@
KASSERT(p->p_nrlwps > 0);
KASSERT((code == TRAP_CHLD) || (code == TRAP_LWP) ||
(code == TRAP_EXEC));
+ KASSERT((code != TRAP_CHLD) || (entity > 1)); /* prevent pid1 */
+ KASSERT((code != TRAP_LWP) || (entity > 0));
repeat:
/*
Home |
Main Index |
Thread Index |
Old Index