From: Ben Gras Date: Fri, 5 Aug 2005 12:44:06 +0000 (+0000) Subject: Merged do_gettimeofday with do_time to save one function call; X-Git-Tag: v3.1.0~436 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mult.png?a=commitdiff_plain;h=abb7157175fb70b5ea8546601e22c73978dec7be;p=minix.git Merged do_gettimeofday with do_time to save one function call; adjusted table.c accordingly --- diff --git a/servers/pm/exec.c b/servers/pm/exec.c index d9e6941d0..108cb6349 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -378,34 +378,6 @@ phys_bytes tot_bytes; /* total memory to allocate, including gap */ panic(__FILE__,"new_mem can't zero", s); } -#define ENABLE_USAGE_TEST 0 -#if ENABLE_USAGE_TEST - /* Junk-fill gap and stack. - * Mind the gap.. - */ - { - static int pat = 1; - if ((s=sys_memset(pat++ & 0xff, - (rmp->mp_seg[D].mem_phys + rmp->mp_seg[D].mem_len) << CLICK_SHIFT, - (gap_clicks + stack_clicks) << CLICK_SHIFT)) != OK) { - panic(__FILE__,"can't junk-fill", s); - } - } -#endif - -#if DEAD_CODE - while (bytes > 0) { - static char zero[1024]; /* used to zero bss */ - count = MIN(bytes, (phys_bytes) sizeof(zero)); - if ((s=sys_physcopy(PM_PROC_NR, D, (phys_bytes) zero, - NONE, PHYS_SEG, base, count)) != OK) { - panic(__FILE__,"new_mem can't zero", s); - } - base += count; - bytes -= count; - } -#endif - return(OK); } diff --git a/servers/pm/param.h b/servers/pm/param.h index 839e1c85c..15b0e4fd2 100644 --- a/servers/pm/param.h +++ b/servers/pm/param.h @@ -45,6 +45,7 @@ #define reply_mask m2_l1 #define reply_trace m2_l2 #define reply_time m2_l1 +#define reply_utime m2_l2 #define reply_t1 m4_l1 #define reply_t2 m4_l2 #define reply_t3 m4_l3 diff --git a/servers/pm/table.c b/servers/pm/table.c index d38d6126c..075b12863 100644 --- a/servers/pm/table.c +++ b/servers/pm/table.c @@ -106,7 +106,7 @@ _PROTOTYPE (int (*call_vec[NCALLS]), (void) ) = { no_sys, /* 87 = fsync */ do_getsetpriority, /* 88 = getpriority */ do_getsetpriority, /* 89 = setpriority */ - do_gettimeofday, /* 90 = gettimeofday */ + do_time, /* 90 = gettimeofday */ }; /* This should not fail with "array size is negative": */ extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1]; diff --git a/servers/pm/time.c b/servers/pm/time.c index d753f2208..6e0bfcffd 100644 --- a/servers/pm/time.c +++ b/servers/pm/time.c @@ -33,6 +33,7 @@ PUBLIC int do_time() 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; return(OK); } @@ -84,20 +85,3 @@ PUBLIC int do_times() return(OK); } -/*===========================================================================* - * do_gettimeofday * - *===========================================================================*/ -PUBLIC int do_gettimeofday(void) -{ - clock_t uptime; - int s; - - if ( (s=getuptime(&uptime)) != OK) - panic(__FILE__,"do_gettimeofday couldn't get uptime", s); - - mp->mp_reply.m2_l1 = boottime + uptime/HZ; - mp->mp_reply.m2_l2 = (uptime%HZ)*1000000/HZ; - - return(OK); -} -