diff --git a/sysdeps/solaris/ChangeLog b/sysdeps/solaris/ChangeLog index fb05754c..b9eb985a 100644 --- a/sysdeps/solaris/ChangeLog +++ b/sysdeps/solaris/ChangeLog @@ -1,3 +1,14 @@ +1999-05-04 Drazen Kacar + + * glibtop_machine.h: Changed boot time to unsigned long long. + + * open.c: Added proper type checking for boot value. There's + no point in saving a few nanoseconds in init function. And + one day it will become 64-bit value. + + In glibtop_get_kstats(): Don't reread vminfo_snaptime when + reinitializing kstats. + 1999-05-03 Drazen Kacar * glibtop_private.h: Fixed typoo. diff --git a/sysdeps/solaris/glibtop_machine.h b/sysdeps/solaris/glibtop_machine.h index 2d77471b..dc0e66fb 100644 --- a/sysdeps/solaris/glibtop_machine.h +++ b/sysdeps/solaris/glibtop_machine.h @@ -51,13 +51,13 @@ struct _glibtop_machine kstat_t *cpu_stat_kstat [64]; - kstat_t *system; /* boot_time & avenrun* where needed */ - kstat_t *syspages; /* memory usage */ - kstat_t *bunyip; /* more memory usage */ + kstat_t *system; /* boot_time & avenrun* where needed */ + kstat_t *syspages; /* memory usage */ + kstat_t *bunyip; /* more memory usage */ - int pagesize; /* in kilobytes */ - int ticks; /* clock ticks, as returned by sysconf(_SC_CLK_TCK) */ - unsigned boot; /* boot time, it's ui32 in kstat */ + int pagesize; /* in kilobytes */ + int ticks; /* clock ticks, as returned by sysconf() */ + unsigned long long boot; /* boot time, it's ui32 in kstat */ }; END_LIBGTOP_DECLS diff --git a/sysdeps/solaris/open.c b/sysdeps/solaris/open.c index 845478fe..78d1f59a 100644 --- a/sysdeps/solaris/open.c +++ b/sysdeps/solaris/open.c @@ -60,7 +60,9 @@ glibtop_get_kstats(glibtop *server) if(ksp) { kstat_read(kc, ksp, &server->machine.vminfo); - server->machine.vminfo_snaptime = ksp->ks_snaptime; + /* Don't change snaptime if we only need to reinitialize kstats */ + if(!(server->machine.vminfo_snaptime)) + server->machine.vminfo_snaptime = ksp->ks_snaptime; } /* We don't know why was kstat chain invalidated. It could have @@ -164,6 +166,7 @@ glibtop_open_s (glibtop *server, const char *program_name, glibtop_warn_io_r (server, "kstat_open ()"); server->ncpu = -1; /* Force processor detection */ + server->machine.vminfo_snaptime = 0; /* Force snaptime read */ glibtop_get_kstats(server); server->machine.boot = 0; @@ -171,7 +174,17 @@ glibtop_open_s (glibtop *server, const char *program_name, { kn = (kstat_named_t *)kstat_data_lookup(ksp, "boot_time"); if(kn) - server->machine.boot = kn->value.ui32; + switch(kn->data_type) + { + case KSTAT_DATA_INT32: server->machine.boot = kn->value.i32; + break; + case KSTAT_DATA_UINT32: server->machine.boot = kn->value.ui32; + break; + case KSTAT_DATA_INT64: server->machine.boot = kn->value.i64; + break; + case KSTAT_DATA_UINT64: server->machine.boot = kn->value.ui64; + break; + } } server->machine.kd = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);