if (new_q > MIN_USER_Q) new_q = MIN_USER_Q; /* shouldn't happen */
rmp->mp_max_priority = rmp->mp_priority = new_q;
- if ((r = sys_schedule(rmp->mp_priority, rmp->mp_priority,
- rmp->mp_time_slice)) != OK)
+ if ((r = schedule_process(rmp)))
return(r);
rmp->mp_nice = arg_pri;
_PROTOTYPE( int do_getsetpriority, (void) );
/* schedule.c */
+_PROTOTYPE( int schedule_process, (struct mproc * rmp) );
_PROTOTYPE( void do_noquantum, (void) );
_PROTOTYPE( void overtake_scheduling, (void) );
_PROTOTYPE( void balance_queues, (struct timer *tp) );
PRIVATE timer_t sched_timer;
+/*
+ * makes a kernel call that schedules the process using the actuall scheduling
+ * parameters set for this process
+ */
+PUBLIC int schedule_process(struct mproc * rmp)
+{
+ int err;
+
+ if ((err = sys_schedule(rmp->mp_endpoint, rmp->mp_priority,
+ rmp->mp_time_slice)) != OK) {
+ printf("PM: An error occurred when trying to schedule %s: %d\n",
+ rmp->mp_name, err);
+ }
+
+ return err;
+}
+
/*===========================================================================*
* do_noquantum *
*===========================================================================*/
rmp->mp_priority += 1; /* lower priority */
}
- if ((rv = sys_schedule(rmp->mp_endpoint, rmp->mp_priority,
- rmp->mp_time_slice))) {
- printf("PM: An error occurred when trying to schedule %s: %d\n",
- rmp->mp_name, rv);
- }
+ schedule_process(rmp);
}
/*===========================================================================*
if (rmp->mp_flags & IN_USE) {
if (rmp->mp_priority > rmp->mp_max_priority) {
rmp->mp_priority -= 1; /* increase priority */
- if ((rv = sys_schedule(rmp->mp_endpoint,
- rmp->mp_priority,
- rmp->mp_time_slice))) {
- printf("PM: An error occurred when balancing %s: %d\n",
- rmp->mp_name, rv);
- }
+ schedule_process(rmp);
}
}
}