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:
Martin Baulig
1998-08-18 13:42:16 +00:00
committed by Martin Baulig
parent 302b785893
commit 97902ce2dd
5 changed files with 118 additions and 44 deletions

View File

@@ -1,5 +1,11 @@
1998-08-18 Martin Baulig <martin@home-of-linux.org> 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.
* LIBGTOP-VERSION: Added `LIBGTOP_MICRO_VERSION'. * LIBGTOP-VERSION: Added `LIBGTOP_MICRO_VERSION'.
* libgtopConf.sh.in: Likewise. * libgtopConf.sh.in: Likewise.

View File

@@ -49,7 +49,7 @@ main (int argc, char *argv [])
#endif #endif
glibtop_proc_map procmap; glibtop_proc_map procmap;
glibtop_map_entry *maps; glibtop_map_entry *maps;
unsigned method, count, port, i, *ptr; unsigned method, count, port, i;
char buffer [BUFSIZ]; char buffer [BUFSIZ];
pid_t pid; pid_t pid;
@@ -92,27 +92,48 @@ main (int argc, char *argv [])
for (i = 0; i < procmap.number; i++) { for (i = 0; i < procmap.number; i++) {
const char *filename = NULL; 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 #ifdef GLIBTOP_INODEDB
if (inodedb) if (inodedb && !filename)
filename = glibtop_inodedb_lookup filename = glibtop_inodedb_lookup
(inodedb, maps [i].device, maps [i].inode); (inodedb, maps [i].device, maps [i].inode);
#endif #endif
if (filename) perm [0] = (maps [i].perm & GLIBTOP_MAP_PERM_READ) ? 'r' : '-';
fprintf (stderr, "%08x - %08x - %08lu - %08lu - %s\n", perm [1] = (maps [i].perm & GLIBTOP_MAP_PERM_WRITE) ? 'w' : '-';
(unsigned long) maps [i].start, perm [2] = (maps [i].perm & GLIBTOP_MAP_PERM_EXECUTE) ? 'x' : '-';
(unsigned long) maps [i].end, perm [3] = (maps [i].perm & GLIBTOP_MAP_PERM_SHARED) ? 's' : '-';
(unsigned long) maps [i].device, perm [4] = (maps [i].perm & GLIBTOP_MAP_PERM_PRIVATE) ? 'p' : '-';
(unsigned long) maps [i].inode,
filename);
else
fprintf (stderr, "%08x - %08x - %08lu - %08lu\n",
(unsigned long) maps [i].start,
(unsigned long) maps [i].end,
(unsigned long) maps [i].device,
(unsigned long) maps [i].inode);
device = (unsigned long) maps [i].device;
device_minor = (device & 255);
device_major = ((device >> 8) & 255);
if (filename)
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].offset,
device_major, device_minor,
(unsigned long) maps [i].inode,
perm, filename);
else
fprintf (stderr, "%08lx-%08lx %08lx - "
"%02x:%02x %08lu - %4s\n",
(unsigned long) maps [i].start,
(unsigned long) maps [i].end,
(unsigned long) maps [i].offset,
device_major, device_minor,
(unsigned long) maps [i].inode,
perm);
if (filename && (filename != maps [i].filename))
glibtop_free (filename); glibtop_free (filename);
} }

View File

@@ -33,13 +33,32 @@ __BEGIN_DECLS
#define GLIBTOP_MAX_PROC_MAP 3 #define GLIBTOP_MAX_PROC_MAP 3
#define GLIBTOP_MAP_ENTRY_START 1
#define GLIBTOP_MAP_ENTRY_END 2
#define GLIBTOP_MAP_ENTRY_OFFSET 3
#define GLIBTOP_MAP_ENTRY_PERM 4
#define GLIBTOP_MAP_ENTRY_INODE 5
#define GLIBTOP_MAP_ENTRY_DEVICE 6
#define GLIBTOP_MAP_ENTRY_FILENAME 7
#define GLIBTOP_MAX_MAP_ENTRY 8
#define GLIBTOP_MAP_FILENAME_LEN 215
#define GLIBTOP_MAP_PERM_READ 1
#define GLIBTOP_MAP_PERM_WRITE 2
#define GLIBTOP_MAP_PERM_EXECUTE 4
#define GLIBTOP_MAP_PERM_SHARED 8
#define GLIBTOP_MAP_PERM_PRIVATE 16
typedef struct _glibtop_map_entry glibtop_map_entry; typedef struct _glibtop_map_entry glibtop_map_entry;
typedef struct _glibtop_proc_map glibtop_proc_map; typedef struct _glibtop_proc_map glibtop_proc_map;
struct _glibtop_map_entry struct _glibtop_map_entry
{ {
u_int64_t start, end, offset, perm, inode, device; u_int64_t flags, start, end, offset, perm, inode, device;
char filename [GLIBTOP_MAP_FILENAME_LEN+1];
}; };
struct _glibtop_proc_map struct _glibtop_proc_map

View File

@@ -1,5 +1,5 @@
# Note that this is NOT a relocatable package # Note that this is NOT a relocatable package
%define ver 0.25pre1 %define ver 0.25.0
%define rel SNAP %define rel SNAP
%define prefix /usr %define prefix /usr
@@ -27,6 +27,10 @@ information from /dev/kmem or whatever.
%changelog %changelog
* Tue Aug 18 1998 Martin Baulig <martin@home-of-linux.org>
- released libgtop 0.25.0
* Sun Aug 16 1998 Martin Baulig <martin@home-of-linux.org> * Sun Aug 16 1998 Martin Baulig <martin@home-of-linux.org>
- first version of the RPM - first version of the RPM
@@ -37,9 +41,9 @@ information from /dev/kmem or whatever.
%build %build
# Needed for snapshot releases. # Needed for snapshot releases.
if [ ! -f configure ]; then if [ ! -f configure ]; then
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --without-linux-table CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --without-linux-table --without-libgtop-examples
else else
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --without-linux-table CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --without-linux-table --without-libgtop-examples
fi fi
if [ "$SMP" != "" ]; then if [ "$SMP" != "" ]; then

View File

@@ -24,7 +24,15 @@
#include <glibtop/xmalloc.h> #include <glibtop/xmalloc.h>
#include <glibtop/procmap.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. */ /* Init function. */
@@ -55,7 +63,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
do { do {
short dev_major, dev_minor; short dev_major, dev_minor;
unsigned long start, end, offset, inode; unsigned long start, end, offset, inode, perm;
char flags [5]; char flags [5];
size_t size; size_t size;
@@ -66,38 +74,54 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
flags [4] = 0; 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); fn [0] = fgetc (maps);
/* printf ("fn [0] '%c' %x\n", fn [0], fn [0]); */
if (fn [0] != '\n' && fn [0] != EOF) { if (fn [0] != '\n' && fn [0] != EOF) {
fscanf (maps, "%*[ ]%[^\n]\n", fn); fscanf (maps, "%*[ ]%[^\n]\n", fn);
/* row->filename = glibtop_strdup_r (server, fn); */
} /* else row->filename = NULL; */ } else fn [0] = 0;
/* if (rv != EOF) size = (n+1) * sizeof (glibtop_map_entry);
printf ("%08lx-%08lx %s\n",
row->VMstart, row->VMend,
row->filename); */
n++;
size = n * sizeof (glibtop_map_entry);
entry_list = glibtop_realloc_r (server, entry_list, size); entry_list = glibtop_realloc_r (server, entry_list, size);
entry_list [n-1].start = (u_int64_t) start; memset (&(entry_list [n]), 0, sizeof (glibtop_map_entry));
entry_list [n-1].end = (u_int64_t) end;
entry_list [n-1].offset = (u_int64_t) offset; entry_list [n].flags = _glibtop_sysdeps_map_entry;
entry_list [n-1].device = (u_int64_t) (dev_major << 8) +
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; (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); } while (rv != EOF && rv && fn [0] != EOF);
/* printf ("allocated: %d\n", i); */
fclose (maps); fclose (maps);
buf->number = n; buf->number = n;