summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2007-03-15 10:22:29 +0000
committerart <art@openbsd.org>2007-03-15 10:22:29 +0000
commit29514732ed7d204db854b589692b0fd90dc452d0 (patch)
tree5e8143a1e45a8ca7a90bc7199927c179bed99d96
parentregen (diff)
downloadwireguard-openbsd-29514732ed7d204db854b589692b0fd90dc452d0.tar.xz
wireguard-openbsd-29514732ed7d204db854b589692b0fd90dc452d0.zip
Since p_flag is often manipulated in interrupts and without biglock
it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int. Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way. kettenis@ ok
-rw-r--r--sys/arch/alpha/alpha/trap.c3
-rw-r--r--sys/arch/alpha/include/cpu.h4
-rw-r--r--sys/arch/amd64/amd64/trap.c3
-rw-r--r--sys/arch/amd64/include/cpu.h4
-rw-r--r--sys/arch/arm/arm/ast.c3
-rw-r--r--sys/arch/arm/include/cpu.h4
-rw-r--r--sys/arch/hp300/hp300/trap.c3
-rw-r--r--sys/arch/hp300/include/cpu.h4
-rw-r--r--sys/arch/hppa/hppa/trap.c3
-rw-r--r--sys/arch/hppa/include/cpu.h4
-rw-r--r--sys/arch/hppa64/hppa64/trap.c3
-rw-r--r--sys/arch/hppa64/include/cpu.h4
-rw-r--r--sys/arch/i386/i386/trap.c3
-rw-r--r--sys/arch/i386/include/cpu.h4
-rw-r--r--sys/arch/m88k/include/cpu.h4
-rw-r--r--sys/arch/m88k/m88k/trap.c4
-rw-r--r--sys/arch/mac68k/include/cpu.h4
-rw-r--r--sys/arch/mac68k/mac68k/trap.c3
-rw-r--r--sys/arch/mips64/include/cpu.h4
-rw-r--r--sys/arch/mips64/mips64/interrupt.c3
-rw-r--r--sys/arch/mvme68k/include/cpu.h4
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c3
-rw-r--r--sys/arch/powerpc/include/cpu.h4
-rw-r--r--sys/arch/powerpc/powerpc/trap.c3
-rw-r--r--sys/arch/sh/include/cpu.h8
-rw-r--r--sys/arch/sh/sh/trap.c3
-rw-r--r--sys/arch/solbourne/solbourne/trap.c3
-rw-r--r--sys/arch/sparc/include/cpu.h4
-rw-r--r--sys/arch/sparc/sparc/trap.c3
-rw-r--r--sys/arch/sparc64/include/cpu.h4
-rw-r--r--sys/arch/sparc64/sparc64/trap.c3
-rw-r--r--sys/arch/vax/include/cpu.h4
-rw-r--r--sys/arch/vax/vax/trap.c3
-rw-r--r--sys/compat/hpux/hpux_file.c6
-rw-r--r--sys/compat/osf1/osf1_prot.c6
-rw-r--r--sys/compat/svr4/svr4_misc.c4
-rw-r--r--sys/dev/systrace.c12
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_clock.c6
-rw-r--r--sys/kern/kern_descrip.c6
-rw-r--r--sys/kern/kern_exec.c23
-rw-r--r--sys/kern/kern_exit.c20
-rw-r--r--sys/kern/kern_fork.c14
-rw-r--r--sys/kern/kern_kthread.c4
-rw-r--r--sys/kern/kern_lock.c6
-rw-r--r--sys/kern/kern_proc.c4
-rw-r--r--sys/kern/kern_prot.c16
-rw-r--r--sys/kern/kern_sig.c20
-rw-r--r--sys/kern/kern_synch.c10
-rw-r--r--sys/kern/subr_prof.c3
-rw-r--r--sys/kern/sys_generic.c16
-rw-r--r--sys/kern/sys_process.c8
-rw-r--r--sys/kern/tty.c4
-rw-r--r--sys/kern/tty_tty.c4
-rw-r--r--sys/miscfs/procfs/procfs_ctl.c8
-rw-r--r--sys/sys/resourcevar.h3
-rw-r--r--sys/ufs/ffs/ffs_softdep.c6
57 files changed, 155 insertions, 178 deletions
diff --git a/sys/arch/alpha/alpha/trap.c b/sys/arch/alpha/alpha/trap.c
index 99172106797..36babce98c3 100644
--- a/sys/arch/alpha/alpha/trap.c
+++ b/sys/arch/alpha/alpha/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.52 2006/12/24 20:30:33 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.53 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: trap.c,v 1.52 2000/05/24 16:48:33 thorpej Exp $ */
/*-
@@ -768,7 +768,6 @@ ast(framep)
uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h
index ef4b6b09503..8f1dcfeeaca 100644
--- a/sys/arch/alpha/include/cpu.h
+++ b/sys/arch/alpha/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.26 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.27 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.45 2000/08/21 02:03:12 thorpej Exp $ */
/*-
@@ -296,13 +296,11 @@ do { \
#ifdef notyet
#define need_proftick(p) \
do { \
- (p)->p_flag |= P_OWEUPC; \
aston((p)->p_cpu); \
} while (/*CONSTCOND*/0)
#else
#define need_proftick(p) \
do { \
- (p)->p_flag |= P_OWEUPC; \
aston(curcpu()); \
} while (/*CONSTCOND*/0)
#endif
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index 24451f7d6da..358592235d3 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.10 2007/01/15 23:19:05 jsg Exp $ */
+/* $OpenBSD: trap.c,v 1.11 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@@ -334,7 +334,6 @@ copyfault:
case T_ASTFLT|T_USER: /* Allow process switch */
uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
KERNEL_PROC_LOCK(p);
ADDUPROF(p);
KERNEL_PROC_UNLOCK(p);
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 38d4b66ed09..55ef0ec6bd5 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.25 2007/02/17 17:35:43 tom Exp $ */
+/* $OpenBSD: cpu.h,v 1.26 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -227,7 +227,7 @@ extern u_int32_t cpus_attached;
* buffer pages are invalid. On the i386, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, aston(p))
+#define need_proftick(p) aston(p)
void signotify(struct proc *);
diff --git a/sys/arch/arm/arm/ast.c b/sys/arch/arm/arm/ast.c
index 8ba315e3687..8bc5c0394bc 100644
--- a/sys/arch/arm/arm/ast.c
+++ b/sys/arch/arm/arm/ast.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ast.c,v 1.6 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: ast.c,v 1.7 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: ast.c,v 1.6 2003/10/31 16:44:34 cl Exp $ */
/*
@@ -114,7 +114,6 @@ ast(struct trapframe *tf)
#endif
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h
index fa4396b5558..faa66b3cbdb 100644
--- a/sys/arch/arm/include/cpu.h
+++ b/sys/arch/arm/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.14 2007/02/11 21:59:32 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.15 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */
/*
@@ -260,7 +260,7 @@ extern int want_resched; /* resched() was called */
* buffer pages are invalid. On the i386, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
+#define need_proftick(p) setsoftast()
#ifndef acorn26
/*
diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c
index 0a8d3b895ae..a408e050cbf 100644
--- a/sys/arch/hp300/hp300/trap.c
+++ b/sys/arch/hp300/hp300/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.49 2007/01/28 16:38:45 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.50 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */
/*
@@ -556,7 +556,6 @@ dopanic:
}
spl0();
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (type == (T_ASTFLT | T_USER) && want_resched) {
diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h
index df051c819cc..56d22c6a43e 100644
--- a/sys/arch/hp300/include/cpu.h
+++ b/sys/arch/hp300/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.32 2006/11/29 12:26:13 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.33 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.28 1998/02/13 07:41:51 scottr Exp $ */
/*
@@ -96,7 +96,7 @@ extern int want_resched; /* resched() was called */
* buffer pages are invalid. On the hp300, request an ast to send us
* through trap, marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
+#define need_proftick(p) aston()
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index 07e06fc9659..cabcae3e572 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.97 2007/03/05 17:13:59 mickey Exp $ */
+/* $OpenBSD: trap.c,v 1.98 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -139,7 +139,6 @@ userret(struct proc *p)
astpending = 0;
uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (want_resched)
diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h
index 04a70b07691..8ccf039327c 100644
--- a/sys/arch/hppa/include/cpu.h
+++ b/sys/arch/hppa/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.47 2007/01/17 19:30:12 mickey Exp $ */
+/* $OpenBSD: cpu.h,v 1.48 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 2000-2004 Michael Shalayeff
@@ -128,7 +128,7 @@ extern int cpu_hvers;
#define signotify(p) (setsoftast())
#define need_resched(ci) (want_resched = 1, setsoftast())
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
+#define need_proftick(p) setsoftast()
#define PROC_PC(p) ((p)->p_md.md_regs->tf_iioq_head)
#ifndef _LOCORE
diff --git a/sys/arch/hppa64/hppa64/trap.c b/sys/arch/hppa64/hppa64/trap.c
index 73ff5be1703..63b57f6886b 100644
--- a/sys/arch/hppa64/hppa64/trap.c
+++ b/sys/arch/hppa64/hppa64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.6 2005/10/26 18:35:45 martin Exp $ */
+/* $OpenBSD: trap.c,v 1.7 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -128,7 +128,6 @@ userret(struct proc *p, register_t pc, u_quad_t oticks)
if (astpending) {
astpending = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
}
diff --git a/sys/arch/hppa64/include/cpu.h b/sys/arch/hppa64/include/cpu.h
index 43cc46203aa..b88a04dea2b 100644
--- a/sys/arch/hppa64/include/cpu.h
+++ b/sys/arch/hppa64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.9 2006/03/12 03:14:37 brad Exp $ */
+/* $OpenBSD: cpu.h,v 1.10 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -196,7 +196,7 @@ extern int cpu_hvers;
#define signotify(p) (setsoftast())
#define need_resched(ci) (want_resched = 1, setsoftast())
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
+#define need_proftick(p) setsoftast()
#ifndef _LOCORE
#ifdef _KERNEL
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c
index 37c2fd28b26..0bea0095d56 100644
--- a/sys/arch/i386/i386/trap.c
+++ b/sys/arch/i386/i386/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.81 2007/01/09 08:43:25 art Exp $ */
+/* $OpenBSD: trap.c,v 1.82 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */
/*-
@@ -383,7 +383,6 @@ trap(struct trapframe frame)
case T_ASTFLT|T_USER: /* Allow process switch */
uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
KERNEL_PROC_LOCK(p);
ADDUPROF(p);
KERNEL_PROC_UNLOCK(p);
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 153e6f2c608..a066cbea0bb 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.87 2007/02/20 21:15:01 tom Exp $ */
+/* $OpenBSD: cpu.h,v 1.88 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -224,7 +224,7 @@ extern void need_resched(struct cpu_info *);
* buffer pages are invalid. On the i386, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast())
+#define need_proftick(p) setsoftast()
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index 08b797c5372..697cfcfc9af 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.18 2007/01/12 21:41:53 aoyama Exp $ */
+/* $OpenBSD: cpu.h,v 1.19 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -229,7 +229,7 @@ do { \
* buffer pages are invalid. On the m88k, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, aston(p))
+#define need_proftick(p) aston(p)
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index df5f44870af..4de452d5ebf 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.38 2007/02/11 12:49:37 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.39 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -538,7 +538,6 @@ user_fault:
uvmexp.softs++;
p->p_md.md_astpending = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
KERNEL_PROC_LOCK(p);
ADDUPROF(p);
KERNEL_PROC_UNLOCK(p);
@@ -1055,7 +1054,6 @@ m88110_user_fault:
uvmexp.softs++;
p->p_md.md_astpending = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
KERNEL_PROC_LOCK(p);
ADDUPROF(p);
KERNEL_PROC_UNLOCK(p);
diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h
index b97efff30d5..dec5f7811e2 100644
--- a/sys/arch/mac68k/include/cpu.h
+++ b/sys/arch/mac68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.42 2006/11/29 12:26:13 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.43 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.45 1997/02/10 22:13:40 scottr Exp $ */
/*
@@ -109,7 +109,7 @@ extern int want_resched; /* resched() was called */
* interrupt. Request an ast to send us through trap(),
* marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) ( (p)->p_flag |= P_OWEUPC, aston() )
+#define need_proftick(p) aston()
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c
index 7d14554196b..bc706b11f63 100644
--- a/sys/arch/mac68k/mac68k/trap.c
+++ b/sys/arch/mac68k/mac68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.51 2007/01/28 16:38:48 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.52 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: trap.c,v 1.68 1998/12/22 08:47:07 scottr Exp $ */
/*
@@ -511,7 +511,6 @@ copyfault:
}
spl0();
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (type == (T_ASTFLT | T_USER) && want_resched) {
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index def5c9e20c4..d24ef984e32 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.14 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.15 2007/03/15 10:22:29 art Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -349,7 +349,7 @@ extern int int_nest_cntr;
* buffer pages are invalid. On the PICA, request an ast to send us
* through trap, marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
+#define need_proftick(p) aston()
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/mips64/mips64/interrupt.c b/sys/arch/mips64/mips64/interrupt.c
index 59d1aed120d..0cf196762fa 100644
--- a/sys/arch/mips64/mips64/interrupt.c
+++ b/sys/arch/mips64/mips64/interrupt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interrupt.c,v 1.22 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: interrupt.c,v 1.23 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -267,7 +267,6 @@ softintr()
astpending = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (want_resched)
diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h
index 11e0a01ed04..a7caae93d53 100644
--- a/sys/arch/mvme68k/include/cpu.h
+++ b/sys/arch/mvme68k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.25 2006/11/29 12:26:13 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.26 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -121,7 +121,7 @@ extern int want_resched;
* buffer pages are invalid. On the m68k, request an ast to send us
* through trap, marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
+#define need_proftick(p) aston()
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
index cb72380c5a2..41fbfcc4b7c 100644
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ b/sys/arch/mvme68k/mvme68k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.64 2007/01/28 16:38:48 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.65 2007/03/15 10:22:29 art Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -491,7 +491,6 @@ copyfault:
}
spl0();
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (type == (T_ASTFLT | T_USER) && want_resched) {
diff --git a/sys/arch/powerpc/include/cpu.h b/sys/arch/powerpc/include/cpu.h
index d6c4026e087..d89ed88c158 100644
--- a/sys/arch/powerpc/include/cpu.h
+++ b/sys/arch/powerpc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.28 2006/11/29 12:26:13 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.29 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */
/*
@@ -51,7 +51,7 @@ extern volatile int want_resched;
extern volatile int astpending;
#define need_resched(ci) (want_resched = 1, astpending = 1)
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1)
+#define need_proftick(p) do { astpending = 1; } while (0)
#define signotify(p) (astpending = 1)
extern char *bootpath;
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index a5548f62226..c5c67b3f456 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.73 2006/12/24 20:29:19 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.74 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -644,7 +644,6 @@ for (i = 0; i < errnum; i++) {
uvmexp.softs++;
astpending = 0; /* we are about to do it */
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (want_resched)
diff --git a/sys/arch/sh/include/cpu.h b/sys/arch/sh/include/cpu.h
index a4906007317..61f0faf3f89 100644
--- a/sys/arch/sh/include/cpu.h
+++ b/sys/arch/sh/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.6 2007/03/03 21:37:27 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.7 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.41 2006/01/21 04:24:12 uwe Exp $ */
/*-
@@ -88,11 +88,7 @@ do { \
* buffer pages are invalid. On the MIPS, request an ast to send us
* through trap, marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) \
-do { \
- (p)->p_flag |= P_OWEUPC; \
- aston(p); \
-} while (/*CONSTCOND*/0)
+#define need_proftick(p) aston(p)
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/sh/sh/trap.c b/sys/arch/sh/sh/trap.c
index dd8a510e078..d5b503d17c3 100644
--- a/sys/arch/sh/sh/trap.c
+++ b/sys/arch/sh/sh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.11 2007/03/13 19:29:33 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.12 2007/03/15 10:22:29 art 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 $ */
@@ -488,7 +488,6 @@ ast(struct proc *p, struct trapframe *tf)
p->p_md.md_astpending = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
diff --git a/sys/arch/solbourne/solbourne/trap.c b/sys/arch/solbourne/solbourne/trap.c
index e2ac576e8ad..345ff5525d5 100644
--- a/sys/arch/solbourne/solbourne/trap.c
+++ b/sys/arch/solbourne/solbourne/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.8 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.9 2007/03/15 10:22:29 art Exp $ */
/* OpenBSD: trap.c,v 1.42 2004/12/06 20:12:25 miod Exp */
/*
@@ -348,7 +348,6 @@ badtrap:
case T_AST:
want_ast = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (want_resched)
diff --git a/sys/arch/sparc/include/cpu.h b/sys/arch/sparc/include/cpu.h
index 6cab3d88eab..c866f1d4803 100644
--- a/sys/arch/sparc/include/cpu.h
+++ b/sys/arch/sparc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.27 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.28 2007/03/15 10:22:29 art Exp $ */
/* $NetBSD: cpu.h,v 1.24 1997/03/15 22:25:15 pk Exp $ */
/*
@@ -141,7 +141,7 @@ extern int want_ast;
* buffer pages are invalid. On the sparc, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, want_ast = 1)
+#define need_proftick(p) do { want_ast = 1; } while (0)
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index 7ea961d5ecb..01aa8002472 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.50 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.51 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */
/*
@@ -341,7 +341,6 @@ badtrap:
case T_AST:
want_ast = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (want_resched)
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h
index 66d66500796..d5a6400e7ac 100644
--- a/sys/arch/sparc64/include/cpu.h
+++ b/sys/arch/sparc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.37 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.38 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
@@ -174,7 +174,7 @@ extern int want_resched; /* resched() was called */
* buffer pages are invalid. On the sparc, request an ast to send us
* through trap(), marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, want_ast = 1)
+#define need_proftick(p) do { want_ast = 1; } while (0)
/*
* Notify the current process (p) that it has a signal pending,
diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c
index 00e590f3c32..a7761e289c9 100644
--- a/sys/arch/sparc64/sparc64/trap.c
+++ b/sys/arch/sparc64/sparc64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.46 2007/02/27 22:46:32 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.47 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
/*
@@ -498,7 +498,6 @@ badtrap:
case T_AST:
want_ast = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (want_resched)
diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h
index 0191390c8cf..bc291df29e6 100644
--- a/sys/arch/vax/include/cpu.h
+++ b/sys/arch/vax/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.22 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.23 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */
/*
@@ -112,7 +112,7 @@ extern int want_resched; /* resched() was called */
* buffer pages are invalid. On the vax, request an ast to send us
* through trap, marking the proc as needing a profiling tick.
*/
-#define need_proftick(p) {(p)->p_flag |= P_OWEUPC; mtpr(AST_OK,PR_ASTLVL); }
+#define need_proftick(p) mtpr(AST_OK,PR_ASTLVL)
/*
* This defines the I/O device register space size in pages.
diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c
index 37f901282f6..c32a9f7a8d3 100644
--- a/sys/arch/vax/vax/trap.c
+++ b/sys/arch/vax/vax/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.36 2006/12/24 20:30:35 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.37 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -291,7 +291,6 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
mtpr(AST_NO,PR_ASTLVL);
trapsig = 0;
if (p->p_flag & P_OWEUPC) {
- p->p_flag &= ~P_OWEUPC;
ADDUPROF(p);
}
if (want_resched)
diff --git a/sys/compat/hpux/hpux_file.c b/sys/compat/hpux/hpux_file.c
index 63daf9ed6fc..cad38f912b3 100644
--- a/sys/compat/hpux/hpux_file.c
+++ b/sys/compat/hpux/hpux_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpux_file.c,v 1.17 2006/09/25 07:12:57 otto Exp $ */
+/* $OpenBSD: hpux_file.c,v 1.18 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: hpux_file.c,v 1.5 1997/04/27 21:40:48 thorpej Exp $ */
/*
@@ -282,7 +282,7 @@ hpux_sys_fcntl(p, v, retval)
goto out;
}
- p->p_flag |= P_ADVLOCK;
+ atomic_setbits_int(&p->p_flag, P_ADVLOCK);
error = VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg);
goto out;
@@ -291,7 +291,7 @@ hpux_sys_fcntl(p, v, retval)
error = EBADF;
goto out;
}
- p->p_flag |= P_ADVLOCK;
+ atomic_setbits_int(&p->p_flag, P_ADVLOCK);
error = VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg);
goto out;
diff --git a/sys/compat/osf1/osf1_prot.c b/sys/compat/osf1/osf1_prot.c
index f37abf0add1..6f4a860661d 100644
--- a/sys/compat/osf1/osf1_prot.c
+++ b/sys/compat/osf1/osf1_prot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: osf1_prot.c,v 1.2 2003/08/16 21:34:30 tedu Exp $ */
+/* $OpenBSD: osf1_prot.c,v 1.3 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: osf1_prot.c,v 1.2 1999/05/05 01:51:35 cgd Exp $ */
/*
@@ -96,7 +96,7 @@ osf1_sys_setgid(p, v, retval)
pc->p_rgid = gid;
pc->p_svgid = gid;
}
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
@@ -137,6 +137,6 @@ osf1_sys_setuid(p, v, retval)
pc->p_ruid = uid;
pc->p_svuid = uid;
}
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 287e0a4a8f3..1d100d71e6a 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_misc.c,v 1.46 2006/05/23 20:34:22 miod Exp $ */
+/* $OpenBSD: svr4_misc.c,v 1.47 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */
/*
@@ -1111,7 +1111,7 @@ loop:
(SCARG(uap, options) & (SVR4_WSTOPPED|SVR4_WCONTINUED)))) {
DPRINTF(("jobcontrol %d\n", p->p_pid));
if (((SCARG(uap, options) & SVR4_WNOWAIT)) == 0)
- p->p_flag |= P_WAITED;
+ atomic_setbits_int(&p->p_flag, P_WAITED);
*retval = 0;
return (svr4_setinfo(p, W_STOPCODE(p->p_xstat),
SCARG(uap, info)));
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c
index 3620497433f..2ab5a06512c 100644
--- a/sys/dev/systrace.c
+++ b/sys/dev/systrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace.c,v 1.43 2006/10/06 05:47:27 djm Exp $ */
+/* $OpenBSD: systrace.c,v 1.44 2007/03/15 10:22:30 art Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -648,7 +648,7 @@ systrace_exit(struct proc *proc)
rw_exit_write(&fst->lock);
} else
systrace_unlock();
- CLR(proc->p_flag, P_SYSTRACE);
+ atomic_clearbits_int(&proc->p_flag, P_SYSTRACE);
}
void
@@ -926,7 +926,7 @@ systrace_seteuid(struct proc *p, uid_t euid)
*/
pc->pc_ucred = crcopy(pc->pc_ucred);
pc->pc_ucred->cr_uid = euid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (oeuid);
}
@@ -945,7 +945,7 @@ systrace_setegid(struct proc *p, gid_t egid)
*/
pc->pc_ucred = crcopy(pc->pc_ucred);
pc->pc_ucred->cr_gid = egid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (oegid);
}
@@ -1579,7 +1579,7 @@ systrace_detach(struct str_process *strp)
DPRINTF(("%s: Trying to detach from %d\n", __func__, strp->pid));
if ((proc = systrace_find(strp)) != NULL) {
- CLR(proc->p_flag, P_SYSTRACE);
+ atomic_clearbits_int(&proc->p_flag, P_SYSTRACE);
proc->p_systrace = NULL;
} else
error = ESRCH;
@@ -1641,7 +1641,7 @@ systrace_insert_process(struct fsystrace *fst, struct proc *proc)
fst->nprocesses++;
proc->p_systrace = strp;
- SET(proc->p_flag, P_SYSTRACE);
+ atomic_setbits_int(&proc->p_flag, P_SYSTRACE);
return (0);
}
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 2d90604ff43..f54f517f4f8 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.134 2007/01/12 07:41:31 art Exp $ */
+/* $OpenBSD: init_main.c,v 1.135 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -270,7 +270,7 @@ main(void *framep)
p->p_thrparent = p;
LIST_INIT(&p->p_thrchildren);
- p->p_flag = P_SYSTEM | P_NOCLDWAIT;
+ atomic_setbits_int(&p->p_flag, P_SYSTEM | P_NOCLDWAIT);
p->p_stat = SONPROC;
p->p_nice = NZERO;
p->p_emul = &emul_native;
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 024bc6cc2ae..ba55361a277 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.60 2006/12/24 20:29:45 miod Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.61 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@@ -446,7 +446,7 @@ startprofclock(struct proc *p)
int s;
if ((p->p_flag & P_PROFIL) == 0) {
- p->p_flag |= P_PROFIL;
+ atomic_setbits_int(&p->p_flag, P_PROFIL);
if (++profprocs == 1 && stathz != 0) {
s = splstatclock();
psdiv = pscnt = psratio;
@@ -465,7 +465,7 @@ stopprofclock(struct proc *p)
int s;
if (p->p_flag & P_PROFIL) {
- p->p_flag &= ~P_PROFIL;
+ atomic_clearbits_int(&p->p_flag, P_PROFIL);
if (--profprocs == 0 && stathz != 0) {
s = splstatclock();
psdiv = pscnt = 1;
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 8d9c1189032..d2946c2edc4 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.75 2006/11/14 18:00:27 jmc Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.76 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -430,7 +430,7 @@ restart:
error = EBADF;
goto out;
}
- p->p_flag |= P_ADVLOCK;
+ atomic_setbits_int(&p->p_flag, P_ADVLOCK);
error = (VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg));
goto out;
@@ -439,7 +439,7 @@ restart:
error = EBADF;
goto out;
}
- p->p_flag |= P_ADVLOCK;
+ atomic_setbits_int(&p->p_flag, P_ADVLOCK);
error = (VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg));
goto out;
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 60aad9c4f37..e7c598f460c 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.101 2007/03/01 11:18:40 art Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.102 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -267,7 +267,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
* Cheap solution to complicated problems.
* Mark this process as "leave me alone, I'm execing".
*/
- p->p_flag |= P_INEXEC;
+ atomic_setbits_int(&p->p_flag, P_INEXEC);
#if NSYSTRACE > 0
if (ISSET(p->p_flag, P_SYSTRACE)) {
@@ -464,9 +464,9 @@ sys_execve(struct proc *p, void *v, register_t *retval)
VREF(pack.ep_vp);
p->p_textvp = pack.ep_vp;
- p->p_flag |= P_EXEC;
+ atomic_setbits_int(&p->p_flag, P_EXEC);
if (p->p_flag & P_PPWAIT) {
- p->p_flag &= ~P_PPWAIT;
+ atomic_clearbits_int(&p->p_flag, P_PPWAIT);
wakeup((caddr_t)p->p_pptr);
}
@@ -478,9 +478,9 @@ sys_execve(struct proc *p, void *v, register_t *retval)
p->p_ucred->cr_uid != p->p_cred->p_svuid ||
p->p_ucred->cr_gid != p->p_cred->p_rgid ||
p->p_ucred->cr_gid != p->p_cred->p_svgid)
- p->p_flag |= P_SUGIDEXEC;
+ atomic_setbits_int(&p->p_flag, P_SUGIDEXEC);
else
- p->p_flag &= ~P_SUGIDEXEC;
+ atomic_clearbits_int(&p->p_flag, P_SUGIDEXEC);
/*
* deal with set[ug]id.
@@ -489,8 +489,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
if ((attr.va_mode & (VSUID | VSGID)) && proc_cansugid(p)) {
int i;
- p->p_flag |= P_SUGID;
- p->p_flag |= P_SUGIDEXEC;
+ atomic_setbits_int(&p->p_flag, P_SUGID|P_SUGIDEXEC);
#ifdef KTRACE
/*
@@ -571,7 +570,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
}
}
} else
- p->p_flag &= ~P_SUGID;
+ atomic_clearbits_int(&p->p_flag, P_SUGID);
p->p_cred->p_svuid = p->p_ucred->cr_uid;
p->p_cred->p_svgid = p->p_ucred->cr_gid;
@@ -652,7 +651,7 @@ sys_execve(struct proc *p, void *v, register_t *retval)
ktremul(p, p->p_emul->e_name);
#endif
- p->p_flag &= ~P_INEXEC;
+ atomic_clearbits_int(&p->p_flag, P_INEXEC);
#if NSYSTRACE > 0
if (ISSET(p->p_flag, P_SYSTRACE) &&
@@ -688,7 +687,7 @@ bad:
#if NSYSTRACE > 0
clrflag:
#endif
- p->p_flag &= ~P_INEXEC;
+ atomic_clearbits_int(&p->p_flag, P_INEXEC);
if (pathbuf != NULL)
pool_put(&namei_pool, pathbuf);
@@ -716,7 +715,7 @@ free_pack_abort:
exit1(p, W_EXITCODE(0, SIGABRT), EXIT_NORMAL);
/* NOTREACHED */
- p->p_flag &= ~P_INEXEC;
+ atomic_clearbits_int(&p->p_flag, P_INEXEC);
if (pathbuf != NULL)
pool_put(&namei_pool, pathbuf);
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 4c0a01cf19c..9823b41e223 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.62 2006/06/23 13:46:05 mickey Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.63 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -131,17 +131,17 @@ exit1(struct proc *p, int rv, int flags)
* we are one of the threads. we SIGKILL the parent,
* it will wake us up again, then we proceed.
*/
- p->p_thrparent->p_flag |= P_IGNEXITRV;
+ atomic_setbits_int(&p->p_thrparent->p_flag, P_IGNEXITRV);
p->p_thrparent->p_xstat = rv;
psignal(p->p_thrparent, SIGKILL);
tsleep(&p->p_thrparent->p_thrchildren, PUSER, "thrdying", 0);
} else if (p == p->p_thrparent) {
- p->p_flag |= P_WEXIT;
+ atomic_setbits_int(&p->p_flag, P_WEXIT);
if (flags == EXIT_NORMAL) {
q = LIST_FIRST(&p->p_thrchildren);
for (; q != NULL; q = nq) {
nq = LIST_NEXT(q, p_thrsib);
- q->p_flag |= P_IGNEXITRV;
+ atomic_setbits_int(&q->p_flag, P_IGNEXITRV);
q->p_xstat = rv;
psignal(q, SIGKILL);
}
@@ -159,10 +159,10 @@ exit1(struct proc *p, int rv, int flags)
* If parent is waiting for us to exit or exec, P_PPWAIT is set; we
* wake up the parent early to avoid deadlock.
*/
- p->p_flag |= P_WEXIT;
- p->p_flag &= ~P_TRACED;
+ atomic_setbits_int(&p->p_flag, P_WEXIT);
+ atomic_clearbits_int(&p->p_flag, P_TRACED);
if (p->p_flag & P_PPWAIT) {
- p->p_flag &= ~P_PPWAIT;
+ atomic_clearbits_int(&p->p_flag, P_PPWAIT);
wakeup(p->p_pptr);
}
p->p_sigignore = ~0;
@@ -258,7 +258,7 @@ exit1(struct proc *p, int rv, int flags)
* since their existence means someone is screwing up.
*/
if (q->p_flag & P_TRACED) {
- q->p_flag &= ~P_TRACED;
+ atomic_clearbits_int(&q->p_flag, P_TRACED);
psignal(q, SIGKILL);
}
}
@@ -523,7 +523,7 @@ loop:
}
if (p->p_stat == SSTOP && (p->p_flag & P_WAITED) == 0 &&
(p->p_flag & P_TRACED || SCARG(uap, options) & WUNTRACED)) {
- p->p_flag |= P_WAITED;
+ atomic_setbits_int(&p->p_flag, P_WAITED);
retval[0] = p->p_pid;
if (SCARG(uap, status)) {
@@ -535,7 +535,7 @@ loop:
return (error);
}
if ((SCARG(uap, options) & WCONTINUED) && (p->p_flag & P_CONTINUED)) {
- p->p_flag &= ~P_CONTINUED;
+ atomic_clearbits_int(&p->p_flag, P_CONTINUED);
retval[0] = p->p_pid;
if (SCARG(uap, status)) {
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index daa1303487a..d19608d9cbc 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.86 2007/01/17 13:51:52 mickey Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.87 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -238,9 +238,9 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
p2->p_emul = p1->p_emul;
if (p1->p_flag & P_PROFIL)
startprofclock(p2);
- p2->p_flag |= (p1->p_flag & (P_SUGID | P_SUGIDEXEC));
+ atomic_setbits_int(&p2->p_flag, p1->p_flag & (P_SUGID | P_SUGIDEXEC));
if (flags & FORK_PTRACE)
- p2->p_flag |= (p1->p_flag & P_TRACED);
+ atomic_setbits_int(&p2->p_flag, p1->p_flag & P_TRACED);
p2->p_cred = pool_get(&pcred_pool, PR_WAITOK);
bcopy(p1->p_cred, p2->p_cred, sizeof(*p2->p_cred));
p2->p_cred->p_refcnt = 1;
@@ -272,17 +272,17 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
}
if (p1->p_session->s_ttyvp != NULL && p1->p_flag & P_CONTROLT)
- p2->p_flag |= P_CONTROLT;
+ atomic_setbits_int(&p2->p_flag, P_CONTROLT);
if (flags & FORK_PPWAIT)
- p2->p_flag |= P_PPWAIT;
+ atomic_setbits_int(&p2->p_flag, P_PPWAIT);
p2->p_pptr = p1;
if (flags & FORK_NOZOMBIE)
- p2->p_flag |= P_NOZOMBIE;
+ atomic_setbits_int(&p2->p_flag, P_NOZOMBIE);
LIST_INIT(&p2->p_children);
#ifdef RTHREADS
if (flags & FORK_THREAD) {
- p2->p_flag |= P_THREAD;
+ atomic_setbits_int(&p2->p_flag, P_THREAD);
p2->p_thrparent = p1->p_thrparent;
} else {
p2->p_thrparent = p2;
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index e60176d611d..8452426fbc7 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_kthread.c,v 1.26 2006/11/29 12:24:17 miod Exp $ */
+/* $OpenBSD: kern_kthread.c,v 1.27 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */
/*-
@@ -83,7 +83,7 @@ kthread_create(void (*func)(void *), void *arg,
/*
* Mark it as a system process.
*/
- p2->p_flag |= P_SYSTEM;
+ atomic_setbits_int(&p2->p_flag, P_SYSTEM);
/* Name it as specified. */
va_start(ap, fmt);
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 1701c0ce7f2..d0b418a7b1f 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_lock.c,v 1.24 2007/02/14 00:53:48 jsg Exp $ */
+/* $OpenBSD: kern_lock.c,v 1.25 2007/03/15 10:22:30 art Exp $ */
/*
* Copyright (c) 1995
@@ -900,13 +900,13 @@ _kernel_proc_lock(struct proc *p)
{
SCHED_ASSERT_UNLOCKED();
__mp_lock(&kernel_lock);
- p->p_flag |= P_BIGLOCK;
+ atomic_setbits_int(&p->p_flag, P_BIGLOCK);
}
void
_kernel_proc_unlock(struct proc *p)
{
- p->p_flag &= ~P_BIGLOCK;
+ atomic_clearbits_int(&p->p_flag, P_BIGLOCK);
__mp_unlock(&kernel_lock);
}
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 5a11b8f6202..46b416d8507 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_proc.c,v 1.31 2005/12/22 06:55:03 tedu Exp $ */
+/* $OpenBSD: kern_proc.c,v 1.32 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
@@ -230,7 +230,7 @@ enterpgrp(struct proc *p, pid_t pgid, int mksess)
sess->s_ttyp = NULL;
bcopy(p->p_session->s_login, sess->s_login,
sizeof(sess->s_login));
- p->p_flag &= ~P_CONTROLT;
+ atomic_clearbits_int(&p->p_flag, P_CONTROLT);
pgrp->pg_session = sess;
#ifdef DIAGNOSTIC
if (p != curproc)
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index f3081e33740..f9e195364e9 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_prot.c,v 1.28 2005/12/03 18:09:08 tedu Exp $ */
+/* $OpenBSD: kern_prot.c,v 1.29 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */
/*
@@ -391,7 +391,7 @@ sys_setresuid(struct proc *p, void *v, register_t *retval)
if (suid != (uid_t)-1 && suid != pc->p_svuid)
pc->p_svuid = suid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
@@ -485,7 +485,7 @@ sys_setresgid(struct proc *p, void *v, register_t *retval)
if (sgid != (gid_t)-1)
pc->p_svgid = sgid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
@@ -594,7 +594,7 @@ sys_setuid(struct proc *p, void *v, register_t *retval)
*/
pc->pc_ucred = crcopy(pc->pc_ucred);
pc->pc_ucred->cr_uid = uid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
@@ -623,7 +623,7 @@ sys_seteuid(struct proc *p, void *v, register_t *retval)
*/
pc->pc_ucred = crcopy(pc->pc_ucred);
pc->pc_ucred->cr_uid = euid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
@@ -662,7 +662,7 @@ sys_setgid(struct proc *p, void *v, register_t *retval)
*/
pc->pc_ucred = crcopy(pc->pc_ucred);
pc->pc_ucred->cr_gid = gid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
@@ -691,7 +691,7 @@ sys_setegid(struct proc *p, void *v, register_t *retval)
*/
pc->pc_ucred = crcopy(pc->pc_ucred);
pc->pc_ucred->cr_gid = egid;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
@@ -718,7 +718,7 @@ sys_setgroups(struct proc *p, void *v, register_t *retval)
if (error)
return (error);
pc->pc_ucred->cr_ngroups = ngrp;
- p->p_flag |= P_SUGID;
+ atomic_setbits_int(&p->p_flag, P_SUGID);
return (0);
}
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index acc868830d8..43691c0c4c9 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.87 2007/02/06 18:42:37 art Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.88 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -288,9 +288,9 @@ setsigvec(struct proc *p, int signum, struct sigaction *sa)
ps->ps_catchmask[signum] = sa->sa_mask &~ sigcantmask;
if (signum == SIGCHLD) {
if (sa->sa_flags & SA_NOCLDSTOP)
- p->p_flag |= P_NOCLDSTOP;
+ atomic_setbits_int(&p->p_flag, P_NOCLDSTOP);
else
- p->p_flag &= ~P_NOCLDSTOP;
+ atomic_clearbits_int(&p->p_flag, P_NOCLDSTOP);
/*
* If the SA_NOCLDWAIT flag is set or the handler
* is SIG_IGN we reparent the dying child to PID 1
@@ -300,9 +300,9 @@ setsigvec(struct proc *p, int signum, struct sigaction *sa)
*/
if (p->p_pid != 1 && ((sa->sa_flags & SA_NOCLDWAIT) ||
sa->sa_handler == SIG_IGN))
- p->p_flag |= P_NOCLDWAIT;
+ atomic_setbits_int(&p->p_flag, P_NOCLDWAIT);
else
- p->p_flag &= ~P_NOCLDWAIT;
+ atomic_clearbits_int(&p->p_flag, P_NOCLDWAIT);
}
if ((sa->sa_flags & SA_RESETHAND) != 0)
ps->ps_sigreset |= bit;
@@ -403,7 +403,7 @@ execsigs(struct proc *p)
ps->ps_sigstk.ss_size = 0;
ps->ps_sigstk.ss_sp = 0;
ps->ps_flags = 0;
- p->p_flag &= ~P_NOCLDWAIT;
+ atomic_clearbits_int(&p->p_flag, P_NOCLDWAIT);
if (ps->ps_sigact[SIGCHLD] == SIG_IGN)
ps->ps_sigact[SIGCHLD] = SIG_DFL;
}
@@ -851,7 +851,7 @@ psignal(struct proc *p, int signum)
psignal(q, signum);
#endif
atomic_clearbits_int(&p->p_siglist, contsigmask);
- p->p_flag &= ~P_CONTINUED;
+ atomic_clearbits_int(&p->p_flag, P_CONTINUED);
}
atomic_setbits_int(&p->p_siglist, mask);
@@ -942,7 +942,7 @@ psignal(struct proc *p, int signum)
* an event, then it goes back to run state.
* Otherwise, process goes back to sleep state.
*/
- p->p_flag |= P_CONTINUED;
+ atomic_setbits_int(&p->p_flag, P_CONTINUED);
wakeup(p->p_pptr);
if (action == SIG_DFL)
atomic_clearbits_int(&p->p_siglist, mask);
@@ -1159,7 +1159,7 @@ proc_stop(struct proc *p)
#endif
p->p_stat = SSTOP;
- p->p_flag &= ~P_WAITED;
+ atomic_clearbits_int(&p->p_flag, P_WAITED);
wakeup(p->p_pptr);
}
@@ -1279,7 +1279,7 @@ void
sigexit(struct proc *p, int signum)
{
/* Mark process as going away */
- p->p_flag |= P_WEXIT;
+ atomic_setbits_int(&p->p_flag, P_WEXIT);
p->p_acflag |= AXSIG;
if (sigprop[signum] & SA_CORE) {
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index ae237fb2c92..22dd6d31f55 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.75 2006/11/29 12:24:17 miod Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.76 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -174,7 +174,7 @@ ltsleep(void *ident, int priority, const char *wmesg, int timo,
* stopped, p->p_wchan will be 0 upon return from CURSIG.
*/
if (catch) {
- p->p_flag |= P_SINTR;
+ atomic_setbits_int(&p->p_flag, P_SINTR);
if ((sig = CURSIG(p)) != 0) {
if (p->p_wchan)
unsleep(p);
@@ -204,9 +204,9 @@ resume:
#else
curpriority = p->p_usrpri;
#endif
- p->p_flag &= ~P_SINTR;
+ atomic_clearbits_int(&p->p_flag, P_SINTR);
if (p->p_flag & P_TIMEOUT) {
- p->p_flag &= ~P_TIMEOUT;
+ atomic_clearbits_int(&p->p_flag, P_TIMEOUT);
if (sig == 0) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
@@ -258,7 +258,7 @@ endtsleep(void *arg)
setrunnable(p);
else
unsleep(p);
- p->p_flag |= P_TIMEOUT;
+ atomic_setbits_int(&p->p_flag, P_TIMEOUT);
}
SCHED_UNLOCK(s);
}
diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c
index e12fee6d5d1..c5ca33402ee 100644
--- a/sys/kern/subr_prof.c
+++ b/sys/kern/subr_prof.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_prof.c,v 1.16 2006/12/24 20:28:43 miod Exp $ */
+/* $OpenBSD: subr_prof.c,v 1.17 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: subr_prof.c,v 1.12 1996/04/22 01:38:50 christos Exp $ */
/*-
@@ -201,6 +201,7 @@ addupc_intr(struct proc *p, u_long pc)
prof->pr_addr = pc;
prof->pr_ticks++;
+ atomic_setbits_int(&p->p_flag, P_OWEUPC);
need_proftick(p);
}
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 7192990a2b0..31cbafefff7 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.54 2006/04/15 20:02:19 miod Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.55 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -684,7 +684,7 @@ sys_select(struct proc *p, void *v, register_t *retval)
retry:
ncoll = nselcoll;
- p->p_flag |= P_SELECT;
+ atomic_setbits_int(&p->p_flag, P_SELECT);
error = selscan(p, pibits[0], pobits[0], nd, ni, retval);
if (error || *retval)
goto done;
@@ -702,13 +702,13 @@ retry:
splx(s);
goto retry;
}
- p->p_flag &= ~P_SELECT;
+ atomic_clearbits_int(&p->p_flag, P_SELECT);
error = tsleep(&selwait, PSOCK | PCATCH, "select", timo);
splx(s);
if (error == 0)
goto retry;
done:
- p->p_flag &= ~P_SELECT;
+ atomic_clearbits_int(&p->p_flag, P_SELECT);
/* select is not restarted after signals... */
if (error == ERESTART)
error = EINTR;
@@ -820,7 +820,7 @@ selwakeup(struct selinfo *sip)
else
unsleep(p);
} else if (p->p_flag & P_SELECT)
- p->p_flag &= ~P_SELECT;
+ atomic_clearbits_int(&p->p_flag, P_SELECT);
SCHED_UNLOCK(s);
}
}
@@ -907,7 +907,7 @@ sys_poll(struct proc *p, void *v, register_t *retval)
retry:
ncoll = nselcoll;
- p->p_flag |= P_SELECT;
+ atomic_setbits_int(&p->p_flag, P_SELECT);
pollscan(p, pl, nfds, retval);
if (*retval)
goto done;
@@ -925,14 +925,14 @@ retry:
splx(s);
goto retry;
}
- p->p_flag &= ~P_SELECT;
+ atomic_clearbits_int(&p->p_flag, P_SELECT);
error = tsleep(&selwait, PSOCK | PCATCH, "poll", timo);
splx(s);
if (error == 0)
goto retry;
done:
- p->p_flag &= ~P_SELECT;
+ atomic_clearbits_int(&p->p_flag, P_SELECT);
/*
* NOTE: poll(2) is not restarted after a signal and EWOULDBLOCK is
* ignored (since the whole point is to see what would block).
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index e60ff8b7ef7..188c581983d 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.37 2006/11/29 12:24:18 miod Exp $ */
+/* $OpenBSD: sys_process.c,v 1.38 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -231,7 +231,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
switch (SCARG(uap, req)) {
case PT_TRACE_ME:
/* Just set the trace flag. */
- SET(t->p_flag, P_TRACED);
+ atomic_setbits_int(&t->p_flag, P_TRACED);
t->p_oppid = t->p_pptr->p_pid;
if (t->p_ptstat == NULL)
t->p_ptstat = malloc(sizeof(*t->p_ptstat),
@@ -373,7 +373,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
/* not being traced any more */
t->p_oppid = 0;
- CLR(t->p_flag, P_TRACED|P_WAITED);
+ atomic_clearbits_int(&t->p_flag, P_TRACED|P_WAITED);
sendsig:
bzero(t->p_ptstat, sizeof(*t->p_ptstat));
@@ -408,7 +408,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
* proc gets to see all the action.
* Stop the target.
*/
- SET(t->p_flag, P_TRACED);
+ atomic_setbits_int(&t->p_flag, P_TRACED);
t->p_oppid = t->p_pptr->p_pid;
if (t->p_pptr != p)
proc_reparent(t, p);
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index c6c94bcbfff..5a8c65440c0 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.71 2006/06/17 00:47:16 deraadt Exp $ */
+/* $OpenBSD: tty.c,v 1.72 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -987,7 +987,7 @@ ttioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
tp->t_session = p->p_session;
tp->t_pgrp = p->p_pgrp;
p->p_session->s_ttyp = tp;
- p->p_flag |= P_CONTROLT;
+ atomic_setbits_int(&p->p_flag, P_CONTROLT);
break;
case TIOCSPGRP: { /* set pgrp of tty */
struct pgrp *pgrp = pgfind(*(int *)data);
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index 8723c197c41..e2a4b4accbb 100644
--- a/sys/kern/tty_tty.c
+++ b/sys/kern/tty_tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_tty.c,v 1.9 2005/12/21 12:43:49 jsg Exp $ */
+/* $OpenBSD: tty_tty.c,v 1.10 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: tty_tty.c,v 1.13 1996/03/30 22:24:46 christos Exp $ */
/*-
@@ -119,7 +119,7 @@ cttyioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
return (EINVAL);
if (cmd == TIOCNOTTY) {
if (!SESS_LEADER(p)) {
- p->p_flag &= ~P_CONTROLT;
+ atomic_clearbits_int(&p->p_flag, P_CONTROLT);
return (0);
} else
return (EINVAL);
diff --git a/sys/miscfs/procfs/procfs_ctl.c b/sys/miscfs/procfs/procfs_ctl.c
index 917691eb0f9..6644edb495b 100644
--- a/sys/miscfs/procfs/procfs_ctl.c
+++ b/sys/miscfs/procfs/procfs_ctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_ctl.c,v 1.19 2006/11/29 12:24:18 miod Exp $ */
+/* $OpenBSD: procfs_ctl.c,v 1.20 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: procfs_ctl.c,v 1.14 1996/02/09 22:40:48 christos Exp $ */
/*
@@ -137,7 +137,7 @@ procfs_control(curp, p, op)
* proc gets to see all the action.
* Stop the target.
*/
- p->p_flag |= P_TRACED;
+ atomic_setbits_int(&p->p_flag, P_TRACED);
p->p_xstat = 0; /* XXX ? */
if (p->p_pptr != curp) {
p->p_oppid = p->p_pptr->p_pid;
@@ -186,7 +186,7 @@ procfs_control(curp, p, op)
return (0);
/* not being traced any more */
- CLR(p->p_flag, P_TRACED);
+ atomic_clearbits_int(&p->p_flag, P_TRACED);
/* give process back to original parent */
if (p->p_oppid != p->p_pptr->p_pid) {
@@ -198,7 +198,7 @@ procfs_control(curp, p, op)
}
p->p_oppid = 0;
- CLR(p->p_flag, P_WAITED); /* XXX ? */
+ atomic_clearbits_int(&p->p_flag, P_WAITED);
wakeup(curp); /* XXX for CTL_WAIT below ? */
break;
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h
index 11c18faab39..a50c7cb87c2 100644
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: resourcevar.h,v 1.10 2006/12/24 20:28:44 miod Exp $ */
+/* $OpenBSD: resourcevar.h,v 1.11 2007/03/15 10:22:30 art Exp $ */
/* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */
/*
@@ -81,6 +81,7 @@ struct plimit {
/* add user profiling from AST */
#define ADDUPROF(p) \
do { \
+ atomic_clearbits_int(&(p)->p_flag, P_OWEUPC); \
addupc_task((p), (p)->p_stats->p_prof.pr_addr, \
(p)->p_stats->p_prof.pr_ticks); \
(p)->p_stats->p_prof.pr_ticks = 0; \
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 81460018e82..52b56f7bdba 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.83 2007/02/04 10:36:05 pedro Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.84 2007/03/15 10:22:30 art Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -5285,12 +5285,12 @@ request_cleanup(resource, islocked)
* to avoid recursively processing the worklist.
*/
if (num_on_worklist > max_softdeps / 10) {
- p->p_flag |= P_SOFTDEP;
+ atomic_setbits_int(&p->p_flag, P_SOFTDEP);
if (islocked)
FREE_LOCK(&lk);
process_worklist_item(NULL, LK_NOWAIT);
process_worklist_item(NULL, LK_NOWAIT);
- p->p_flag &= ~P_SOFTDEP;
+ atomic_clearbits_int(&p->p_flag, P_SOFTDEP);
stat_worklist_push += 2;
if (islocked)
ACQUIRE_LOCK(&lk);