. no more HZ
. let user processes query HZ . no more custom panic()
This commit is contained in:
parent
ccf70aa989
commit
2024bf0bcf
@ -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.
|
||||
*/
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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 *
|
||||
*===========================================================================*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user