Made some checks solaris only.

* configure.in: Made some checks solaris only.
This commit is contained in:
Benoît Dejean
2005-07-05 23:05:20 +00:00
parent efeca4a865
commit b6a10fd8f7
5 changed files with 52 additions and 31 deletions

View File

@@ -96,3 +96,20 @@ file_to_buffer(glibtop *server, char *buffer, const char *filename)
}
unsigned long
get_boot_time(glibtop *server)
{
char buffer[BUFSIZ];
char *btime;
file_to_buffer(server, buffer, "/proc/stat");
btime = strstr(buffer, "btime");
g_return_val_if_fail(btime != NULL, 0UL);
btime = skip_token(btime);
return strtoul(btime, NULL, 10);
}

View File

@@ -111,6 +111,12 @@ proc_stat_after_cmd (char *p)
*p++ = '\0';
return p;
}
unsigned long
get_boot_time(glibtop *server) G_GNUC_INTERNAL;
G_END_DECLS
#endif /* __LINUX__GLIBTOP_PRIVATE_H__ */

View File

@@ -87,11 +87,7 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
/* seconds since epoch */
{
/* Linux provides start_time as clock_t representing
the start of <pid> after boot_time.
Let's use glibtop_get_uptime to get boot_time.
But i'm not sure if this is safe
/*
See libgtop documentation.
#ifdef __KERNEL__
@@ -109,10 +105,7 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
system clock is not synchronised with you hardware clock.
'man hwclock'
*/
glibtop_uptime up;
glibtop_get_uptime_s(server, &up);
buf->start_time = up.boot_time + strtoull (p, &p, 0) / 100;
buf->start_time = get_boot_time(server) + strtoull (p, &p, 0) / 100;
}
buf->frequency = 100;

View File

@@ -57,7 +57,7 @@ glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
buf->uptime = g_ascii_strtod (buffer, &p);
buf->idletime = g_ascii_strtod (p, &p);
buf->boot_time = (guint64) time(NULL) - (guint64) buf->uptime;
buf->boot_time = get_boot_time(server);
buf->flags = _glibtop_sysdeps_uptime;
}