diff options
author | Martin Baulig <martin@home-of-linux.org> | 1998-08-18 13:42:16 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1998-08-18 13:42:16 +0000 |
commit | 97902ce2dddfc138d9fcffd137ae7c95b3af6b7f (patch) | |
tree | 6e1eecbe2c0a5ed6cef5fe607ddf643ca39e2112 /examples/procmap.c | |
parent | 302b785893d89f2fdde1592e0993baf1d7563287 (diff) | |
download | libgtop-97902ce2dddfc138d9fcffd137ae7c95b3af6b7f.tar.gz |
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.
Diffstat (limited to 'examples/procmap.c')
-rw-r--r-- | examples/procmap.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/examples/procmap.c b/examples/procmap.c index 74b21d9f..f54d31f6 100644 --- a/examples/procmap.c +++ b/examples/procmap.c @@ -49,7 +49,7 @@ main (int argc, char *argv []) #endif glibtop_proc_map procmap; glibtop_map_entry *maps; - unsigned method, count, port, i, *ptr; + unsigned method, count, port, i; char buffer [BUFSIZ]; pid_t pid; @@ -92,28 +92,49 @@ main (int argc, char *argv []) for (i = 0; i < procmap.number; i++) { const char *filename = NULL; + unsigned device, device_major, device_minor; + char perm [5]; + + if (maps [i].flags & GLIBTOP_MAP_ENTRY_FILENAME) + filename = maps [i].filename; #ifdef GLIBTOP_INODEDB - if (inodedb) + if (inodedb && !filename) filename = glibtop_inodedb_lookup (inodedb, maps [i].device, maps [i].inode); #endif + perm [0] = (maps [i].perm & GLIBTOP_MAP_PERM_READ) ? 'r' : '-'; + perm [1] = (maps [i].perm & GLIBTOP_MAP_PERM_WRITE) ? 'w' : '-'; + perm [2] = (maps [i].perm & GLIBTOP_MAP_PERM_EXECUTE) ? 'x' : '-'; + perm [3] = (maps [i].perm & GLIBTOP_MAP_PERM_SHARED) ? 's' : '-'; + perm [4] = (maps [i].perm & GLIBTOP_MAP_PERM_PRIVATE) ? 'p' : '-'; + + device = (unsigned long) maps [i].device; + device_minor = (device & 255); + device_major = ((device >> 8) & 255); + if (filename) - fprintf (stderr, "%08x - %08x - %08lu - %08lu - %s\n", + fprintf (stderr, "%08lx-%08lx %08lx - " + "%02x:%02x %08lu - %4s - %s\n", (unsigned long) maps [i].start, (unsigned long) maps [i].end, - (unsigned long) maps [i].device, + (unsigned long) maps [i].offset, + device_major, device_minor, (unsigned long) maps [i].inode, - filename); + perm, filename); else - fprintf (stderr, "%08x - %08x - %08lu - %08lu\n", + fprintf (stderr, "%08lx-%08lx %08lx - " + "%02x:%02x %08lu - %4s\n", (unsigned long) maps [i].start, (unsigned long) maps [i].end, - (unsigned long) maps [i].device, - (unsigned long) maps [i].inode); + (unsigned long) maps [i].offset, + device_major, device_minor, + (unsigned long) maps [i].inode, + perm); - glibtop_free (filename); + if (filename && (filename != maps [i].filename)) + glibtop_free (filename); } glibtop_free (maps); |