Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gnome System Monitor needing root for disk graph
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Oxydius
n00b
n00b


Joined: 18 Jan 2007
Posts: 8

PostPosted: Thu Mar 08, 2007 10:00 am    Post subject: Gnome System Monitor needing root for disk graph Reply with quote

I can't get System Monitor to display the disk usage graph. However, when logged in X as root, it displays fine.

Does someone know where System Monitor fetches the information, and if setting a permission is required for users?
Back to top
View user's profile Send private message
mark_alec
Bodhisattva
Bodhisattva


Joined: 11 Sep 2004
Posts: 6066
Location: Melbourne, Australia

PostPosted: Sun Mar 11, 2007 3:59 am    Post subject: Reply with quote

I don't use Gnome, but I am guessing it gets its information from hal. Try adding your user to the 'haldaemon' group `gpasswd -a <user> haldaemon`
_________________
www.gentoo.org.au || #gentoo-au
Back to top
View user's profile Send private message
Oxydius
n00b
n00b


Joined: 18 Jan 2007
Posts: 8

PostPosted: Sun Mar 11, 2007 7:23 am    Post subject: Reply with quote

I made a mistake when I noticed I/O in the System Monitor applet as root. I was probably using a non-RAID device at that time, because the problem is that System Monitor doesn't pick up I/O from RAID (MD) devices. The problem lies in the gnome-base/libgtop package, which reads the wrong fields of the /sys/block/md*/stat files.

I submitted a patch upstream, but for anyone who stumbles upon this post looking for a temporary solution, here's my patch :

Code:
--- fsusage.c   2007-03-10 23:01:33.000000000 -0800
+++ fsusage3.c  2007-03-11 19:56:33.000000000 -0700
@@ -63,7 +63,7 @@
 
 static char *
-get_sys_path(const char *device)
+get_sys_path(const char *device, int* subdev)
 {
        if(g_str_has_prefix(device, "hd") || g_str_has_prefix(device, "sd"))
        {
@@ -80,11 +80,14 @@
                                       prefix, device);
 
                g_free(prefix);
+
+               *subdev = 1;
                return path;
 
        }
        else
        {
+               *subdev = 0;
                return g_strdup_printf("/sys/block/%s/stat", device);
        }
 }
@@ -97,12 +100,12 @@
        char *filename;
        int ret;
        char buffer[BUFSIZ];
-       char *p;
+       int subdev;
 
        device = get_partition(path);
        if(!device) return;
 
-       filename = get_sys_path(device);
+       filename = get_sys_path(device, &subdev);
        g_free(device);
 
        ret = try_file_to_buffer(buffer, filename);
@@ -110,12 +113,11 @@
 
        if(ret < 0) return;
 
-       p = buffer;
-       p = skip_token(p);
-       buf->read = strtoull(p, &p, 0);
-       p = skip_token(p);
-       buf->write = strtoull(p, &p, 0);
-
+       if (subdev)
+               sscanf(buffer, "%*u %u %*u %u", &buf->read, &buf->write);
+       else
+               sscanf(buffer, "%*u %*u %u %*u %*u %*u %u", &buf->read, &buf->write);
+
        buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
 }
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum