summaryrefslogtreecommitdiff
path: root/sysdeps/linux/glibtop_server.h
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2003-10-20 20:41:16 +0000
committerBastien Nocera <hadess@src.gnome.org>2003-10-20 20:41:16 +0000
commit33fb22edd351c50884b273b39d1ba54835420e58 (patch)
tree6891542ca8a3bd9605686cf861b3dcc7b4fa30d1 /sysdeps/linux/glibtop_server.h
parentb2283f7c79c0291901c1ea616190e4befd544767 (diff)
downloadlibgtop-33fb22edd351c50884b273b39d1ba54835420e58.tar.gz
committing patch from Sebastien Bacher <seb128@debian.org> for Linux 2.6
2003-10-20 Bastien Nocera <hadess@hadess.net> * glibtop_server.h: * mem.c: (glibtop_get_mem_s): * swap.c: (glibtop_get_swap_s): committing patch from Sebastien Bacher <seb128@debian.org> for Linux 2.6 support (Closes: #104747)
Diffstat (limited to 'sysdeps/linux/glibtop_server.h')
-rw-r--r--sysdeps/linux/glibtop_server.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sysdeps/linux/glibtop_server.h b/sysdeps/linux/glibtop_server.h
index 924747e7..4ff62746 100644
--- a/sysdeps/linux/glibtop_server.h
+++ b/sysdeps/linux/glibtop_server.h
@@ -57,6 +57,25 @@ skip_line (const char *p)
return (char *) ++p;
}
+static inline unsigned long
+get_scaled(const char *buffer, const char *key)
+{
+ const char *ptr;
+ char *next;
+ unsigned long value = 0;
+
+ if ((ptr = strstr(buffer, key)))
+ {
+ ptr += strlen(key);
+ value = strtoul(ptr, &next, 0);
+ if (strchr(next, 'k'))
+ value *= 1024;
+ else if (strchr(next, 'M'))
+ value *= 1024 * 1024;
+ }
+ return value;
+}
+
static inline int
proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid)
{