From: Ben Gras Date: Thu, 11 Dec 2008 14:49:17 +0000 (+0000) Subject: . no more HZ X-Git-Tag: v3.1.4~186 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/dnssec-revoke.html?a=commitdiff_plain;h=2024bf0bcf75b770354343929e2c5dcdc36727be;p=minix.git . no more HZ . let user processes query HZ . no more custom panic() --- diff --git a/servers/pm/glo.h b/servers/pm/glo.h index 6485c1679..b9adae444 100644 --- a/servers/pm/glo.h +++ b/servers/pm/glo.h @@ -26,6 +26,7 @@ EXTERN sigset_t ign_sset; /* which signals are by default ignored */ EXTERN time_t boottime; /* time when the system was booted (for * reporting to FS) */ +EXTERN u32_t system_hz; /* System clock frequency. */ EXTERN int report_reboot; /* During reboot to report to FS that we are * rebooting. */ diff --git a/servers/pm/main.c b/servers/pm/main.c index 8f603a7b9..208dca355 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -342,6 +342,8 @@ PRIVATE void pm_init() #endif if(f > 0) printf("PM: failed to register %d processes with DS.\n", f); + + system_hz = sys_hz(); } /*===========================================================================* diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 4e380cc58..77d4ff239 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -72,9 +72,6 @@ PUBLIC int do_allocmem() r = vm_allocmem(m_in.memsize, &retmembase); if(r == OK) mp->mp_reply.membase = retmembase; -#if 0 - printf("PM: do_allocmem: %d\n", r); -#endif return r; } @@ -282,6 +279,10 @@ PUBLIC int do_getsysinfo_up() src_addr = (vir_bytes) &loadinfo; real_len = sizeof(struct loadinfo); break; + case SIU_SYSTEMHZ: + src_addr = (vir_bytes) &system_hz; + real_len = sizeof(system_hz); + break; default: return(EINVAL); } diff --git a/servers/pm/signal.c b/servers/pm/signal.c index db3f288ad..23c2cb4d1 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -325,7 +325,7 @@ int sec; /* how many seconds delay before the signal */ if ( (s=getuptime(&uptime)) != OK) panic(__FILE__,"set_alarm couldn't get uptime", s); exptime = *tmr_exp_time(&mproc[proc_nr_n].mp_timer); - remaining = (int) ((exptime - uptime + (HZ-1))/HZ); + remaining = (int) ((exptime - uptime + (system_hz-1))/system_hz); if (remaining < 0) remaining = 0; } else { remaining = 0; @@ -347,8 +347,8 @@ int sec; /* how many seconds delay before the signal */ * this be declared properly without combinatorial explosion of message * types? */ - ticks = (clock_t) (HZ * (unsigned long) (unsigned) sec); - if ( (unsigned long) ticks / HZ != (unsigned) sec) + ticks = (clock_t) (system_hz * (unsigned long) (unsigned) sec); + if ( (unsigned long) ticks / system_hz != (unsigned) sec) ticks = LONG_MAX; /* eternity (really TMR_NEVER) */ if (ticks != 0) { diff --git a/servers/pm/time.c b/servers/pm/time.c index fe59cd676..2bbb28406 100644 --- a/servers/pm/time.c +++ b/servers/pm/time.c @@ -29,8 +29,8 @@ PUBLIC int do_time() if ( (s=getuptime(&uptime)) != OK) panic(__FILE__,"do_time couldn't get uptime", s); - mp->mp_reply.reply_time = (time_t) (boottime + (uptime/HZ)); - mp->mp_reply.reply_utime = (uptime%HZ)*1000000/HZ; + mp->mp_reply.reply_time = (time_t) (boottime + (uptime/system_hz)); + mp->mp_reply.reply_utime = (uptime%system_hz)*1000000/system_hz; return(OK); } @@ -51,7 +51,7 @@ PUBLIC int do_stime() } if ( (s=getuptime(&uptime)) != OK) panic(__FILE__,"do_stime couldn't get uptime", s); - boottime = (long) m_in.stime - (uptime/HZ); + boottime = (long) m_in.stime - (uptime/system_hz); s= sys_stime(boottime); /* Tell kernel about boottime */ if (s != OK) diff --git a/servers/pm/utility.c b/servers/pm/utility.c index 405c7fdc8..ef751582d 100644 --- a/servers/pm/utility.c +++ b/servers/pm/utility.c @@ -63,27 +63,6 @@ PUBLIC int no_sys() return(ENOSYS); } -/*===========================================================================* - * panic * - *===========================================================================*/ -PUBLIC void panic(who, mess, num) -char *who; /* who caused the panic */ -char *mess; /* panic message string */ -int num; /* number to go with it */ -{ -/* An unrecoverable error has occurred. Panics are caused when an internal - * inconsistency is detected, e.g., a programming error or illegal value of a - * defined constant. The process manager decides to exit. - */ - printf("PM panic (%s): %s", who, mess); - if (num != NO_NUM) printf(": %d",num); - printf("\n"); - - /* Exit PM. */ - sys_exit(SELF); -} - - /*===========================================================================* * find_param * *===========================================================================*/