Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern - proc_alloc() already initializes p_stat to SIDL.



details:   https://anonhg.NetBSD.org/src/rev/c547bd37ccca
branches:  trunk
changeset: 570018:c547bd37ccca
user:      enami <enami%NetBSD.org@localhost>
date:      Fri Sep 17 23:20:21 2004 +0000

description:
- proc_alloc() already initializes p_stat to SIDL.
- copy unconditionaly inherited p_flag bits in a single place.

diffstat:

 sys/kern/kern_fork.c |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r 2847aa787ba7 -r c547bd37ccca sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c      Fri Sep 17 23:13:02 2004 +0000
+++ b/sys/kern/kern_fork.c      Fri Sep 17 23:20:21 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_fork.c,v 1.118 2004/08/08 11:02:10 jdolecek Exp $ */
+/*     $NetBSD: kern_fork.c,v 1.119 2004/09/17 23:20:21 enami Exp $    */
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.118 2004/08/08 11:02:10 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.119 2004/09/17 23:20:21 enami Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_systrace.h"
@@ -290,8 +290,9 @@
         * Duplicate sub-structures as needed.
         * Increase reference counts on shared objects.
         * The p_stats and p_sigacts substructs are set in uvm_fork().
+        * Inherit SUGID, STOPFORK and STOPEXEC flags.
         */
-       p2->p_flag = (p1->p_flag & P_SUGID);
+       p2->p_flag = p1->p_flag & (P_SUGID | P_STOPFORK | P_STOPEXEC);
        p2->p_emul = p1->p_emul;
        p2->p_execsw = p1->p_execsw;
 
@@ -339,9 +340,6 @@
                p2->p_limit = p1->p_limit;
        }
 
-       /* Inherit STOPFORK and STOPEXEC flags */
-       p2->p_flag |= p1->p_flag & (P_STOPFORK | P_STOPEXEC);
-
        if (p1->p_session->s_ttyvp != NULL && p1->p_flag & P_CONTROLT)
                p2->p_flag |= P_CONTROLT;
        if (flags & FORK_PPWAIT)
@@ -410,7 +408,6 @@
 
        /* Now safe for scheduler to see child process */
        s = proclist_lock_write();
-       p2->p_stat = SIDL;                      /* protect against others */
        p2->p_exitsig = exitsig;                /* signal for parent on exit */
        LIST_INSERT_HEAD(&allproc, p2, p_list);
        proclist_unlock_write(s);



Home | Main Index | Thread Index | Old Index