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)
This commit is contained in:
committed by
Bastien Nocera
parent
b2283f7c79
commit
33fb22edd3
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user