From 82ae91011fd667dd702053af5d7fd8ea09dbda60 Mon Sep 17 00:00:00 2001
From: Sebastian Geiger <sbastig@gmx.net>
Date: Sat, 26 May 2018 17:27:07 +0200
Subject: [PATCH] multiload: ignore priviledged mount points
fixes https://github.com/mate-desktop/mate-applets/issues/230
origin commit:
https://gitlab.gnome.org/GNOME/gnome-applets/commit/daadbbc
---
multiload/linux-proc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/multiload/linux-proc.c b/multiload/linux-proc.c
index 0e4624d..fcd48bf 100644
--- a/multiload/linux-proc.c
+++ b/multiload/linux-proc.c
@@ -1,6 +1,7 @@
/* From wmload.c, v0.9.2, licensed under the GPL. */
#include <config.h>
#include <sys/types.h>
+#include <sys/statvfs.h>
#include <math.h>
#include <fcntl.h>
#include <unistd.h>
@@ -119,6 +120,7 @@ GetDiskLoad (int Maximum, int data [3], LoadGraph *g)
for (i = 0; i < mountlist.number; i++)
{
+ struct statvfs statresult;
glibtop_fsusage fsusage;
if (strcmp(mountentries[i].type, "smbfs") == 0
@@ -126,6 +128,13 @@ GetDiskLoad (int Maximum, int data [3], LoadGraph *g)
|| strcmp(mountentries[i].type, "cifs") == 0)
continue;
+ if (statvfs (mountentries[i].mountdir, &statresult) < 0)
+ {
+ g_debug ("Failed to get statistics for mount entry: %s. Reason: %s. Skipping entry.",
+ mountentries[i].mountdir, strerror(errno));
+ continue;
+ }
+
glibtop_get_fsusage(&fsusage, mountentries[i].mountdir);
read += fsusage.read; write += fsusage.write;
}
--
2.17.2