diff options
author | wiz <wiz@pkgsrc.org> | 2001-07-17 10:48:06 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2001-07-17 10:48:06 +0000 |
commit | fdd133e4ec9b17709d2b897ce8d5f86e75de7426 (patch) | |
tree | 1df8b66f5c6e26908371faff43ea20115b7a3549 /devel/libgtop/patches | |
parent | 1860c8e900a82750920afaa95a7e6e714173017e (diff) | |
download | pkgsrc-fdd133e4ec9b17709d2b897ce8d5f86e75de7426.tar.gz |
Add patch to sysctl uptime out of kernel. Closes pkg/13046.
Diffstat (limited to 'devel/libgtop/patches')
-rw-r--r-- | devel/libgtop/patches/patch-as | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/devel/libgtop/patches/patch-as b/devel/libgtop/patches/patch-as new file mode 100644 index 00000000000..0979be7525c --- /dev/null +++ b/devel/libgtop/patches/patch-as @@ -0,0 +1,38 @@ +$NetBSD: patch-as,v 1.1 2001/07/17 10:48:06 wiz Exp $ + +--- sysdeps/freebsd/uptime.c.orig Thu May 27 16:04:16 1999 ++++ sysdeps/freebsd/uptime.c +@@ -49,6 +49,27 @@ + void + glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) + { ++#ifdef __NetBSD__ ++ time_t now; ++ time_t uptime; ++ int mib[2]; ++ struct timeval boottime; ++ size_t size; ++ ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_BOOTTIME; ++ size = sizeof(boottime); ++ if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && ++ boottime.tv_sec != 0) { ++ time(&now); ++ buf->uptime = now - boottime.tv_sec; ++ /* XXX: don't know a useful value to put here. */ ++ buf->idletime = 0; ++ buf->flags = _glibtop_sysdeps_uptime; ++ } ++#else ++ buf->flags = _glibtop_sysdeps_uptime; ++ + glibtop_cpu cpu; + + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0); +@@ -70,4 +91,5 @@ + buf->idletime = (double) cpu.idle / (double) cpu.frequency; + + buf->flags = _glibtop_sysdeps_uptime; ++#endif + } |