[libgtop/wip/diskio] Set glibtop_proc_diskio.flags. Check linux version code before reading /proc/PID/io.



commit 1defc74f078d77cf3e22b425de5425666c4e8087
Author: Benoît Dejean <bdejean gmail com>
Date:   Tue Feb 21 12:50:37 2017 +0100

    Set glibtop_proc_diskio.flags.
    Check linux version code before reading /proc/PID/io.

 sysdeps/linux/procdiskio.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/sysdeps/linux/procdiskio.c b/sysdeps/linux/procdiskio.c
index fba687f..08bd553 100644
--- a/sysdeps/linux/procdiskio.c
+++ b/sysdeps/linux/procdiskio.c
@@ -46,6 +46,8 @@ glibtop_get_proc_diskio_s (glibtop *server, glibtop_proc_diskio *buf, pid_t pid)
        char buffer [BUFSIZ], *p;
     memset (buf, 0, sizeof (glibtop_proc_diskio));
 
+    if (server->os_version_code < LINUX_VERSION_CODE(2, 6, 20))
+      return;
 
        if (proc_file_to_buffer(buffer, sizeof buffer, "/proc/%d/io", pid))
                return;
@@ -63,4 +65,6 @@ glibtop_get_proc_diskio_s (glibtop *server, glibtop_proc_diskio *buf, pid_t pid)
     p = skip_line (p);
     p = skip_token (p);
     buf->wbytes = g_ascii_strtoull (p, &p, 10);    
+
+    buf->flags = _glibtop_sysdeps_proc_diskio;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]