whitespace clean up.

* *.{c,h} : whitespace clean up.
This commit is contained in:
Benoît Dejean
2004-06-09 18:52:22 +00:00
parent b0edf88ff7
commit 70b0925a82
190 changed files with 739 additions and 735 deletions

View File

@@ -46,15 +46,15 @@ void
glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
{
struct msginfo msginfo;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0);
memset (buf, 0, sizeof (glibtop_msg_limits));
buf->flags = _glibtop_sysdeps_msg_limits;
msgctl (0, IPC_INFO, (struct msqid_ds *) &msginfo);
buf->msgpool = msginfo.msgpool;
buf->msgmap = msginfo.msgmap;
buf->msgmax = msginfo.msgmax;

View File

@@ -50,7 +50,7 @@
#define _GLIBTOP_IP_FW_ACCTIN 0x1000 /* Account incoming packets only. */
#define _GLIBTOP_IP_FW_ACCTOUT 0x2000 /* Account outgoing packets only. */
static const unsigned long _glibtop_sysdeps_netload =
static const unsigned long _glibtop_sysdeps_netload =
(1L << GLIBTOP_NETLOAD_ERRORS_IN) +
(1L << GLIBTOP_NETLOAD_ERRORS_OUT) +
(1L << GLIBTOP_NETLOAD_COLLISIONS);
@@ -200,7 +200,7 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
unsigned long long flags, packets, bytes;
char *p, *dev;
/* Skip over the network thing. */
/* Skip over the network thing. */
dev = skip_token (buffer) + 1;
p = skip_token (dev);
*p++ = 0;
@@ -281,7 +281,7 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
/* Count remaining 'Receive' fields so we know where
* the first 'Transmit' field starts. */
fields = 0;
while (*p != '|') {
if (!isspace (*p++)) continue;

View File

@@ -57,7 +57,7 @@ get_ISDN_stats (glibtop *server, int *in, int *out)
{
unsigned long *isdn_stats, *ptr;
int fd, i;
*in = *out = 0;
isdn_stats = g_malloc (ISDN_MAX_CHANNELS * 2 * sizeof (unsigned long));
@@ -71,7 +71,7 @@ get_ISDN_stats (glibtop *server, int *in, int *out)
if ((ioctl (fd, IIOCGETCPS, isdn_stats) < 0) && (errno != 0)) {
g_free (isdn_stats);
close (fd);
return FALSE;
}

View File

@@ -47,11 +47,11 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
char *retval = NULL;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_ARGS, 0);
memset (buf, 0, sizeof (glibtop_proc_args));
sprintf (fn, "/proc/%d/cmdline", pid);
cmdline = open (fn, O_RDONLY);
if (cmdline < 0) return NULL;
@@ -90,11 +90,11 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
*(retval+total+len) = 0;
total += len;
}
close (cmdline);
buf->size = total;
buf->flags = _glibtop_sysdeps_proc_args;
return retval;
}

View File

@@ -45,7 +45,7 @@ void
glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
memset (buf, 0, sizeof (glibtop_proc_kernel));
@@ -68,9 +68,9 @@ glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf, pid_t pid)
buf->kstk_esp = strtoull (p, &p, 0);
buf->kstk_eip = strtoull (p, &p, 0);
p = skip_multiple_token (p, 4);
buf->nwchan = strtoull (p, &p, 0);
buf->flags = _glibtop_sysdeps_proc_kernel;

View File

@@ -90,7 +90,7 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
ok = 1; len = strlen (entry->d_name);
/* does it consist entirely of digits? */
for (i = 0; i < len; i++)
if (!isdigit (entry->d_name [i])) ok = 0;
if (!ok) continue;
@@ -102,7 +102,7 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
/* is it really a directory? */
sprintf (buffer, "/proc/%d", pid);
if (stat (buffer, &statb)) continue;
if (!S_ISDIR (statb.st_mode)) continue;
@@ -189,12 +189,12 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
}
/* pids is now big enough to hold at least one single pid. */
pids [count++] = pid;
total++;
}
closedir (proc);
/* count is only zero if an error occured (one a running Linux system,
@@ -206,15 +206,15 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
* g_malloc if pids_chain is NULL. We just calculate the
* new size and copy pids to the beginning of the newly allocated
* block. */
new_size = pids_size + count * sizeof (unsigned);
pids_chain = g_realloc (pids_chain, new_size);
memcpy (pids_chain + pids_offset, pids, count * sizeof (unsigned));
pids_size = new_size;
pids_offset += BLOCK_COUNT;
/* Since everything is ok now, we can set buf->flags, fill in the

View File

@@ -54,7 +54,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
FILE *maps;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
memset (buf, 0, sizeof (glibtop_proc_map));
sprintf (fn, "/proc/%d/maps", pid);
@@ -99,9 +99,9 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
fn [0] = fgetc (maps);
if (fn [0] != '\n' && fn [0] != EOF) {
fscanf (maps, "%*[ ]%[^\n]\n", fn);
} else fn [0] = 0;
size = (n+1) * sizeof (glibtop_map_entry);
@@ -121,11 +121,11 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
entry_list [n].inode = (guint64) inode;
g_strlcpy (entry_list [n].filename, fn, sizeof entry_list [n].filename);
n++;
} while (rv != EOF && rv && fn [0] != EOF);
fclose (maps);
buf->number = n;

View File

@@ -69,7 +69,7 @@ void
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
memset (buf, 0, sizeof (glibtop_proc_mem));

View File

@@ -74,7 +74,7 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
pid_t pid)
{
char buffer [BUFSIZ], *p;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
memset (buf, 0, sizeof (glibtop_proc_segment));

View File

@@ -43,7 +43,7 @@ void
glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0);
memset (buf, 0, sizeof (glibtop_proc_signal));

View File

@@ -49,7 +49,7 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
struct stat statb;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
memset (buf, 0, sizeof (glibtop_proc_state));
@@ -66,7 +66,7 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
/* For security reasons we use stat () since it is
* more failsafe than parsing the file. */
buf->uid = statb.st_uid;
buf->gid = statb.st_gid;

View File

@@ -52,7 +52,7 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
int i;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
memset (buf, 0, sizeof (glibtop_proc_time));

View File

@@ -62,17 +62,17 @@ void
glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf)
{
struct seminfo seminfo;
union semun arg;
union semun arg;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0);
memset (buf, 0, sizeof (glibtop_sem_limits));
buf->flags = _glibtop_sysdeps_sem_limits;
arg.array = (ushort *) &seminfo;
semctl (0, 0, IPC_INFO, arg);
buf->semmap = seminfo.semmap;
buf->semmni = seminfo.semmni;
buf->semmns = seminfo.semmns;

View File

@@ -45,15 +45,15 @@ void
glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf)
{
struct shminfo shminfo;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0);
memset (buf, 0, sizeof (glibtop_shm_limits));
buf->flags = _glibtop_sysdeps_shm_limits;
shmctl (0, IPC_INFO, (struct shmid_ds *) &shminfo);
buf->shmmax = shminfo.shmmax;
buf->shmmin = shminfo.shmmin;
buf->shmmni = shminfo.shmmni;

View File

@@ -71,7 +71,7 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
buffer [len] = '\0';
/* Kernel 2.6 with multiple lines */
buf->total = get_scaled(buffer, "SwapTotal:");
buf->free = get_scaled(buffer, "SwapFree:");
buf->used = buf->total - buf->free;

View File

@@ -35,7 +35,7 @@ init_sysinfo (glibtop *server)
{
static gboolean is_init = FALSE;
char buffer [BUFSIZ];
char buffer [BUFSIZ];
glibtop_entry *cpuinfo = NULL;
FILE *f;
@@ -58,7 +58,7 @@ init_sysinfo (glibtop *server)
cpuinfo->labels = g_ptr_array_new ();
cpuinfo->values = g_hash_table_new (NULL, NULL);
if (sysinfo.ncpu > GLIBTOP_NCPU)
sysinfo.ncpu = GLIBTOP_NCPU;
}