The indentation in LibGTop was done with the following command:

find . -name \*.[ch] | xargs -i emacs -batch {} \
		-l /gnome/compile/libgtop/misc/format.el -f save-buffer

December 26, 1999
Martin
This commit is contained in:
Martin Baulig
1999-12-26 14:05:32 +00:00
parent d7f088bef0
commit f1a6e1ead8
272 changed files with 6300 additions and 5751 deletions

View File

@@ -1,3 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
@@ -41,9 +43,9 @@ static const unsigned long _glibtop_sysdeps_map_entry =
int
glibtop_init_proc_map_s (glibtop *server)
{
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
return 0;
return 0;
}
/* Provides detailed information about a process. */
@@ -51,90 +53,90 @@ glibtop_init_proc_map_s (glibtop *server)
glibtop_map_entry *
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
{
char fn [BUFSIZ];
glibtop_map_entry *entry_list = NULL;
int rv, n = 0;
FILE *maps;
char fn [BUFSIZ];
glibtop_map_entry *entry_list = NULL;
int rv, n = 0;
FILE *maps;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
memset (buf, 0, sizeof (glibtop_proc_map));
memset (buf, 0, sizeof (glibtop_proc_map));
sprintf (fn, "/proc/%d/maps", pid);
sprintf (fn, "/proc/%d/maps", pid);
maps = fopen (fn, "r");
if (!maps) return NULL;
maps = fopen (fn, "r");
if (!maps) return NULL;
do {
short dev_major, dev_minor;
unsigned long start, end, offset, inode, perm;
char flags [5], *format;
size_t size;
do {
short dev_major, dev_minor;
unsigned long start, end, offset, inode, perm;
char flags [5], *format;
size_t size;
if (sizeof (void*) == 8)
format = "%16lx-%16lx %4c\n %16lx %02hx:%02hx %ld";
else
format = "%08lx-%08lx %4c\n %08lx %02hx:%02hx %ld";
if (sizeof (void*) == 8)
format = "%16lx-%16lx %4c\n %16lx %02hx:%02hx %ld";
else
format = "%08lx-%08lx %4c\n %08lx %02hx:%02hx %ld";
rv = fscanf (maps, format,
&start, &end, flags, &offset,
&dev_major, &dev_minor, &inode);
rv = fscanf (maps, format,
&start, &end, flags, &offset,
&dev_major, &dev_minor, &inode);
flags [4] = 0;
flags [4] = 0;
/* Compute access permissions. */
/* Compute access permissions. */
perm = 0;
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;
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. */
/* Read filename. */
fn [0] = fgetc (maps);
fn [0] = fgetc (maps);
if (fn [0] != '\n' && fn [0] != EOF) {
if (fn [0] != '\n' && fn [0] != EOF) {
fscanf (maps, "%*[ ]%[^\n]\n", fn);
fscanf (maps, "%*[ ]%[^\n]\n", fn);
} else fn [0] = 0;
} else fn [0] = 0;
size = (n+1) * sizeof (glibtop_map_entry);
size = (n+1) * sizeof (glibtop_map_entry);
entry_list = glibtop_realloc_r (server, entry_list, size);
entry_list = glibtop_realloc_r (server, entry_list, size);
memset (&(entry_list [n]), 0, sizeof (glibtop_map_entry));
memset (&(entry_list [n]), 0, sizeof (glibtop_map_entry));
entry_list [n].flags = _glibtop_sysdeps_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].inode = (u_int64_t) inode;
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].inode = (u_int64_t) inode;
strncpy (entry_list [n].filename, fn, GLIBTOP_MAP_FILENAME_LEN);
entry_list [n].filename [GLIBTOP_MAP_FILENAME_LEN] = 0;
strncpy (entry_list [n].filename, fn, GLIBTOP_MAP_FILENAME_LEN);
entry_list [n].filename [GLIBTOP_MAP_FILENAME_LEN] = 0;
n++;
n++;
} while (rv != EOF && rv && fn [0] != EOF);
} while (rv != EOF && rv && fn [0] != EOF);
fclose (maps);
fclose (maps);
buf->number = n;
buf->size = sizeof (glibtop_map_entry);
buf->total = n * sizeof (glibtop_map_entry);
buf->number = n;
buf->size = sizeof (glibtop_map_entry);
buf->total = n * sizeof (glibtop_map_entry);
return entry_list;
return entry_list;
}