pkgsrc/sysutils/gkrellm/patches/patch-aa

68 lines
2 KiB
Text

$NetBSD: patch-aa,v 1.18 2008/12/19 21:25:28 macallan Exp $
--- src/sysdeps/bsd-common.c.orig 2006-03-29 17:23:37.000000000 -0500
+++ src/sysdeps/bsd-common.c
@@ -23,7 +23,7 @@
*/
#if !(defined(__FreeBSD__) && __FreeBSD_version < 410000) && \
- !(defined(__NetBSD__) && __NetBSD_version < 105000000) && \
+ !(defined(__NetBSD__) && __NetBSD_Version__ < 105000000) && \
!(defined(__OpenBSD__) && OpenBSD < 200006) && \
!defined(__APPLE__)
#define HAVE_GETIFADDRS 1
@@ -52,6 +52,8 @@ gkrellm_sys_net_read_data(void)
if (ifa->ifa_addr->sa_family != AF_LINK)
continue;
ifd = (struct if_data *)ifa->ifa_data;
+ if (ifd == NULL)
+ continue;
gkrellm_net_assign_data(ifa->ifa_name,
ifd->ifi_ibytes, ifd->ifi_obytes);
}
@@ -255,7 +257,11 @@ void
gkrellm_sys_fs_get_mounts_list(void)
{
gchar *s, *dev, *dir, *type;
+#if (defined(__NetBSD__) && __NetBSD_Version__ >= 299000900) /* NetBSD 2.99.9 */
+ struct statvfs *mntbuf;
+#else
struct statfs *mntbuf;
+#endif
gint mntsize, i;
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
@@ -281,12 +287,24 @@ gkrellm_sys_fs_get_mounts_list(void)
void
gkrellm_sys_fs_get_fsusage(gpointer fs, gchar *dir)
{
+#if (defined(__NetBSD__) && __NetBSD_Version__ >= 299000900) /* NetBSD 2.99.9 */
+ struct statvfs st;
+#else
struct statfs st;
+#endif
+#if (defined(__NetBSD__) && __NetBSD_Version__ >= 299000900) /* NetBSD 2.99.9 */
+ if (!statvfs(dir, &st))
+#else
if (!statfs(dir, &st))
+#endif
gkrellm_fs_assign_fsusage_data(fs,
(glong) st.f_blocks, (glong) st.f_bavail,
+#if (defined(__NetBSD__) && __NetBSD_Version__ >= 299000900) /* NetBSD 2.99.9 */
+ (glong) st.f_bfree, (glong) st.f_frsize);
+#else
(glong) st.f_bfree, (glong) st.f_bsize);
+#endif
else
gkrellm_fs_assign_fsusage_data(fs, 0, 0, 0, 0);
}
@@ -345,7 +363,7 @@ gkrellm_sys_fs_init(void)
}
#endif
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
gboolean
gkrellm_sys_fs_init(void)
{