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

@@ -1,3 +1,7 @@
2004-06-09 Benoît Dejean <TazForEver@dlfp.org>
* *.{c,h} : whitespace clean up.
2004-06-07 Benoît Dejean <tazforever@dlfp.org>
* lib/parameter.c:

View File

@@ -57,7 +57,7 @@ glibtop_call_i (glibtop_server *server, backend_server_private *priv,
}
cmnd.data_size = data_size;
glibtop_write_i (priv, sizeof (glibtop_command), &cmnd);
if (data_size) {
@@ -75,7 +75,7 @@ glibtop_call_i (glibtop_server *server, backend_server_private *priv,
(long) resp.recv_size, (long) resp.data_size,
recv_ptr, (long) recv_size);
#endif
if (retval_ptr)
*retval_ptr = resp.glibtop_errno;

View File

@@ -45,10 +45,10 @@ glibtop_read_data_i (backend_server_private *priv)
fprintf (stderr, "LIBRARY: really reading %d data bytes (ret = %d).\n", size, ret);
#endif
if (!size) return NULL;
if (!size) return NULL;
ptr = g_malloc (size);
ret = read (priv->input [0], ptr, size);
if (ret < 0)

View File

@@ -86,7 +86,7 @@ main(int argc, char *argv[])
}
server = glibtop_global_server;
if (!server->_priv)
server->_priv = g_malloc (sizeof (glibtop_server_private));
@@ -185,5 +185,5 @@ handle_slave_connection (int input, int output)
resp.data_size = recv_data_size;
do_output (output, &resp, recv_ptr, recv_data_ptr);
}
}
}

View File

@@ -37,7 +37,7 @@ glibtop_send_version_i (glibtop *server, int fd)
sizeof (glibtop_response),
sizeof (glibtop_union),
sizeof (glibtop_sysdeps));
size = strlen (buffer) + 1;
#ifdef DEBUG

View File

@@ -60,7 +60,7 @@ _open_sysdeps (glibtop_server *server, glibtop_backend *backend,
(*init_fkt) (server);
server->info->sysdeps.pointer_size = sizeof (void*)*8;
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
}

View File

@@ -55,7 +55,7 @@ main (int argc, char *argv [])
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));
@@ -135,7 +135,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_shm_limits (&data.shm_limits);
printf ("Shm Limits (0x%08lx): %lu, %lu, %lu, %lu, %lu\n",
(unsigned long) data.shm_limits.flags,
(unsigned long) data.shm_limits.shmmax,
@@ -159,7 +159,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_sem_limits (&data.sem_limits);
printf ("Sem Limits (0x%08lx): "
"%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
(unsigned long) data.sem_limits.flags,
@@ -217,7 +217,7 @@ main (int argc, char *argv [])
(unsigned long) sysdeps.ppp);
printf ("\n");
ptr = glibtop_get_proclist (&data.proclist, 0, 0);
printf ("Proclist (0x%08lx): %lu, %lu, %lu\n",
@@ -308,7 +308,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, pid);
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_signal.flags,

View File

@@ -50,11 +50,11 @@ main (int argc, char *argv [])
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));
printf ("Method = %d\n", method);
count = glibtop_get_parameter (GLIBTOP_PARAM_COMMAND, buffer, BUFSIZ);

View File

@@ -54,7 +54,7 @@ main (int argc, char *argv [])
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));
@@ -77,7 +77,7 @@ main (int argc, char *argv [])
if (argc != 2)
glibtop_error ("Usage: %s interface", argv [0]);
glibtop_get_netload (&netload, argv [1]);
addr.s_addr = netload.address;

View File

@@ -61,7 +61,7 @@ main (int argc, char *argv [])
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));
@@ -97,7 +97,7 @@ main (int argc, char *argv [])
const char *filename = NULL;
unsigned device, device_major, device_minor;
char perm [5];
if (maps [i].flags & (1L << GLIBTOP_MAP_ENTRY_FILENAME))
filename = maps [i].filename;

View File

@@ -50,7 +50,7 @@ output (pid_t pid)
#endif
printf ("\n");
glibtop_get_proc_state (&data.proc_state, pid);
printf ("Proc_State PID %5d (0x%08lx): "
@@ -59,9 +59,9 @@ output (pid_t pid)
data.proc_state.cmd, data.proc_state.state,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
glibtop_get_proc_uid (&data.proc_uid, pid);
printf ("Proc_Uid PID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", (int) pid,
(unsigned long) data.proc_uid.flags,
@@ -73,7 +73,7 @@ output (pid_t pid)
data.proc_uid.priority, data.proc_uid.nice);
glibtop_get_proc_mem (&data.proc_mem, pid);
printf ("Proc_Mem PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_mem.flags,
@@ -83,7 +83,7 @@ output (pid_t pid)
(unsigned long) data.proc_mem.share,
(unsigned long) data.proc_mem.rss,
(unsigned long) data.proc_mem.rss_rlim);
glibtop_get_proc_segment (&data.proc_segment, pid);
printf ("Proc_Segment PID %5d (0x%08lx): "
@@ -99,7 +99,7 @@ output (pid_t pid)
(unsigned long) data.proc_segment.start_stack);
glibtop_get_proc_time (&data.proc_time, pid);
printf ("Proc_Time PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_time.flags,
@@ -114,7 +114,7 @@ output (pid_t pid)
(unsigned long) data.proc_time.frequency);
glibtop_get_proc_signal (&data.proc_signal, pid);
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_signal.flags,
@@ -160,7 +160,7 @@ output (pid_t pid)
ncpu = glibtop_global_server->ncpu;
glibtop_get_proc_time (&data.proc_time, pid);
total = (unsigned long) data.proc_time.utime +
(unsigned long) data.proc_time.stime;
@@ -242,7 +242,7 @@ main (int argc, char *argv [])
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
glibtop_init ();
glibtop_get_sysdeps (&sysdeps);
@@ -288,7 +288,7 @@ main (int argc, char *argv [])
for (i = 0; i < proclist.number; i++) {
pid = ptr [i];
output (pid);
}

View File

@@ -47,7 +47,7 @@ main (int argc, char *argv [])
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
glibtop_init();
glibtop_get_cpu (&cpu);
@@ -102,7 +102,7 @@ main (int argc, char *argv [])
printf ("%-26s %12s %12s %12s %12s %12s\n%s\n", _("Percent:"),
_("Total (%)"), _("User (%)"), _("Nice (%)"), _("Sys (%)"),
_("Idle (%)"), separator);
printf (_("CPU (0x%08lx): %12.3f %12.3f %12.3f %12.3f %12.3f\n\n"),
(unsigned long) cpu.flags, (double) total * 100.0 / total,
(double) user * 100.0 / total,

View File

@@ -48,7 +48,7 @@ main (int argc, char *argv [])
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));

View File

@@ -26,7 +26,7 @@
#include <stdio.h>
#include <glibtop.h>
#include <glibtop/open.h>
#include <glibtop/close.h>
@@ -35,7 +35,7 @@
void main_prog(int argc, char *argv[]);
int
int
main (int argc, char *argv[])
{
setlocale (LC_ALL, "");

View File

@@ -87,7 +87,7 @@ main (int argc, char *argv [])
"Feature", "Flags", "Count", "utime", "stime");
printf ("-------------------------------------------"
"---------------\n");
glibtop_init_r (&glibtop_global_server, 0, 0);
getrusage (RUSAGE_SELF, &total_start);
@@ -303,7 +303,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
@@ -334,7 +334,7 @@ main (int argc, char *argv [])
(unsigned long) data.proc_kernel.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &total_end);
libgtop_timersub (&total_end.ru_utime, &total_start.ru_utime,

View File

@@ -9,15 +9,15 @@
Copyright (C) 1989 Free Software Foundation, Inc.
Author: Andy Norman (ange@hplb.hpl.hp.com), based on
Author: Andy Norman (ange@hplb.hpl.hp.com), based on
'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
Emacs distribution.
Please mail bugs and suggestions to the author at the above address.
*/
/* HISTORY
* 11-Nov-1990 bristor@simba
/* HISTORY
* 11-Nov-1990 bristor@simba
* Added EOT stuff.
*/
@@ -76,7 +76,7 @@ static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup a
*/
#if 0
#define MCOOKIE_SCREEN "42980" /* screen # to use as the gnuserv cookie */
#define MCOOKIE_SCREEN "42980" /* screen # to use as the gnuserv cookie */
#endif
#define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */
#define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */
@@ -106,7 +106,7 @@ static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup a
* since it limits the size of requests and responses. Don't make it bigger
* than your system's max message size though (usually a couple of k) or else
* msgsend will start failing. For sockets, using the system BUFSIZ is usually
* what you want.
* what you want.
*/
#if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)

View File

@@ -30,7 +30,7 @@
G_BEGIN_DECLS
#define GLIBTOP_PPP_STATE 0
#define GLIBTOP_PPP_BYTES_IN 1
#define GLIBTOP_PPP_BYTES_IN 1
#define GLIBTOP_PPP_BYTES_OUT 2
#define GLIBTOP_MAX_PPP 3

View File

@@ -55,7 +55,7 @@ typedef struct _glibtop_proc_state glibtop_proc_state;
struct _glibtop_proc_state
{
guint64 flags;
char cmd[40]; /* basename of executable file in
char cmd[40]; /* basename of executable file in
* call to exec(2) */
unsigned state; /* single-char code for process state
* (S=sleeping) */
@@ -90,7 +90,7 @@ void glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, pid_t p
void glibtop_init_proc_state_s (glibtop *server);
void glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid);
#endif
#ifdef GLIBTOP_NAMES
/* You need to link with -lgtop_names to get this stuff here. */

View File

@@ -51,14 +51,14 @@ typedef struct _glibtop_proc_time glibtop_proc_time;
struct _glibtop_proc_time
{
guint64 flags,
start_time, /* start time of process --
start_time, /* start time of process --
* seconds since 1-1-70 */
rtime, /* real time accumulated by process */
utime, /* user-mode CPU time accumulated by process */
stime, /* kernel-mode CPU time accumulated by process */
cutime, /* cumulative utime of process and
cutime, /* cumulative utime of process and
* reaped children */
cstime, /* cumulative stime of process and
cstime, /* cumulative stime of process and
* reaped children */
timeout, /* The time (in jiffies) of the process's
* next timeout */

View File

@@ -212,7 +212,7 @@ get_wchan (struct task_struct *p)
return ((unsigned long *)schedule_frame)[12];
}
return pc;
}
}
#elif defined(__mc68000__)
{
unsigned long fp, pc;
@@ -318,7 +318,7 @@ static inline void
task_mem (struct task_struct *p, libgtop_proc_segment_t *proc_segment)
{
struct mm_struct * mm = p->mm;
if (mm && mm != &init_mm) {
struct vm_area_struct * vma = mm->mmap;
unsigned long data = 0, stack = 0;
@@ -486,7 +486,7 @@ get_statm (struct task_struct *tsk, libgtop_proc_mem_t *proc_mem)
}
}
proc_mem->segment.vsize = vsize;
proc_mem->segment.vsize = vsize;
proc_mem->segment.data = data;
proc_mem->segment.stack = stack;
proc_mem->segment.exec = exec;
@@ -498,7 +498,7 @@ get_statm (struct task_struct *tsk, libgtop_proc_mem_t *proc_mem)
proc_mem->trs = trs;
proc_mem->lrs = lrs;
proc_mem->drs = drs;
proc_mem->dt = dt;
proc_mem->dt = dt;
}
static void
@@ -522,7 +522,7 @@ collect_sigign_sigcatch (struct task_struct *p, sigset_t *ign,
}
}
static void
static void
task_sig (struct task_struct *p, libgtop_proc_signal_t *proc_signal)
{
sigset_t ignore, catch;
@@ -670,7 +670,7 @@ libgtop_sysctl (ctl_table *table, int nlen, int *name)
if ((which & LIBGTOP_EXCLUDE_NOTTY) && (tsk->tty == NULL))
continue;
proclist->pids [tindex++] = tsk->pid;
}
@@ -702,7 +702,7 @@ libgtop_sysctl_proc (ctl_table *table, int nlen, int *name,
case LIBGTOP_PROC_STATE:
proc_state = table->data;
memset (proc_state, 0, sizeof (libgtop_proc_state_t));
proc_state->uid = tsk->uid;
proc_state->gid = tsk->gid;
proc_state->flags = tsk->flags;
@@ -711,12 +711,12 @@ libgtop_sysctl_proc (ctl_table *table, int nlen, int *name,
proc_state->euid = tsk->euid;
proc_state->suid = tsk->suid;
proc_state->fsuid = tsk->fsuid;
proc_state->gid = tsk->gid;
proc_state->egid = tsk->egid;
proc_state->sgid = tsk->sgid;
proc_state->fsgid = tsk->fsgid;
proc_state->pid = tsk->pid;
proc_state->pgrp = tsk->pgrp;
proc_state->ppid = tsk->p_pptr->pid;
@@ -757,12 +757,12 @@ libgtop_sysctl_proc (ctl_table *table, int nlen, int *name,
proc_state->it_real_incr = tsk->it_real_incr;
proc_state->it_prof_incr = tsk->it_prof_incr;
proc_state->it_virt_incr = tsk->it_virt_incr;
proc_state->min_flt = tsk->min_flt;
proc_state->cmin_flt = tsk->cmin_flt;
proc_state->maj_flt = tsk->maj_flt;
proc_state->cmaj_flt = tsk->cmaj_flt;
proc_state->nswap = tsk->nswap;
proc_state->cnswap = tsk->cnswap;
@@ -794,7 +794,7 @@ libgtop_sysctl_proc (ctl_table *table, int nlen, int *name,
proc_state->ngroups = tsk->ngroups;
for (i = 0; i < min (tsk->ngroups, LIBGTOP_MAX_GROUPS); i++)
proc_state->groups [i] = tsk->groups [i];
if (tsk->state & TASK_INTERRUPTIBLE)
proc_state->state |= LIBGTOP_TASK_INTERRUPTIBLE;
if (tsk->state & TASK_UNINTERRUPTIBLE)
@@ -1023,7 +1023,7 @@ proc_args_ctl_handler (ctl_table *table, int *name, int nlen,
if (put_user (len, oldlenp))
goto err_fault_free_page;
if (copy_to_user (oldval, (void *) page, len))
goto err_fault_free_page;
@@ -1113,7 +1113,7 @@ proc_maps_ctl_handler (ctl_table *table, int *name, int nlen,
proc_maps->filename [LIBGTOP_MAP_PATH_LEN-1] = '\0';
proc_maps->header.filename_offset = line - proc_maps->filename;
proc_maps->header.device =
proc_maps->header.device =
map->vm_file->f_dentry->d_inode->i_dev;
proc_maps->header.inode =
map->vm_file->f_dentry->d_inode->i_ino;
@@ -1243,13 +1243,13 @@ proc_net_ctl_handler (ctl_table *table, int *name, int nlen,
netload.rx_frame_errors = stats->rx_frame_errors;
netload.rx_fifo_errors = stats->rx_fifo_errors;
netload.rx_missed_errors = stats->rx_missed_errors;
netload.tx_aborted_errors = stats->tx_aborted_errors;
netload.tx_carrier_errors = stats->tx_carrier_errors;
netload.tx_fifo_errors = stats->tx_fifo_errors;
netload.tx_heartbeat_errors = stats->tx_heartbeat_errors;
netload.tx_window_errors = stats->tx_window_errors;
netload.rx_compressed = stats->rx_compressed;
netload.tx_compressed = stats->tx_compressed;

View File

@@ -218,7 +218,7 @@ struct libgtop_netload
unsigned long tx_dropped; /* no space available in linux */
unsigned long multicast; /* multicast packets received */
unsigned long collisions;
/* detailed rx_errors: */
unsigned long rx_length_errors;
unsigned long rx_over_errors; /* receiver ring buff overflow */
@@ -226,14 +226,14 @@ struct libgtop_netload
unsigned long rx_frame_errors; /* recv'd frame alignment error */
unsigned long rx_fifo_errors; /* recv'r fifo overrun */
unsigned long rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */
unsigned long tx_aborted_errors;
unsigned long tx_carrier_errors;
unsigned long tx_fifo_errors;
unsigned long tx_heartbeat_errors;
unsigned long tx_window_errors;
/* for cslip etc */
unsigned long rx_compressed;
unsigned long tx_compressed;

View File

@@ -15,7 +15,7 @@
#define TABLE_KERN_PROC_UID 5
#define TABLE_KERN_PROC_RUID 6
#define TABLE_KERN_PROC_MASK 15
#define TABLE_KERN_PROC_MASK 15
#define TABLE_EXCLUDE_IDLE 0x1000
#define TABLE_EXCLUDE_SYSTEM 0x2000
@@ -178,7 +178,7 @@ union table
struct table_proc_mem proc_mem;
struct table_proc_segment proc_segment;
struct table_proc_time proc_time;
struct table_proc_state proc_state;
struct table_proc_state proc_state;
struct table_proc_signal proc_signal;
struct table_proc_kernel proc_kernel;
};

View File

@@ -50,7 +50,7 @@ static struct task_struct *
get_task (pid_t pid)
{
struct task_struct ** p;
p = task;
while (++p < task+NR_TASKS) {
if (*p && (*p)->pid == pid)
@@ -171,7 +171,7 @@ get_wchan (struct task_struct *p)
{
unsigned long schedule_frame;
unsigned long pc;
pc = thread_saved_pc(&p->tss);
if (pc >= (unsigned long) interruptible_sleep_on && pc < (unsigned long) add_timer) {
schedule_frame = ((unsigned long *)p->tss.ksp)[6];
@@ -246,7 +246,7 @@ sys_table (int type, union table *buf, const void *param)
tbl.proclist.last_pid = last_pid;
break;
case TABLE_CPU:
tbl.cpu.total = jiffies;
tbl.cpu.total = jiffies;
tbl.cpu.user = kstat.cpu_user;
tbl.cpu.nice = kstat.cpu_nice;
tbl.cpu.sys = kstat.cpu_system;
@@ -294,21 +294,21 @@ sys_table (int type, union table *buf, const void *param)
tbl.proc_uid.euid = tsk->euid;
tbl.proc_uid.suid = tsk->suid;
tbl.proc_uid.fsuid = tsk->fsuid;
tbl.proc_uid.gid = tsk->gid;
tbl.proc_uid.egid = tsk->egid;
tbl.proc_uid.sgid = tsk->sgid;
tbl.proc_uid.fsgid = tsk->fsgid;
tbl.proc_uid.pid = tsk->pid;
tbl.proc_uid.pgrp = tsk->pgrp;
tbl.proc_uid.ppid = tsk->p_pptr->pid;
tbl.proc_uid.session = tsk->session;
tbl.proc_uid.tty = tsk->tty ?
kdev_t_to_nr (tsk->tty->device) : 0;
tbl.proc_uid.tpgid = tsk->tty ? tsk->tty->pgrp : -1;
tbl.proc_uid.priority = tsk->priority;
tbl.proc_uid.counter = tsk->counter;
tbl.proc_uid.def_priority = DEF_PRIORITY;
@@ -322,7 +322,7 @@ sys_table (int type, union table *buf, const void *param)
unsigned long sig_ign = 0, sig_caught = 0;
unsigned long bit = 1;
int i;
for (i = 0; i < 32; i++) {
switch((unsigned long) action->sa_handler) {
case 0:
@@ -376,7 +376,7 @@ sys_table (int type, union table *buf, const void *param)
while (vma) {
pgd_t *pgd = pgd_offset(tsk->mm, vma->vm_start);
int pages = 0, shared = 0, dirty = 0, total = 0;
vsize += vma->vm_end - vma->vm_start;
statm_pgd_range (pgd, vma->vm_start, vma->vm_end,
@@ -428,10 +428,10 @@ sys_table (int type, union table *buf, const void *param)
tbl.proc_kernel.cmin_flt = tsk->cmin_flt;
tbl.proc_kernel.maj_flt = tsk->maj_flt;
tbl.proc_kernel.cmaj_flt = tsk->cmaj_flt;
tbl.proc_kernel.kesp = tsk->kernel_stack_page ? KSTK_EIP(tsk) : 0;
tbl.proc_kernel.keip = tsk->kernel_stack_page ? KSTK_ESP(tsk) : 0;
tbl.proc_kernel.nswap = tsk->nswap;
tbl.proc_kernel.cnswap = tsk->cnswap;
@@ -442,10 +442,10 @@ sys_table (int type, union table *buf, const void *param)
for (rule = chain->chain; rule; rule = rule->next) {
const char *name = rule->ipfw.fw_vianame;
int k;
if (name [0] && !strncmp (param, name, 5))
continue;
for (k = 0; k < NUM_SLOTS; k++) {
tbl.netacct.packets +=
rule->counters[k].pcnt;

View File

@@ -237,7 +237,7 @@ if (__res>=0) \
return (type) __res; \
errno=-__res; \
return -1; \
}
}
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
type5,arg5) \

View File

@@ -140,7 +140,7 @@ static unsigned long get_wchan(struct task_struct *p)
return ((unsigned long *)schedule_frame)[12];
}
return pc;
}
}
#elif defined(__mc68000__)
{
unsigned long fp, pc;
@@ -388,7 +388,7 @@ table_fkt (int type, union table *buf, const void *param)
if ((plistargs.which & TABLE_EXCLUDE_NOTTY) &&
(tsk->tty == NULL))
continue;
tbl.proclist.pids [tindex++] = tsk->pid;
}
tbl.proclist.nr_running = nr_running;
@@ -397,7 +397,7 @@ table_fkt (int type, union table *buf, const void *param)
read_unlock(&tasklist_lock);
break;
case TABLE_CPU:
tbl.cpu.total = jiffies;
tbl.cpu.total = jiffies;
tbl.cpu.user = kstat.cpu_user;
tbl.cpu.nice = kstat.cpu_nice;
tbl.cpu.sys = kstat.cpu_system;
@@ -446,21 +446,21 @@ table_fkt (int type, union table *buf, const void *param)
tbl.proc_uid.euid = tsk->euid;
tbl.proc_uid.suid = tsk->suid;
tbl.proc_uid.fsuid = tsk->fsuid;
tbl.proc_uid.gid = tsk->gid;
tbl.proc_uid.egid = tsk->egid;
tbl.proc_uid.sgid = tsk->sgid;
tbl.proc_uid.fsgid = tsk->fsgid;
tbl.proc_uid.pid = tsk->pid;
tbl.proc_uid.pgrp = tsk->pgrp;
tbl.proc_uid.ppid = tsk->p_pptr->pid;
tbl.proc_uid.session = tsk->session;
tbl.proc_uid.tty = tsk->tty ?
kdev_t_to_nr (tsk->tty->device) : 0;
tbl.proc_uid.tpgid = tsk->tty ? tsk->tty->pgrp : -1;
tbl.proc_uid.priority = tsk->priority;
tbl.proc_uid.counter = tsk->counter;
tbl.proc_uid.def_priority = DEF_PRIORITY;
@@ -520,7 +520,7 @@ table_fkt (int type, union table *buf, const void *param)
while (vma) {
pgd_t *pgd = pgd_offset(tsk->mm, vma->vm_start);
int pages = 0, shared = 0, dirty = 0, total = 0;
vsize += vma->vm_end - vma->vm_start;
statm_pgd_range (pgd, vma->vm_start, vma->vm_end,
@@ -584,10 +584,10 @@ table_fkt (int type, union table *buf, const void *param)
tbl.proc_kernel.cmin_flt = tsk->cmin_flt;
tbl.proc_kernel.maj_flt = tsk->maj_flt;
tbl.proc_kernel.cmaj_flt = tsk->cmaj_flt;
tbl.proc_kernel.kesp = KSTK_ESP(tsk);
tbl.proc_kernel.keip = KSTK_EIP(tsk);
tbl.proc_kernel.nswap = tsk->nswap;
tbl.proc_kernel.cnswap = tsk->cnswap;

View File

@@ -259,7 +259,7 @@ __asm__ volatile ("int $0x80" \
: "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
"d" ((long)(arg3)),"S" ((long)(arg4))); \
__syscall_return(type,__res); \
}
}
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
type5,arg5) \

View File

@@ -50,7 +50,7 @@ glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
} else {
cmnd.data_size = send_size;
}
glibtop_write_l (server, sizeof (glibtop_command), &cmnd);
glibtop_read_l (server, sizeof (glibtop_response), &response);

View File

@@ -32,7 +32,7 @@
static void
print_server_name (glibtop_server *server)
{
fprintf (stderr, "%s: ", server ?
fprintf (stderr, "%s: ", server ?
(server->name ? server->name : DEFAULT_NAME)
: DEFAULT_NAME);
}
@@ -40,7 +40,7 @@ print_server_name (glibtop_server *server)
void
glibtop_error_vr (glibtop_server *server, char *format, va_list args)
{
print_server_name (server);
print_server_name (server);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");

View File

@@ -53,7 +53,7 @@ GType
glibtop_backend_get_type (void)
{
static GType glibtop_backend_type = 0;
if (!glibtop_backend_type) {
static const GTypeInfo glibtop_backend_info = {
sizeof (glibtop_backend_class),
@@ -66,7 +66,7 @@ glibtop_backend_get_type (void)
16, /* n_preallocs */
(GInstanceInitFunc) glibtop_backend_init,
};
glibtop_backend_type = g_type_register_static
(G_TYPE_OBJECT, "glibtop_backend", &glibtop_backend_info, 0);
}
@@ -80,7 +80,7 @@ glibtop_backend_class_init (glibtop_backend_class *class)
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) class;
parent_class = g_type_class_ref (G_TYPE_OBJECT);
gobject_class->finalize = glibtop_backend_finalize;
@@ -100,12 +100,12 @@ glibtop_backend_finalize (GObject *object)
{
glibtop_backend *glibtop;
glibtop_backend_private *priv = NULL;
glibtop = GLIBTOP_BACKEND (object);
priv = glibtop->_priv;
g_free (priv);
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize (object);
}

View File

@@ -47,7 +47,7 @@ GType
glibtop_client_get_type (void)
{
static GType glibtop_client_type = 0;
if (!glibtop_client_type) {
static const GTypeInfo glibtop_client_info = {
sizeof (glibtop_client_class),
@@ -60,7 +60,7 @@ glibtop_client_get_type (void)
16, /* n_preallocs */
(GInstanceInitFunc) glibtop_client_init,
};
glibtop_client_type = g_type_register_static
(G_TYPE_OBJECT, "glibtop_client", &glibtop_client_info, 0);
}
@@ -99,7 +99,7 @@ glibtop_client_class_init (glibtop_client_class *klass)
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_ERROR] =
@@ -122,7 +122,7 @@ glibtop_client_class_init (glibtop_client_class *klass)
klass->error = glibtop_client_error_handler;
klass->warning = glibtop_client_warning_handler;
gobject_class->finalize = glibtop_client_finalize;
}
@@ -130,7 +130,7 @@ static void
glibtop_client_init (glibtop_client *glibtop)
{
glibtop_client_private *priv;
priv = g_new0 (glibtop_client_private, 1);
glibtop->_priv = priv;
}
@@ -141,16 +141,16 @@ glibtop_client_finalize (GObject *object)
glibtop_client *glibtop;
glibtop_client_private *priv = NULL;
GSList *c;
glibtop = GLIBTOP_CLIENT (object);
priv = glibtop->_priv;
for (c = priv->backend_list; c; c = c->next)
g_object_unref (G_OBJECT (c->data));
g_slist_free (priv->backend_list);
g_free (priv);
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -180,7 +180,7 @@ glibtop_client_propagate_error (glibtop_client *client, GError *error)
g_signal_emitv (params,
glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_ERROR],
0, NULL);
g_value_unset (params + 1);
g_value_unset (params + 0);
}
@@ -204,7 +204,7 @@ glibtop_client_propagate_warning (glibtop_client *client, GError *error)
g_signal_emitv (params,
glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_WARNING],
0, NULL);
g_value_unset (params + 1);
g_value_unset (params + 0);
}

View File

@@ -50,7 +50,7 @@ _init_server (glibtop *server, const unsigned features)
if (server->server_rsh == NULL) {
const char *temp = getenv ("LIBGTOP_RSH") ?
getenv ("LIBGTOP_RSH") : "/usr/bin/ssh";
server->server_rsh = g_strdup (temp);
}
@@ -78,15 +78,15 @@ _init_server (glibtop *server, const unsigned features)
/* If the first character of 'server_command' is a colon,
* the first field is the method to connect to the server. */
/* Everything up to the next colon is the method. */
command = g_strdup (server->server_command+1);
temp = strstr (command, ":");
if (temp) *temp = 0;
/* Dispatch method. */
if (!strcmp (command, "direct")) {
/* Use sysdeps dir instead of connecting to server
* even if using the server would be required on
@@ -106,16 +106,16 @@ _init_server (glibtop *server, const unsigned features)
} else {
char *temp2 = strstr (temp+1, ":");
if (temp2) *temp2 = 0;
/* Override default. */
if (server->server_host)
g_free ((char *) server->server_host);
server->server_host = g_strdup (temp+1);
temp = temp2;
}
if (temp == NULL) {
/* If no value was set, we use DEFAULT_PORT. */
if (server->server_port == 0)
@@ -123,10 +123,10 @@ _init_server (glibtop *server, const unsigned features)
} else {
char *temp2 = strstr (temp+1, ":");
if (temp2) *temp2 = 0;
if (sscanf (temp+1, "%ld", &server->server_port) != 1)
server->server_port = DEFAULT_PORT;
temp = temp2 ? temp2 + 1 : temp2;
}
@@ -146,7 +146,7 @@ _init_server (glibtop *server, const unsigned features)
server->server_command+1);
}
g_free (command);
}
@@ -173,27 +173,27 @@ glibtop_init_r (glibtop **server_ptr, unsigned long features, unsigned flags)
if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
if (flags & GLIBTOP_FEATURES_EXCEPT)
features = ~features & GLIBTOP_SYSDEPS_ALL;
if (features == 0)
features = GLIBTOP_SYSDEPS_ALL;
if (flags & GLIBTOP_FEATURES_NO_SERVER) {
server->method = GLIBTOP_METHOD_DIRECT;
features = 0;
}
server->features = features;
_init_server (server, features);
server->flags |= _GLIBTOP_INIT_STATE_INIT;
switch (server->method) {
case GLIBTOP_METHOD_PIPE:
case GLIBTOP_METHOD_UNIX:
if (glibtop_server_features & features)
break;
server->method = GLIBTOP_METHOD_DIRECT;
break;
}
@@ -205,11 +205,11 @@ glibtop_init_r (glibtop **server_ptr, unsigned long features, unsigned flags)
return server;
/* Open server, but only if not already opened. */
if ((server->flags & _GLIBTOP_INIT_STATE_OPEN) == 0)
glibtop_open_l (glibtop_global_server, "glibtop",
features, flags);
return server;
}
@@ -218,7 +218,7 @@ glibtop_init_s (glibtop **server_ptr, unsigned long features, unsigned flags)
{
glibtop *server;
glibtop_init_func_t *init_fkt;
if (server_ptr == NULL)
return NULL;
@@ -239,7 +239,7 @@ glibtop_init_s (glibtop **server_ptr, unsigned long features, unsigned flags)
for (init_fkt = _glibtop_init_hook_s; *init_fkt; init_fkt++)
(*init_fkt) (server);
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
}

View File

@@ -59,9 +59,9 @@ glibtop_inodedb_open_s (glibtop *server, unsigned databases,
pwd = getpwuid (getuid ());
if (!pwd) glibtop_error_io_r (server, "getpwuid");
sprintf (filename, "%s/var/libgtop/inodedb.db", pwd->pw_dir);
if (stat (filename, &statb))
databases &= ~GLIBTOP_INODEDB_USER;
@@ -108,7 +108,7 @@ glibtop_inodedb_close_s (glibtop *server, glibtop_inodedb *inodedb)
{
if (inodedb->system_dbf)
gdbm_close (inodedb->system_dbf);
if (inodedb->user_dbf)
gdbm_close (inodedb->user_dbf);

View File

@@ -62,17 +62,17 @@ glibtop_open_l (glibtop *server, const char *program_name,
fprintf (stderr, "Connecting to '%s' port %ld.\n",
server->server_host, server->server_port);
#endif
connect_type = glibtop_make_connection
(server->server_host, server->server_port,
&server->socket);
#ifdef DEBUG
fprintf (stderr, "Connect Type is %d.\n", connect_type);
#endif
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
server->features = -1;
break;
case GLIBTOP_METHOD_UNIX:
@@ -83,7 +83,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
connect_type = glibtop_make_connection
("unix", 0, &server->socket);
#ifdef DEBUG
#ifdef DEBUG
fprintf (stderr, "Connect Type is %d.\n", connect_type);
#endif
@@ -101,7 +101,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
glibtop_error_io_r (server, "cannot make a pipe");
server->pid = fork ();
if (server->pid < 0) {
glibtop_error_io_r (server, "fork failed");
} else if (server->pid == 0) {
@@ -119,7 +119,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
close (server->output [0]);
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
server->features = -1;
break;
}
@@ -141,25 +141,25 @@ glibtop_open_l (glibtop *server, const char *program_name,
sizeof (glibtop_sysdeps));
size = strlen (version) + 1;
glibtop_read_l (server, sizeof (nbytes), &nbytes);
if (nbytes != size)
glibtop_error_r (server,
"Requested %u bytes but got %u.",
size, nbytes);
glibtop_read_l (server, nbytes, buffer);
if (memcmp (version, buffer, size))
glibtop_error_r (server, "server version is not %s",
LIBGTOP_VERSION);
/* Now ask it for its features. */
glibtop_call_l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
sizeof (glibtop_sysdeps), &sysdeps);
server->features = sysdeps.features;
memcpy (&server->sysdeps, &sysdeps, sizeof (glibtop_sysdeps));
@@ -176,6 +176,6 @@ glibtop_open_l (glibtop *server, const char *program_name,
#ifdef DEBUG
fprintf (stderr, "Calling sysdeps open function.\n");
#endif
glibtop_init_s (&server, features, flags);
}

View File

@@ -34,7 +34,7 @@ do_read (int s, void *ptr, size_t total_size)
int nread;
size_t already_read = 0, remaining = total_size;
char *tmp_ptr;
while (already_read < total_size) {
nread = recv (s, ptr, remaining, 0);
@@ -42,12 +42,12 @@ do_read (int s, void *ptr, size_t total_size)
close (s);
continue;
}
if (nread <= 0) {
glibtop_error_io ("recv");
return;
}
already_read += nread;
remaining -= nread;
/* (char *) ptr += nread; */

View File

@@ -54,10 +54,10 @@ glibtop_read_data_l (glibtop *server)
fprintf (stderr, "LIBRARY: really reading %d data bytes (ret = %d).\n", size, ret);
#endif
if (!size) return NULL;
if (!size) return NULL;
ptr = g_malloc (size);
if (server->socket) {
ret = recv (server->socket, ptr, size, 0);
} else {

View File

@@ -23,7 +23,7 @@
* without specific prior written permission.
* 4. Altered versions must be plainly marked as such, and must not be
* misrepresented as being the original software and/or documentation.
*
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE

View File

@@ -1,22 +1,22 @@
/* -*-C-*-
* Server code for handling requests from clients and forwarding them
* on to the GNU Emacs process.
*
*
* This file is part of GNU Emacs.
*
*
* Copying is permitted under those conditions described by the GNU
* General Public License.
*
*
* Copyright (C) 1989 Free Software Foundation, Inc.
*
*
* Author: Andy Norman (ange@hplb.hpl.hp.com), based on 'etc/server.c'
* from the 18.52 GNU Emacs distribution.
*
*
* Please mail bugs and suggestions to the author at the above address.
*/
/* HISTORY
* 11-Nov-1990 bristor@simba
/* HISTORY
* 11-Nov-1990 bristor@simba
* Added EOT stuff.
*/
@@ -192,17 +192,17 @@ permitted (u_long host_addr, int fd)
auth_protocol);
return FALSE;
}
if (!strcmp (auth_protocol, MCOOKIE_NAME)) {
/*
/*
* doing magic cookie auth
*/
if (timed_read (fd, buf, 10, AUTH_TIMEOUT, 1) <= 0)
return FALSE;
auth_data_len = atoi (buf);
if (auth_data_len < 1 || (size_t)auth_data_len > sizeof(buf)) {
syslog_message(LOG_WARNING, "Invalid data length supplied by client");
return FALSE;
@@ -222,7 +222,7 @@ permitted (u_long host_addr, int fd)
"not compiled with Xauth");
#endif
/*
/*
* auth failed, but allow this to fall through to the
* GNU_SECURE protocol....
*/
@@ -238,12 +238,12 @@ permitted (u_long host_addr, int fd)
"trying GNU_SECURE auth...");
}
}
/* Other auth protocols go here, and should execute only if
* the * auth_protocol name matches. */
/* Now, try the old GNU_SECURE stuff... */
if (enable_debug)
syslog_message (LOG_DEBUG, "Doing GNU_SECURE auth ...");
@@ -257,7 +257,7 @@ permitted (u_long host_addr, int fd)
if (host_addr == permitted_hosts [i])
return (TRUE);
}
return (FALSE);
}
@@ -362,7 +362,7 @@ internet_init (void)
syslog_io_message (LOG_ERR, "unable to create socket");
exit (1);
}
/* Bind the listen address to the socket. */
if (bind (ls, (struct sockaddr *) &server,
sizeof (struct sockaddr_in)) == -1) {
@@ -433,7 +433,7 @@ handle_internet_request (int ls)
close (s);
if (verbose_output)
if (verbose_output)
syslog_message (LOG_INFO, "Closed connection to %s port %u.",
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
@@ -477,7 +477,7 @@ main (int argc, const char **argv)
/* On non-glibc systems, this is not set up for us. */
if (!program_invocation_name) {
char *arg;
program_invocation_name = (char *) argv[0];
arg = strrchr (argv[0], '/');
program_invocation_short_name =
@@ -533,7 +533,7 @@ main (int argc, const char **argv)
* SERVER_GID. Otherwise we completely drop any priviledges.
*/
if (enable_debug)
if (enable_debug)
syslog_message (LOG_DEBUG, "Parent ID: (%d, %d) - (%d, %d)",
getuid (), geteuid (), getgid (), getegid ());
@@ -618,7 +618,7 @@ main (int argc, const char **argv)
if (verbose_output)
syslog_message (LOG_INFO, "Child %d exited.", ret);
}
FD_ZERO (&rmask);
/* Only the child accepts connections from standard

View File

@@ -64,18 +64,18 @@ handle_parent_connection (int s)
syslog_message (LOG_DEBUG,
"Parent (%d) received command %d from client.",
getpid (), (int) cmnd->command);
if (cmnd->data_size >= BUFSIZ) {
syslog_message (LOG_WARNING,
"Client sent %d bytes, but buffer is %d",
cmnd->data_size, BUFSIZ);
return;
}
memset (resp, 0, sizeof (glibtop_response));
memset (parameter, 0, sizeof (parameter));
if (cmnd->data_size) {
if (enable_debug)
syslog_message (LOG_DEBUG, "Client has %d bytes of data.",
@@ -92,7 +92,7 @@ handle_parent_connection (int s)
do_output (s, resp, 0, 0, NULL);
return;
case GLIBTOP_CMND_SYSDEPS:
memcpy (&resp->u.sysdeps, &server->sysdeps,
memcpy (&resp->u.sysdeps, &server->sysdeps,
sizeof (glibtop_sysdeps));
resp->u.sysdeps.features = GLIBTOP_SYSDEPS_ALL;
do_output (s, resp, _offset_union (sysdeps), 0, NULL);

View File

@@ -95,7 +95,7 @@ main(int argc, char *argv[])
_exit (1);
}
#endif
glibtop_init_p (glibtop_global_server, 0, 0);
if (setreuid (euid, uid)) _exit (1);

View File

@@ -5,7 +5,7 @@
#define HOST_TABLE_ENTRIES 1
const char *permitted_host_names [HOST_TABLE_ENTRIES] =
const char *permitted_host_names [HOST_TABLE_ENTRIES] =
{ NULL };
unsigned long permitted_hosts [HOST_TABLE_ENTRIES];

View File

@@ -44,7 +44,7 @@ handle_slave_connection (int input, int output)
fprintf (stderr, "Slave %d received command "
"%d from client.\n", getpid (), cmnd->command);
#endif
if (cmnd->data_size >= BUFSIZ)
glibtop_error ("Client sent %d bytes, "
"but buffer is %d",
@@ -53,19 +53,19 @@ handle_slave_connection (int input, int output)
memset (resp, 0, sizeof (glibtop_response));
memset (parameter, 0, sizeof (parameter));
if (cmnd->data_size) {
#ifdef SLAVE_DEBUG
fprintf (stderr, "Client has %d bytes of data.\n",
cmnd->data_size);
#endif
do_read (input, parameter, cmnd->data_size);
} else if (cmnd->size) {
memcpy (parameter, cmnd->parameter, cmnd->size);
}
switch (cmnd->command) {
case GLIBTOP_CMND_QUIT:
do_output (output, resp, 0, 0, NULL);
@@ -124,7 +124,7 @@ handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
switch (cmnd->command) {
case GLIBTOP_CMND_SYSDEPS:
memcpy (&resp->u.sysdeps, &server->sysdeps,
memcpy (&resp->u.sysdeps, &server->sysdeps,
sizeof (glibtop_sysdeps));
resp->u.sysdeps.features = glibtop_server_features;
resp->u.sysdeps.flags = glibtop_server_features |

View File

@@ -37,7 +37,7 @@ glibtop_send_version (glibtop *server, int fd)
sizeof (glibtop_response),
sizeof (glibtop_union),
sizeof (glibtop_sysdeps));
size = strlen (buffer) + 1;
#ifdef DEBUG

View File

@@ -61,23 +61,23 @@ main (int argc, char *argv [])
if (dirname [len-1] == '\n')
dirname [len-1] = 0;
if (stat (dirname, &statb))
continue;
if (S_ISREG (statb.st_mode)) {
glibtop_inodedb_key key;
datum d_key, d_content;
d_key.dptr = (void *) &key;
d_key.dsize = sizeof (key);
d_content.dptr = dirname;
d_content.dsize = strlen (dirname) + 1;
key.device = (guint64) statb.st_dev;
key.inode = (guint64) statb.st_ino;
if (gdbm_store (dbf, d_key, d_content, GDBM_REPLACE))
glibtop_error_io ("gdbm_store (%s)", dirname);
@@ -98,9 +98,9 @@ main (int argc, char *argv [])
glibtop_inodedb_key key;
char filename [BUFSIZ];
datum d_key, d_content;
sprintf (filename, "%s/%s", dirname, entry->d_name);
if (stat (filename, &statb))
continue;
@@ -112,10 +112,10 @@ main (int argc, char *argv [])
d_content.dptr = filename;
d_content.dsize = strlen (filename) + 1;
key.device = (guint64) statb.st_dev;
key.inode = (guint64) statb.st_ino;
if (gdbm_store (dbf, d_key, d_content, GDBM_REPLACE))
glibtop_error_io ("gdbm_store (%s)", filename);
@@ -123,7 +123,7 @@ main (int argc, char *argv [])
filename, (unsigned long) statb.st_dev,
(unsigned long) statb.st_ino);
}
closedir (directory);
}

View File

@@ -31,7 +31,7 @@
#include <utils.h>
static const unsigned long _glibtop_sysdeps_cpu =
static const unsigned long _glibtop_sysdeps_cpu =
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1L << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_IDLE) +
(1L << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_FREQUENCY) +
@@ -80,7 +80,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
result = _glibtop_get_kmem_info(server, server->machine.cpuinfo_offset,
server->machine.cpuinfo,
_system_configuration.ncpus
_system_configuration.ncpus
* sizeof(struct cpuinfo));
if (result <= 0)
@@ -88,7 +88,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
glibtop_error_io_r (server, "Cannot read cpuinfo");
return;
}
buf->idle = 0;
buf->user = 0;
buf->sys = 0;
@@ -97,7 +97,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
{
if (cpu < GLIBTOP_NCPU)
{
buf->xcpu_idle[cpu] =
buf->xcpu_idle[cpu] =
server->machine.cpuinfo[cpu].cpu[CPU_IDLE];
buf->xcpu_user[cpu] =
server->machine.cpuinfo[cpu].cpu[CPU_USER];
@@ -119,7 +119,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
buf->total = buf->idle + buf->user + buf->sys + buf->nice ;
}
buf->frequency = sysconf(_SC_CLK_TCK);
buf->flags = _glibtop_sysdeps_cpu;
}

View File

@@ -1,6 +1,6 @@
/* $Id$ */
/*
/*
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, March 1999.

View File

@@ -28,7 +28,7 @@
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_loadavg =
static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG);
/* Init function. */

View File

@@ -22,13 +22,13 @@
*/
#include <unistd.h>
#include <sys/vminfo.h>
#include <sys/vminfo.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/mem.h>
static const unsigned long _glibtop_sysdeps_mem =
static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_LOCKED);

View File

@@ -27,7 +27,7 @@
#include <glibtop/error.h>
#include <glibtop/msg_limits.h>
static const unsigned long _glibtop_sysdeps_msg_limits =
static const unsigned long _glibtop_sysdeps_msg_limits =
(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNB) +
(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGTQL);

View File

@@ -31,7 +31,7 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_netload =
static const unsigned long _glibtop_sysdeps_netload =
(1 << GLIBTOP_NETLOAD_IF_FLAGS) + (1 << GLIBTOP_NETLOAD_MTU) +
(1 << GLIBTOP_NETLOAD_SUBNET) + (1 << GLIBTOP_NETLOAD_ADDRESS) +
(1 << GLIBTOP_NETLOAD_PACKETS_IN) + (1 << GLIBTOP_NETLOAD_PACKETS_OUT) +
@@ -182,7 +182,7 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_MULTICAST);
buf->mtu = ifnet.if_mtu;
get_ifaddr(server, ifnet.if_addrlist, &addr, &mask);
buf->subnet = addr & mask;

View File

@@ -29,7 +29,7 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_proc_args =
static const unsigned long _glibtop_sysdeps_proc_args =
(1 << GLIBTOP_PROC_ARGS_SIZE);
/* Init function. */
@@ -71,7 +71,7 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
return NULL;
}
size = max_len != 0 ? max_len : 4096;
args_buffer = g_malloc (size);

View File

@@ -26,7 +26,7 @@
#include <glibtop.h>
#include <glibtop/proclist.h>
static const unsigned long _glibtop_sysdeps_proclist =
static const unsigned long _glibtop_sysdeps_proclist =
(1 << GLIBTOP_PROCLIST_NUMBER) + (1 << GLIBTOP_PROCLIST_TOTAL) +
(1 << GLIBTOP_PROCLIST_SIZE);
@@ -116,7 +116,7 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
{
continue;
}
break;
case GLIBTOP_KERN_PROC_PGRP:
@@ -184,7 +184,7 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
break;
}
if (count >= BLOCK_COUNT)
{
/* The following call to g_realloc will be

View File

@@ -42,8 +42,8 @@ glibtop_map_entry *
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
{
glibtop_init_p (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
memset (buf, 0, sizeof (glibtop_proc_map));
return NULL;
}

View File

@@ -31,9 +31,9 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_proc_mem =
static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_VSIZE) +
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_RSS) +
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_RSS) +
(1 << GLIBTOP_PROC_MEM_RSS_RLIM);
/* Init function. */
@@ -62,7 +62,7 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf,
return;
}
pagesize = sysconf(_SC_PAGESIZE);
buf->vsize = buf->size = pinfo->pi_size * pagesize;

View File

@@ -31,7 +31,7 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_proc_segment =
static const unsigned long _glibtop_sysdeps_proc_segment =
(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + (1 << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) +
(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) + (1 << GLIBTOP_PROC_SEGMENT_STACK_RSS);

View File

@@ -32,7 +32,7 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_proc_signal =
static const unsigned long _glibtop_sysdeps_proc_signal =
(1 <<GLIBTOP_PROC_SIGNAL_SIGNAL) + (1 <<GLIBTOP_PROC_SIGNAL_BLOCKED) +
(1 <<GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1 <<GLIBTOP_PROC_SIGNAL_SIGCATCH);
@@ -63,7 +63,7 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf,
return;
}
/* pending signals */
#define NB_BITS (8 * sizeof(guint64))
@@ -84,6 +84,6 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf,
if (pinfo->pi_signal[i] == (long)SIG_CATCH)
buf->sigcatch[i / NB_BITS] |= bit;
}
buf->flags = _glibtop_sysdeps_proc_signal;
}

View File

@@ -30,7 +30,7 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_proc_state =
static const unsigned long _glibtop_sysdeps_proc_state =
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE) +
(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID);
@@ -79,7 +79,7 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf,
buf->uid = pinfo->pi_uid;
buf->gid = pinfo->pi_cred.cr_gid;
if (pinfo->pi_state == SZOMB)
{
buf->state = 'Z';

View File

@@ -31,7 +31,7 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_proc_uid =
static const unsigned long _glibtop_sysdeps_proc_uid =
(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) +
(1 << GLIBTOP_PROC_UID_GID) + (1 << GLIBTOP_PROC_UID_EGID) +
(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) +

View File

@@ -27,7 +27,7 @@
#include "utils.h"
static const unsigned long _glibtop_sysdeps_sem_limits =
static const unsigned long _glibtop_sysdeps_sem_limits =
(1 << GLIBTOP_IPC_SEMMNI) + (1 << GLIBTOP_IPC_SEMMSL) +
(1 << GLIBTOP_IPC_SEMOPM) + (1 << GLIBTOP_IPC_SEMUME) +
(1 << GLIBTOP_IPC_SEMUSZ) + (1 << GLIBTOP_IPC_SEMVMX) +

View File

@@ -27,7 +27,7 @@
#include <glibtop/error.h>
#include <glibtop/shm_limits.h>
static const unsigned long _glibtop_sysdeps_shm_limits =
static const unsigned long _glibtop_sysdeps_shm_limits =
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
(1L << GLIBTOP_IPC_SHMMNI);

View File

@@ -27,7 +27,7 @@
#include <glibtop/error.h>
#include <glibtop/swap.h>
static const unsigned long _glibtop_sysdeps_swap =
static const unsigned long _glibtop_sysdeps_swap =
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
(1 << GLIBTOP_SWAP_PAGEOUT);

View File

@@ -164,7 +164,7 @@ static void init_sysinfo(void)
if (_system_configuration.cache_attrib & (1 << 31))
{
/* L1 cache is present */
sprintf(buf,"%d", _system_configuration.icache_size);
add_info( &sysinfo.cpuinfo[cpu], "L1 instruction cache size", buf);

View File

@@ -54,7 +54,7 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
glibtop_cpu cpu;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
memset (buf, 0, sizeof (glibtop_uptime));
/* We simply calculate it from the CPU usage. */

View File

@@ -1,6 +1,6 @@
/* $Id$ */
/*
/*
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, March 1999.
@@ -26,7 +26,7 @@
G_BEGIN_DECLS
extern off_t
extern off_t
_glibtop_get_kmem_offset(glibtop* server, char* kname);
extern int

View File

@@ -30,7 +30,7 @@
static void
print_server_name (glibtop *server)
{
fprintf (stderr, "%s: ", server ?
fprintf (stderr, "%s: ", server ?
(server->name ? server->name : DEFAULT_NAME)
: DEFAULT_NAME);
}
@@ -38,7 +38,7 @@ print_server_name (glibtop *server)
void
glibtop_error_vr (glibtop *server, char *format, va_list args)
{
print_server_name (server);
print_server_name (server);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");

View File

@@ -32,7 +32,7 @@
static void
print_server_name (glibtop_server *server)
{
fprintf (stderr, "%s: ", server ?
fprintf (stderr, "%s: ", server ?
(server->name ? server->name : DEFAULT_NAME)
: DEFAULT_NAME);
}
@@ -40,7 +40,7 @@ print_server_name (glibtop_server *server)
void
glibtop_error_vr (glibtop_server *server, char *format, va_list args)
{
print_server_name (server);
print_server_name (server);
vfprintf (stderr, format, args);
fprintf (stderr, "\n");

View File

@@ -1,5 +1,5 @@
/* fsusage-frontend.c -- return space usage of mounted filesystems.
Copyright (C) 2003 Ole Laursen.
This program is free software; you can redistribute it and/or modify
@@ -51,10 +51,10 @@ glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
struct fs_usage fsp;
glibtop_init_r (&server, 0, 0);
memset (buf, 0, sizeof (glibtop_fsusage));
memset (&fsp, 0, sizeof (struct fs_usage));
if (glibtop_private_get_fs_usage (disk, disk, &fsp) != 0)
return;

View File

@@ -1,22 +1,22 @@
/* -*-C-*-
* Common library code for the GNU Emacs server and client.
*
*
* This file is part of GNU Emacs.
*
*
* Copying is permitted under those conditions described by the GNU
* General Public License.
*
*
* Copyright (C) 1989 Free Software Foundation, Inc.
*
* Author: Andy Norman (ange@hplb.hpl.hp.com), based on
*
* Author: Andy Norman (ange@hplb.hpl.hp.com), based on
* 'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
* Emacs distribution.
*
*
* Please mail bugs and suggestions to the author at the above address.
*/
/* HISTORY
* 11-Nov-1990 bristor@simba
/* HISTORY
* 11-Nov-1990 bristor@simba
* Added EOT stuff.
*/
@@ -200,7 +200,7 @@ connect_to_unix_server (void)
* internet_addr -- return the internet addr of the hostname or
* internet address passed. Return -1 on error.
*/
long
long
glibtop_internet_addr (host)
const char *host;
{
@@ -228,7 +228,7 @@ static Xauth *server_xauth = NULL;
#endif
/*
* connect_to_internet_server -- establish connection with server process via
* connect_to_internet_server -- establish connection with server process via
* an internet domain socket. Returns socket
* descriptor for server if successful.
*/
@@ -257,7 +257,7 @@ connect_to_internet_server (const char *serverhost, u_short port)
else
peeraddr_in.sin_port = sp->s_port;
}
/* if */
/* if */
else
peeraddr_in.sin_port = htons (port);
@@ -326,7 +326,7 @@ disconnect_from_server (s, echo)
send_string (s, EOT_STR); /* make sure server gets string */
#if !defined (linux) && !defined (_SCO_DS)
/*
/*
* shutdown is completely hozed under linux. If s is a unix domain socket,
* you'll get EOPNOTSUPP back from it. If s is an internet socket, you get
* a broken pipe when you try to read a bit later. The latter

View File

@@ -59,9 +59,9 @@ glibtop_inodedb_open_s (glibtop *server, unsigned databases,
pwd = getpwuid (getuid ());
if (!pwd) glibtop_error_io_r (server, "getpwuid");
sprintf (filename, "%s/var/libgtop/inodedb.db", pwd->pw_dir);
if (stat (filename, &statb))
databases &= ~GLIBTOP_INODEDB_USER;
@@ -108,7 +108,7 @@ glibtop_inodedb_close_s (glibtop *server, glibtop_inodedb *inodedb)
{
if (inodedb->system_dbf)
gdbm_close (inodedb->system_dbf);
if (inodedb->user_dbf)
gdbm_close (inodedb->user_dbf);

View File

@@ -605,7 +605,7 @@ glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs)
for (count = 0, tmp = me; tmp; count++, tmp = next) {
g_strlcpy (mount_list [count].devname, tmp->me_devname,
g_strlcpy (mount_list [count].devname, tmp->me_devname,
GLIBTOP_MOUNTENTRY_LEN);
g_strlcpy (mount_list [count].mountdir, tmp->me_mountdir,
GLIBTOP_MOUNTENTRY_LEN);

View File

@@ -84,9 +84,9 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
/* sysctl vars*/
struct clockinfo ci;
size_t length;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0);
memset (buf, 0, sizeof (glibtop_cpu));
/* If this fails, the nlist may not be valid. */
@@ -106,7 +106,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
return;
}
#endif
/* Get the clockrate data */
length = sizeof (struct clockinfo);
if (sysctl (mib, mib_length, &ci, &length, NULL, 0)) {
@@ -122,12 +122,12 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
buf->sys = cpts [CP_SYS];
/* set idle time */
buf->idle = cpts [CP_IDLE];
/* set frequency */
/*
/*
FIXME -- is hz, tick, profhz or stathz wanted?
buf->frequency = sysctl("kern.clockrate", ...);
buf->frequency = sysctl("kern.clockrate", ...);
struct clockinfo
*/
buf->frequency = ci.hz;

View File

@@ -55,7 +55,7 @@ struct _glibtop_machine
{
uid_t uid, euid;
gid_t gid, egid;
/* The kernel descriptor, used by kvm_* calls. We keep and re-use
* it rather than re-getting it for almost all function
* invocations. */

View File

@@ -40,6 +40,6 @@ glibtop_init_r (glibtop **server,
glibtop_open (glibtop_global_server, "glibtop",
features, flags);
}
return *server = glibtop_global_server;
}

View File

@@ -43,15 +43,15 @@ glibtop_init_loadavg_p (glibtop *server)
void
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
{
double ldavg[3];
double ldavg[3];
int i;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_LOADAVG), 0);
memset (buf, 0, sizeof (glibtop_loadavg));
getloadavg (ldavg, 3);
/* fill in the struct */
buf->flags = _glibtop_sysdeps_loadavg;
for (i = 0; i < 3; i++) {

View File

@@ -130,7 +130,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
int bufspace;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MEM), 0);
memset (buf, 0, sizeof (glibtop_mem));
if (server->sysdeps.mem == 0)
@@ -167,7 +167,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
glibtop_warn_io_r (server, "kvm_read (bufspace)");
return;
}
/* convert memory stats to Kbytes */
#if defined(__FreeBSD__)

View File

@@ -64,7 +64,7 @@ static const unsigned long _glibtop_sysdeps_msg_limits =
* read it once during initialization. We have to use the name `_msginfo'
* since `msginfo' is already declared external in <sys/msg.h>. */
static struct msginfo _msginfo;
/* nlist structure for kernel access */
static struct nlist nlst [] = {
{ "_msginfo" },
@@ -80,7 +80,7 @@ glibtop_init_msg_limits_p (glibtop *server)
glibtop_warn_io_r (server, "kvm_nlist (msg_limits)");
return;
}
if (kvm_read (server->machine.kd, nlst [0].n_value,
&_msginfo, sizeof (_msginfo)) != sizeof (_msginfo)) {
glibtop_warn_io_r (server, "kvm_read (msginfo)");
@@ -96,7 +96,7 @@ void
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
{
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_msg_limits));
if (server->sysdeps.msg_limits == 0)
@@ -107,8 +107,8 @@ glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
buf->msgmnb = _msginfo.msgmnb;
buf->msgtql = _msginfo.msgtql;
buf->msgssz = _msginfo.msgtql;
buf->flags = _glibtop_sysdeps_msg_limits;
buf->flags = _glibtop_sysdeps_msg_limits;
}
#endif /* either a newer BSDI or no BSDI at all. */

View File

@@ -89,15 +89,15 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
struct ifaddr ifa;
struct in_ifaddr in;
} ifaddr;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_NETLOAD), 0);
memset (buf, 0, sizeof (glibtop_netload));
if (kvm_read (server->machine.kd, nlst [0].n_value,
&ifnetaddr, sizeof (ifnetaddr)) != sizeof (ifnetaddr))
glibtop_error_io_r (server, "kvm_read (ifnet)");
ifaddraddr = 0;
while (ifnetaddr || ifaddraddr) {
struct sockaddr_in *sin;
@@ -134,11 +134,11 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
if ((kvm_read (server->machine.kd, ifaddraddr, &ifaddr,
sizeof (ifaddr)) != sizeof (ifaddr)))
glibtop_error_io_r (server, "kvm_read (ifaddraddr)");
#define CP(x) ((char *)(x))
cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
CP(&ifaddr); sa = (struct sockaddr *)cp;
if (!strcmp (interface, tname) && (sa->sa_family == AF_INET)) {
sin = (struct sockaddr_in *)sa;
@@ -210,7 +210,7 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next;
#endif
}
#if defined(__FreeBSD__) && (__FreeBSD_version >= 300000)
ifnetaddr = (u_long) ifnet.if_link.tqe_next;
#elif defined(__FreeBSD__) || defined(__bsdi__)

View File

@@ -42,7 +42,7 @@ glibtop_init_p (glibtop *server, const unsigned long features,
for (init_fkt = _glibtop_init_hook_p; *init_fkt; init_fkt++)
(*init_fkt) (server);
server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
}
}
@@ -53,7 +53,7 @@ glibtop_open_p (glibtop *server, const char *program_name,
const unsigned flags)
{
#ifdef DEBUG
fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ());
fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ());
#endif
/* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
@@ -66,23 +66,23 @@ glibtop_open_p (glibtop *server, const char *program_name,
#ifdef __FreeBSD__
server->os_version_code = __FreeBSD_version;
#endif
/* Setup machine-specific data */
server->machine.kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "kvm_open");
if (server->machine.kd == NULL)
glibtop_error_io_r (server, "kvm_open");
/* Drop priviledges. */
/* Drop priviledges. */
if (setreuid (server->machine.euid, server->machine.uid))
_exit (1);
if (setregid (server->machine.egid, server->machine.gid))
_exit (1);
/* !!! END OF SUID ROOT PART !!! */
/* Our effective uid is now those of the user invoking the server,
* so we do no longer have any priviledges. */

View File

@@ -100,7 +100,7 @@ glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
int phase;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PPP), 0);
memset (buf, 0, sizeof (glibtop_ppp));
if (kvm_read (server->machine.kd, nlst [0].n_value,

View File

@@ -59,7 +59,7 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
#endif
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
memset (buf, 0, sizeof (glibtop_proc_args));
/* swapper, init, pagedaemon, vmdaemon, update - this doen't work. */

View File

@@ -85,9 +85,9 @@ glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid)
struct stat statb;
int nread;
FILE *f;
glibtop_init_r (&server, 0, 0);
memset (buf, 0, sizeof (glibtop_procdata));
if (pid == 0) {
@@ -97,27 +97,27 @@ glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid)
return;
}
sprintf (input, "/proc/%d/stat", pid);
if (stat (input, &statb)) return;
buf->uid = statb.st_uid;
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
@@ -142,7 +142,7 @@ glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid)
if (buf->tty == 0)
/* the old notty val, update elsewhere bef. moving to 0 */
buf->tty = -1;
fclose (f);
sprintf (input, "/proc/%d/statm", pid);

View File

@@ -104,7 +104,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
struct stat statb;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
memset (buf, 0, sizeof (glibtop_proc_kernel));
if (server->sysdeps.proc_time == 0)
@@ -112,7 +112,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1))
@@ -189,7 +189,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
buf->maj_flt = (guint64) pstats.p_ru.ru_majflt;
buf->cmin_flt = (guint64) pstats.p_cru.ru_minflt;
buf->cmaj_flt = (guint64) pstats.p_cru.ru_majflt;
buf->flags |= _glibtop_sysdeps_proc_kernel_pstats;
}

View File

@@ -67,7 +67,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
int i,j;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROCLIST), 0);
memset (buf, 0, sizeof (glibtop_proclist));
which = (int)(real_which & GLIBTOP_KERN_PROC_MASK);

View File

@@ -112,12 +112,12 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
int update = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MAP), 0);
memset (buf, 0, sizeof (glibtop_proc_map));
/* It does not work for the swapper task. */
if (pid == 0) return NULL;
glibtop_suid_enter (server);
/* Get the process data */
@@ -132,7 +132,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
(unsigned long) pinfo [0].ki_vmspace,
#else
(unsigned long) pinfo [0].kp_proc.p_vmspace,
#endif
#endif
(char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace))
glibtop_error_io_r (server, "kvm_read (vmspace)");
@@ -255,7 +255,7 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
if (!object.handle)
continue;
if (kvm_read (server->machine.kd,
(unsigned long) object.handle,
&vnode, sizeof (vnode)) != sizeof (vnode))

View File

@@ -129,7 +129,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
int count;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0);
memset (buf, 0, sizeof (glibtop_proc_mem));
if (server->sysdeps.proc_mem == 0)
@@ -137,7 +137,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process data */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count < 1)) {
@@ -167,14 +167,14 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
return;
}
buf->rss_rlim = (guint64)
buf->rss_rlim = (guint64)
(plimit.pl_rlimit [RLIMIT_RSS].rlim_cur);
vms = &pinfo [0].kp_eproc.e_vm;
buf->vsize = buf->size = (guint64) pagetok
(vms->vm_tsize + vms->vm_dsize + vms->vm_ssize) << LOG1024;
buf->resident = buf->rss = (guint64) pagetok
(vms->vm_rssize) << LOG1024;
#endif

View File

@@ -49,7 +49,7 @@ glibtop_get_proc_segment_p (glibtop *server,
pid_t pid)
{
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
memset (buf, 0, sizeof (glibtop_proc_segment));
#if 0
@@ -71,7 +71,7 @@ glibtop_get_proc_segment_p (glibtop *server,
/* dt: dirty pages
*/
/* start_code: address of beginning of code segment
*/
/* end_code: address of end of code segment
*/

View File

@@ -56,12 +56,12 @@ glibtop_get_proc_signal_p (glibtop *server,
int count = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
memset (buf, 0, sizeof (glibtop_proc_signal));
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1)) {
@@ -108,7 +108,7 @@ glibtop_get_proc_signal_p (glibtop *server,
#else
buf->blocked [0] = pinfo [0].kp_proc.p_sigmask;
#endif
/* sigignore: mask of ignored signals.
* pinfo [0].kp_proc.p_sigignore
*/
@@ -120,7 +120,7 @@ glibtop_get_proc_signal_p (glibtop *server,
#else
buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore;
#endif
/* sigcatch: mask of caught signals.
* pinfo [0].kp_proc.p_sigcatch
*/

View File

@@ -27,7 +27,7 @@
#include <glibtop_suid.h>
#if !defined(__OpenBSD__)
#if !defined(__OpenBSD__)
//&& (!defined __bsdi__)
#include <sys/user.h>
#endif
@@ -59,12 +59,12 @@ glibtop_get_proc_state_p (glibtop *server,
int count = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
memset (buf, 0, sizeof (glibtop_proc_state));
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1)) {

View File

@@ -138,12 +138,12 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
struct stat statb;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0);
memset (buf, 0, sizeof (glibtop_proc_time));
/* It does not work for the swapper task. */
if (pid == 0) return;
#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
if (server->sysdeps.proc_time == 0)
return;
@@ -188,7 +188,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
buf->utime = tv2sec (pstats.p_ru.ru_utime);
buf->stime = tv2sec (pstats.p_ru.ru_stime);
buf->cutime = tv2sec (pstats.p_cru.ru_utime);
buf->cstime = tv2sec (pstats.p_cru.ru_stime);
@@ -250,7 +250,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
buf->utime = tv2sec (pstats.p_ru.ru_utime);
buf->stime = tv2sec (pstats.p_ru.ru_stime);
buf->cutime = tv2sec (pstats.p_cru.ru_utime);
buf->cstime = tv2sec (pstats.p_cru.ru_stime);

View File

@@ -63,12 +63,12 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
#endif
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_UID), 0);
memset (buf, 0, sizeof (glibtop_proc_uid));
/* It does not work for the swapper task. */
if (pid == 0) return;
/* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1)) {

View File

@@ -66,7 +66,7 @@ static unsigned long _glibtop_sysdeps_sem_limits =
* read it once during initialization. We have to use the name `_seminfo'
* since `seminfo' is already declared external in <sys/sem.h>. */
static struct seminfo _seminfo;
/* nlist structure for kernel access */
static struct nlist nlst [] = {
{ "_seminfo" },
@@ -82,7 +82,7 @@ glibtop_init_sem_limits_p (glibtop *server)
glibtop_warn_io_r (server, "kvm_nlist (sem_limits)");
return;
}
if (kvm_read (server->machine.kd, nlst [0].n_value,
&_seminfo, sizeof (_seminfo)) != sizeof (_seminfo)) {
glibtop_warn_io_r (server, "kvm_read (seminfo)");
@@ -98,9 +98,9 @@ void
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
{
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_sem_limits));
if (server->sysdeps.sem_limits == 0)
return;
@@ -112,7 +112,7 @@ glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
buf->semopm = _seminfo.semopm;
buf->semvmx = _seminfo.semvmx;
buf->semaem = _seminfo.semaem;
buf->flags = _glibtop_sysdeps_sem_limits;
}

View File

@@ -64,7 +64,7 @@ static unsigned long _glibtop_sysdeps_shm_limits =
* read it once during initialization. We have to use the name `_shminfo'
* since `shminfo' is already declared external in <sys/shm.h>. */
static struct shminfo _shminfo;
/* nlist structure for kernel access */
static struct nlist nlst [] = {
{ "_shminfo" },
@@ -80,7 +80,7 @@ glibtop_init_shm_limits_p (glibtop *server)
glibtop_warn_io_r (server, "kvm_nlist (shm_limits)");
return;
}
if (kvm_read (server->machine.kd, nlst [0].n_value,
&_shminfo, sizeof (_shminfo)) != sizeof (_shminfo)) {
glibtop_warn_io_r (server, "kvm_read (shminfo)");
@@ -96,7 +96,7 @@ void
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
{
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_shm_limits));
if (server->sysdeps.shm_limits == 0)

View File

@@ -147,7 +147,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
struct kvm_swap kvmsw[16];
# endif
#elif defined(__bsdi__)
#elif defined(__bsdi__)
struct swapstats swap;
#elif defined(__NetBSD__)
struct swapent *swaplist;
@@ -167,7 +167,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
static int swappgsout = -1;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SWAP), 0);
memset (buf, 0, sizeof (glibtop_swap));
if (server->sysdeps.swap == 0)
@@ -181,7 +181,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
}
#else
/* This is used to get the `pagein' and `pageout' members. */
if (kvm_read (server->machine.kd, nlst2[0].n_value,
&vmm, sizeof (vmm)) != sizeof (vmm)) {
glibtop_warn_io_r (server, "kvm_read (cnt)");

View File

@@ -73,7 +73,7 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
glibtop_cpu cpu;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
memset (buf, 0, sizeof (glibtop_uptime));
/* We simply calculate it from the CPU usage. */

View File

@@ -45,14 +45,14 @@ void
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
{
union table tbl;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_LOADAVG, 0);
memset (buf, 0, sizeof (glibtop_loadavg));
if (table (TABLE_LOADAVG, &tbl, NULL))
glibtop_error_io_r (server, "table(TABLE_LOADAVG)");
buf->flags = _glibtop_sysdeps_loadavg;
buf->loadavg [0] = tbl.loadavg.loadavg [0];

View File

@@ -47,7 +47,7 @@ void
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
{
union table tbl;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
memset (buf, 0, sizeof (glibtop_mem));

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

@@ -36,7 +36,7 @@ static int linux_version_code = 0;
static void set_linux_version(void) {
static struct utsname uts;
int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */
if (linux_version_code) return;
if (uname(&uts) == -1) /* failure most likely implies impending death */
exit(1);
@@ -57,7 +57,7 @@ glibtop_open_s (glibtop *server, const char *program_name,
const unsigned long features, const unsigned flags)
{
server->name = program_name;
set_linux_version ();
server->os_version_code = (unsigned long) linux_version_code;
}

View File

@@ -86,9 +86,9 @@ glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid)
struct stat statb;
int nread;
FILE *f;
glibtop_init_s (&server, 0, 0);
memset (buf, 0, sizeof (glibtop_procdata));
if (pid == 0) {
@@ -98,27 +98,27 @@ glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid)
return;
}
sprintf (input, "/proc/%d/stat", pid);
if (stat (input, &statb)) return;
buf->uid = statb.st_uid;
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
@@ -152,7 +152,7 @@ glibtop_get_procdata_s (glibtop *server, glibtop_procdata *buf, pid_t pid)
if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1)
/* when tty wasn't full devno */
buf->tty = 4*0x100 + buf->tty;
fclose (f);
sprintf (input, "/proc/%d/statm", pid);

View File

@@ -48,16 +48,16 @@ glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
pid_t pid)
{
union table tbl;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
memset (buf, 0, sizeof (glibtop_proc_kernel));
if (table (TABLE_PROC_KERNEL, &tbl, &pid))
glibtop_error_io_r (server, "table(TABLE_PROC_KERNEL)");
buf->flags = _glibtop_sysdeps_proc_kernel;
buf->min_flt = tbl.proc_kernel.min_flt;
buf->cmin_flt = tbl.proc_kernel.cmin_flt;
buf->maj_flt = tbl.proc_kernel.maj_flt;

View File

@@ -41,8 +41,8 @@ glibtop_map_entry *
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
{
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
memset (buf, 0, sizeof (glibtop_proc_map));
return NULL;
}

Some files were not shown because too many files have changed in this diff Show More