summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-04-11 15:28:51 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-04-11 15:28:51 +0000
commit86f02b900dd631fbf0aa31bede913fb0dafd8345 (patch)
tree130e8df9738ade3557faa105580a0ccf8cdd30bd /sys
parente51e64c1e1a3ed49446363def75895cbe6a6d2d4 (diff)
Move the P_WAITED flag from struct proc to struct process.
ok guenther@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_exit.c7
-rw-r--r--sys/kern/kern_sig.c4
-rw-r--r--sys/kern/sys_process.c8
-rw-r--r--sys/sys/proc.h4
4 files changed, 11 insertions, 12 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 8b5fe9d463a..62f927aefe4 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.111 2012/04/10 15:50:52 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.112 2012/04/11 15:28:50 kettenis Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -488,10 +488,11 @@ loop:
return (0);
}
if (p->p_stat == SSTOP &&
- (p->p_flag & (P_WAITED|P_SUSPSINGLE)) == 0 &&
+ (pr->ps_flags & PS_WAITED) == 0 &&
+ (p->p_flag & P_SUSPSINGLE) == 0 &&
(pr->ps_flags & PS_TRACED ||
SCARG(uap, options) & WUNTRACED)) {
- atomic_setbits_int(&p->p_flag, P_WAITED);
+ atomic_setbits_int(&pr->ps_flags, PS_WAITED);
retval[0] = p->p_pid;
if (SCARG(uap, status)) {
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 936d04c8e70..86dfae55cf7 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.138 2012/03/23 15:51:26 guenther Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.139 2012/04/11 15:28:50 kettenis Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1192,7 +1192,7 @@ proc_stop(struct proc *p, int sw)
#endif
p->p_stat = SSTOP;
- atomic_clearbits_int(&p->p_flag, P_WAITED);
+ atomic_clearbits_int(&p->p_p->ps_flags, PS_WAITED);
atomic_setbits_int(&p->p_flag, P_STOPPED|P_SUSPSIG);
if (!timeout_pending(&proc_stop_to)) {
timeout_add(&proc_stop_to, 0);
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 1610ad88f17..8f665600f1d 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.52 2012/04/06 20:28:51 kettenis Exp $ */
+/* $OpenBSD: sys_process.c,v 1.53 2012/04/11 15:28:50 kettenis Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -270,8 +270,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
/*
* (3) it's not currently stopped.
*/
- if (t->p_stat != SSTOP ||
- !ISSET(tr->ps_mainproc->p_flag, P_WAITED))
+ if (t->p_stat != SSTOP || !ISSET(tr->ps_flags, PS_WAITED))
return (EBUSY);
break;
@@ -485,8 +484,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
/* not being traced any more */
tr->ps_oppid = 0;
- atomic_clearbits_int(&tr->ps_flags, PS_TRACED);
- atomic_clearbits_int(&t->p_flag, P_WAITED);
+ atomic_clearbits_int(&tr->ps_flags, PS_TRACED|PS_WAITED);
sendsig:
bzero(tr->ps_ptstat, sizeof(*tr->ps_ptstat));
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index f6a52e34e6b..f23a9577645 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.154 2012/04/10 15:50:52 guenther Exp $ */
+/* $OpenBSD: proc.h,v 1.155 2012/04/11 15:28:50 kettenis Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -374,7 +374,7 @@ struct proc {
#define P_SYSTEM 0x000200 /* No sigs, stats or swapping. */
#define P_TIMEOUT 0x000400 /* Timing out during sleep. */
#define _P_TRACED 0x000800 /* Debugged process being traced. */
-#define P_WAITED 0x001000 /* Debugging proc has waited for child. */
+#define _P_WAITED 0x001000 /* Debugging proc has waited for child. */
#define P_WEXIT 0x002000 /* Working on exiting. */
#define _P_EXEC 0x004000 /* Process called exec. */