--- linux/fs/proc/proc_misc.c.orig Fri Jun 6 12:13:44 2003 +++ linux/fs/proc/proc_misc.c Fri Jun 6 12:14:46 2003 @@ -51,6 +51,9 @@ #include #include +/* System boot time in seconds since the UNIX epoch. */ +static time_t boottime; + #define LOAD_INT(x) ((x) >> FSHIFT) #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) /* @@ -378,7 +381,6 @@ { int i, len; extern unsigned long total_forks; - u64 jif = get_jiffies_64() - INITIAL_JIFFIES; unsigned int sum = 0, user = 0, nice = 0, system = 0, idle = 0, iowait = 0; for (i = 0 ; i < NR_CPUS; i++) { @@ -419,15 +421,14 @@ len += sprintf(page + len, " %u", kstat_irqs(i)); #endif - do_div(jif, HZ); len += sprintf(page + len, "\nctxt %lu\n" - "btime %lu\n" + "btime %ld\n" "processes %lu\n" "procs_running %lu\n" "procs_blocked %lu\n", nr_context_switches(), - xtime.tv_sec - (unsigned long) jif, + boottime, total_forks, nr_running(), nr_iowait()); @@ -612,6 +613,7 @@ void __init proc_misc_init(void) { + u64 jif = get_jiffies_64() - INITIAL_JIFFIES; struct proc_dir_entry *entry; static struct { char *name; @@ -638,6 +640,10 @@ {"execdomains", execdomains_read_proc}, {NULL,} }; + + /* Intialise system boot time before creating /proc/stat entry. */ + do_div(jif, HZ); + boottime = xtime.tv_sec - (time_t)jif; for (p = simple_ones; p->name; p++) create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL);