summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-03-15 10:22:31 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-03-15 10:22:31 +0000
commitbd2b614cddbdb963198fdd15728e067d209f3cf7 (patch)
tree1710a23e5d69760e81f4955e44aac6e49a944b07 /sys/kern/kern_fork.c
parentb93b6840228d38589b6e976f3a325539c4fc9ae0 (diff)
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
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c14
1 files changed, 7 insertions, 7 deletions
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;