Set version number to 0.25.0. There is now really a feature freeze until
1998-08-18 Martin Baulig <martin@home-of-linux.org> * LIBGTOP-VERSION: Set version number to 0.25.0. There is now really a feature freeze until it's released, bug fixes only ... * include/glibtop/procmap (glibtop_map_entry): Added `flags' and `filename' fields.
This commit is contained in:
committed by
Martin Baulig
parent
302b785893
commit
97902ce2dd
@@ -24,7 +24,15 @@
|
||||
#include <glibtop/xmalloc.h>
|
||||
#include <glibtop/procmap.h>
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
||||
static const unsigned long _glibtop_sysdeps_proc_map =
|
||||
(1 << GLIBTOP_PROC_MAP_NUMBER) + (1 << GLIBTOP_PROC_MAP_TOTAL) +
|
||||
(1 << GLIBTOP_PROC_MAP_SIZE);
|
||||
|
||||
static const unsigned long _glibtop_sysdeps_map_entry =
|
||||
(1 << GLIBTOP_MAP_ENTRY_START) + (1 << GLIBTOP_MAP_ENTRY_END) +
|
||||
(1 << GLIBTOP_MAP_ENTRY_OFFSET) + (1 << GLIBTOP_MAP_ENTRY_PERM) +
|
||||
(1 << GLIBTOP_MAP_ENTRY_INODE) + (1 << GLIBTOP_MAP_ENTRY_DEVICE) +
|
||||
(1 << GLIBTOP_MAP_ENTRY_FILENAME);
|
||||
|
||||
/* Init function. */
|
||||
|
||||
@@ -55,7 +63,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||
|
||||
do {
|
||||
short dev_major, dev_minor;
|
||||
unsigned long start, end, offset, inode;
|
||||
unsigned long start, end, offset, inode, perm;
|
||||
char flags [5];
|
||||
size_t size;
|
||||
|
||||
@@ -66,38 +74,54 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||
|
||||
flags [4] = 0;
|
||||
|
||||
/* Compute access permissions. */
|
||||
|
||||
perm = 0;
|
||||
|
||||
if (flags [0] == 'r')
|
||||
perm |= GLIBTOP_MAP_PERM_READ;
|
||||
if (flags [1] == 'w')
|
||||
perm |= GLIBTOP_MAP_PERM_WRITE;
|
||||
if (flags [2] == 'x')
|
||||
perm |= GLIBTOP_MAP_PERM_EXECUTE;
|
||||
if (flags [3] == 's')
|
||||
perm |= GLIBTOP_MAP_PERM_SHARED;
|
||||
if (flags [3] == 'p')
|
||||
perm |= GLIBTOP_MAP_PERM_PRIVATE;
|
||||
|
||||
/* Read filename. */
|
||||
|
||||
fn [0] = fgetc (maps);
|
||||
/* printf ("fn [0] '%c' %x\n", fn [0], fn [0]); */
|
||||
|
||||
if (fn [0] != '\n' && fn [0] != EOF) {
|
||||
|
||||
fscanf (maps, "%*[ ]%[^\n]\n", fn);
|
||||
/* row->filename = glibtop_strdup_r (server, fn); */
|
||||
|
||||
} /* else row->filename = NULL; */
|
||||
} else fn [0] = 0;
|
||||
|
||||
/* if (rv != EOF)
|
||||
printf ("%08lx-%08lx %s\n",
|
||||
row->VMstart, row->VMend,
|
||||
row->filename); */
|
||||
|
||||
n++;
|
||||
|
||||
size = n * sizeof (glibtop_map_entry);
|
||||
size = (n+1) * sizeof (glibtop_map_entry);
|
||||
|
||||
entry_list = glibtop_realloc_r (server, entry_list, size);
|
||||
|
||||
entry_list [n-1].start = (u_int64_t) start;
|
||||
entry_list [n-1].end = (u_int64_t) end;
|
||||
entry_list [n-1].offset = (u_int64_t) offset;
|
||||
entry_list [n-1].device = (u_int64_t) (dev_major << 8) +
|
||||
memset (&(entry_list [n]), 0, sizeof (glibtop_map_entry));
|
||||
|
||||
entry_list [n].flags = _glibtop_sysdeps_map_entry;
|
||||
|
||||
entry_list [n].start = (u_int64_t) start;
|
||||
entry_list [n].end = (u_int64_t) end;
|
||||
entry_list [n].offset = (u_int64_t) offset;
|
||||
entry_list [n].perm = (u_int64_t) perm;
|
||||
entry_list [n].device = (u_int64_t) (dev_major << 8) +
|
||||
(u_int64_t) dev_minor;
|
||||
entry_list [n-1].inode = (u_int64_t) inode;
|
||||
entry_list [n].inode = (u_int64_t) inode;
|
||||
|
||||
strncpy (entry_list [n].filename, fn, GLIBTOP_MAP_FILENAME_LEN);
|
||||
entry_list [n].filename [GLIBTOP_MAP_FILENAME_LEN] = 0;
|
||||
|
||||
n++;
|
||||
|
||||
} while (rv != EOF && rv && fn [0] != EOF);
|
||||
|
||||
/* printf ("allocated: %d\n", i); */
|
||||
|
||||
fclose (maps);
|
||||
|
||||
buf->number = n;
|
||||
|
Reference in New Issue
Block a user