I am trying to modify the sched server and have been attempting to have it print out some information to stdout or stderr but without luck. I tried printf, fprintf, sprintf, puts, fputs. Any ideas on how I should do this? I am starting to think that for whatever reason it's not possible to have the server print something out even though it has printfs in it.
I tried adding these in schdule_process, start_scheduling and balance_queues.
#include <stdio.h>
static void balance_queues(minix_timer_t *tp)
{
struct schedproc *rmp;
int proc_nr;
printf("Test prinf\n");
fprintf(stdout, "Test fprintf stdout\n");
fprintf(stderr, "Test fprintf stderr\n");
puts("Test puts\n");
fputs("Test fputs stdout", stdout);
fputs("Test fputs stderr", stderr);
for (proc_nr=0, rmp=schedproc; proc_nr < NR_PROCS; proc_nr++, rmp++) {
if (rmp->flags & IN_USE) {
if (rmp->priority > rmp->max_priority) {
rmp->priority -= 1; /* increase priority */
schedule_process_local(rmp);
}
}
}
set_timer(&sched_timer, balance_timeout, balance_queues, 0);
}
Here's the balance_queues function I tried. I am pretty sure this is not a problem with my code instead something with minix which I don't yet understand. I've spend the last 2 hours reading and searching Tanenbaums and Woodhulls "The Minix book - Operating Systems, design and implementation" third edition but couldn't find anything. From what I understand this function should be called every 5 seconds to balance the queues but I there's nothing being printed to the command line!