]> Zhao Yanbai Git Server - minix.git/commitdiff
Fix RS warning at start-up by inheriting scdeduling properties from init for unprivil...
authorErik van der Kouwe <erik@minix3.org>
Fri, 16 Jul 2010 14:56:05 +0000 (14:56 +0000)
committerErik van der Kouwe <erik@minix3.org>
Fri, 16 Jul 2010 14:56:05 +0000 (14:56 +0000)
servers/pm/schedule.c

index 107e1c13a39742de6e40e30684968c899507b04a..aa0d0bdf8477726e8ea7f64b0ed88ca06ba40a47 100644 (file)
@@ -54,6 +54,7 @@ PUBLIC void sched_init(void)
 PUBLIC int sched_start_user(endpoint_t ep, struct mproc *rmp)
 {
        unsigned maxprio;
+       endpoint_t inherit_from;
        int rv;
 
        /* convert nice to priority */
@@ -61,10 +62,22 @@ PUBLIC int sched_start_user(endpoint_t ep, struct mproc *rmp)
                return rv;
        }
        
+       /* scheduler must know the parent, which is not the case for a child
+        * of a system process created by a regular fork; in this case the 
+        * scheduler should inherit settings from init rather than the real 
+        * parent
+        */
+       if (mproc[rmp->mp_parent].mp_flags & PRIV_PROC) {
+               assert(mproc[rmp->mp_parent].mp_scheduler == NONE);
+               inherit_from = INIT_PROC_NR;
+       } else {
+               inherit_from = mproc[rmp->mp_parent].mp_endpoint;
+       }
+       
        /* inherit quantum */
        return sched_inherit(ep,                        /* scheduler_e */
                rmp->mp_endpoint,                       /* schedulee_e */
-               mproc[rmp->mp_parent].mp_endpoint,      /* parent_e */
+               inherit_from,                           /* parent_e */
                maxprio,                                /* maxprio */
                &rmp->mp_scheduler);                    /* *newsched_e */
 }