summaryrefslogtreecommitdiff
path: root/sysdeps/linux/glibtop_server.h
diff options
context:
space:
mode:
authorBenoît Dejean <bdejean@src.gnome.org>2004-06-12 12:05:49 +0000
committerBenoît Dejean <bdejean@src.gnome.org>2004-06-12 12:05:49 +0000
commit10d56bd5fcb34689b1c91fe8153356219f8ffa2e (patch)
tree9ceb3b7e98f1b72311a8f77b54222c3cbbe1ad22 /sysdeps/linux/glibtop_server.h
parent70b0925a826828e2fb7b683258f9c66eeb10142d (diff)
downloadlibgtop-10d56bd5fcb34689b1c91fe8153356219f8ffa2e.tar.gz
Added to repository.
* Makefile.am: * glibtop_server.c: Added to repository. * glibtop_server.h: (get_scaled): Uninlined and moved it to glibtop_server.c. (skip_token) : Fixed indentation. * procmap.c: (glibtop_get_proc_map_s): Big cleanup. Better allocation algorithm. * procmem.c: * procsegment.c: Added missing initializations. * sem_limits.c: * shm_limits.c: (glibtop_get_shm_limits_s): * swap.c: * uptime.c: Added missing const qualifiers. * sysinfo.c: (init_sysinfo): Added missing 0 initialization. Saved 1 gboolean :D.
Diffstat (limited to 'sysdeps/linux/glibtop_server.h')
-rw-r--r--sysdeps/linux/glibtop_server.h27
1 files changed, 6 insertions, 21 deletions
diff --git a/sysdeps/linux/glibtop_server.h b/sysdeps/linux/glibtop_server.h
index e99af495..b1f3d7d6 100644
--- a/sysdeps/linux/glibtop_server.h
+++ b/sysdeps/linux/glibtop_server.h
@@ -24,6 +24,7 @@
#ifndef __GLIBTOP_SERVER_H__
#define __GLIBTOP_SERVER_H__
+
#include <fcntl.h>
#include <ctype.h>
@@ -36,8 +37,8 @@ G_BEGIN_DECLS
static inline char *
skip_token (const char *p)
{
- while (isspace(*p)) p++;
- while (*p && !isspace(*p)) p++;
+ while (isspace(*p)) p++;
+ while (*p && !isspace(*p)) p++;
return (char *)p;
}
@@ -57,25 +58,9 @@ skip_line (const char *p)
return (char *) (*p ? p+1 : p);
}
-static inline unsigned long long
-get_scaled(const char *buffer, const char *key)
-{
- const char *ptr;
- char *next;
- const size_t len = strlen(key);
- unsigned long long value = 0;
-
- if ((ptr = strstr(buffer, key)))
- {
- ptr += len;
- value = strtoull(ptr, &next, 0);
- if (strchr(next, 'k'))
- value *= 1024;
- else if (strchr(next, 'M'))
- value *= 1024 * 1024;
- }
- return value;
-}
+unsigned long long
+get_scaled(const char *buffer, const char *key);
+
static inline int
proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid)