diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2004-06-09 18:52:22 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2004-06-09 18:52:22 +0000 |
commit | 70b0925a826828e2fb7b683258f9c66eeb10142d (patch) | |
tree | 91865339a2378f177e2ad501a5d7e5c77a3fd19d | |
parent | b0edf88ff7f414f5ada8397eb98553a1d67d0728 (diff) | |
download | libgtop-70b0925a826828e2fb7b683258f9c66eeb10142d.tar.gz |
whitespace clean up.
* *.{c,h} : whitespace clean up.
190 files changed, 739 insertions, 735 deletions
@@ -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: diff --git a/backends/server/command.c b/backends/server/command.c index 6ef2d58c..f29251ba 100644 --- a/backends/server/command.c +++ b/backends/server/command.c @@ -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; diff --git a/backends/server/read_data.c b/backends/server/read_data.c index a385e326..b37fe2ab 100644 --- a/backends/server/read_data.c +++ b/backends/server/read_data.c @@ -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) diff --git a/backends/server/server.c b/backends/server/server.c index 6fa73dcc..a9917492 100644 --- a/backends/server/server.c +++ b/backends/server/server.c @@ -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); - } + } } diff --git a/backends/server/version.c b/backends/server/version.c index a52e25f4..62c8fd2b 100644 --- a/backends/server/version.c +++ b/backends/server/version.c @@ -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 diff --git a/backends/sysdeps/backend-sysdeps.c b/backends/sysdeps/backend-sysdeps.c index 3cb23213..168cd34f 100644 --- a/backends/sysdeps/backend-sysdeps.c +++ b/backends/sysdeps/backend-sysdeps.c @@ -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; } diff --git a/examples/first.c b/examples/first.c index b55dcf37..fc907a73 100644 --- a/examples/first.c +++ b/examples/first.c @@ -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, diff --git a/examples/mountlist.c b/examples/mountlist.c index 3458e552..f4a07d87 100644 --- a/examples/mountlist.c +++ b/examples/mountlist.c @@ -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); diff --git a/examples/netload.c b/examples/netload.c index 47cbc87a..ea87e330 100644 --- a/examples/netload.c +++ b/examples/netload.c @@ -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; diff --git a/examples/procmap.c b/examples/procmap.c index e6f20559..3d4ad660 100644 --- a/examples/procmap.c +++ b/examples/procmap.c @@ -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; diff --git a/examples/second.c b/examples/second.c index d87101f6..cb5a7a5b 100644 --- a/examples/second.c +++ b/examples/second.c @@ -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); } diff --git a/examples/smp.c b/examples/smp.c index fa385786..fd0c9553 100644 --- a/examples/smp.c +++ b/examples/smp.c @@ -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, diff --git a/examples/sysdeps.c b/examples/sysdeps.c index ec14e347..61fee334 100644 --- a/examples/sysdeps.c +++ b/examples/sysdeps.c @@ -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)); diff --git a/examples/third.c b/examples/third.c index 3d5adbad..10592d78 100644 --- a/examples/third.c +++ b/examples/third.c @@ -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, ""); diff --git a/examples/timings.c b/examples/timings.c index bcaba546..311b120d 100644 --- a/examples/timings.c +++ b/examples/timings.c @@ -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, diff --git a/include/glibtop/gnuserv.h b/include/glibtop/gnuserv.h index 6f945c71..66e97074 100644 --- a/include/glibtop/gnuserv.h +++ b/include/glibtop/gnuserv.h @@ -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) diff --git a/include/glibtop/ppp.h b/include/glibtop/ppp.h index 9fab24f7..02a45708 100644 --- a/include/glibtop/ppp.h +++ b/include/glibtop/ppp.h @@ -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 diff --git a/include/glibtop/procstate.h b/include/glibtop/procstate.h index 53b5ab6a..01748684 100644 --- a/include/glibtop/procstate.h +++ b/include/glibtop/procstate.h @@ -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. */ diff --git a/include/glibtop/proctime.h b/include/glibtop/proctime.h index b4c50368..64e547ba 100644 --- a/include/glibtop/proctime.h +++ b/include/glibtop/proctime.h @@ -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 */ diff --git a/kernel/sysctl/libgtop.c b/kernel/sysctl/libgtop.c index 8c769644..25e50db4 100644 --- a/kernel/sysctl/libgtop.c +++ b/kernel/sysctl/libgtop.c @@ -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; diff --git a/kernel/sysctl/libgtop.h b/kernel/sysctl/libgtop.h index f43a91c5..5fe35aa1 100644 --- a/kernel/sysctl/libgtop.h +++ b/kernel/sysctl/libgtop.h @@ -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; diff --git a/kernel/table.h b/kernel/table.h index d4959370..27460042 100644 --- a/kernel/table.h +++ b/kernel/table.h @@ -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; }; diff --git a/kernel/table20/main.c b/kernel/table20/main.c index 97950afb..9889c9fd 100644 --- a/kernel/table20/main.c +++ b/kernel/table20/main.c @@ -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; diff --git a/kernel/table20/unistd-i386.h b/kernel/table20/unistd-i386.h index 0d5b4f8b..4e379bc1 100644 --- a/kernel/table20/unistd-i386.h +++ b/kernel/table20/unistd-i386.h @@ -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) \ diff --git a/kernel/table21/module.c b/kernel/table21/module.c index 1c1fa9c2..0d59c707 100644 --- a/kernel/table21/module.c +++ b/kernel/table21/module.c @@ -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; diff --git a/kernel/table21/unistd-i386.h b/kernel/table21/unistd-i386.h index a7c30c83..e459b24b 100644 --- a/kernel/table21/unistd-i386.h +++ b/kernel/table21/unistd-i386.h @@ -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) \ diff --git a/lib/command.c b/lib/command.c index d95512bc..431d59fa 100644 --- a/lib/command.c +++ b/lib/command.c @@ -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); diff --git a/lib/error.c b/lib/error.c index 9b2abe7e..93585fdc 100644 --- a/lib/error.c +++ b/lib/error.c @@ -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"); diff --git a/lib/glibtop-backend.c b/lib/glibtop-backend.c index 84dea0d0..4db68809 100644 --- a/lib/glibtop-backend.c +++ b/lib/glibtop-backend.c @@ -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); } diff --git a/lib/glibtop-client.c b/lib/glibtop-client.c index 188b1d3e..a8f50f68 100644 --- a/lib/glibtop-client.c +++ b/lib/glibtop-client.c @@ -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); } @@ -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; } diff --git a/lib/inodedb.c b/lib/inodedb.c index 249ba86f..daa99944 100644 --- a/lib/inodedb.c +++ b/lib/inodedb.c @@ -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); @@ -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); } @@ -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; */ diff --git a/lib/read_data.c b/lib/read_data.c index 88b215b8..65a80e93 100644 --- a/lib/read_data.c +++ b/lib/read_data.c @@ -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 { diff --git a/misc/i4b_acct.h b/misc/i4b_acct.h index b5c3e479..87538f0f 100644 --- a/misc/i4b_acct.h +++ b/misc/i4b_acct.h @@ -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 diff --git a/src/daemon/gnuserv.c b/src/daemon/gnuserv.c index 192ef089..ae126b04 100644 --- a/src/daemon/gnuserv.c +++ b/src/daemon/gnuserv.c @@ -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 diff --git a/src/daemon/main.c b/src/daemon/main.c index 82272ff1..25530738 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -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); diff --git a/src/daemon/server.c b/src/daemon/server.c index 0657d5e9..d4a7c35b 100644 --- a/src/daemon/server.c +++ b/src/daemon/server.c @@ -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); diff --git a/src/daemon/server_config.h b/src/daemon/server_config.h index 09ae9ae8..595c5966 100644 --- a/src/daemon/server_config.h +++ b/src/daemon/server_config.h @@ -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]; diff --git a/src/daemon/slave.c b/src/daemon/slave.c index bd093173..5811ddc9 100644 --- a/src/daemon/slave.c +++ b/src/daemon/slave.c @@ -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 | diff --git a/src/daemon/version.c b/src/daemon/version.c index d80d6412..4c121ffa 100644 --- a/src/daemon/version.c +++ b/src/daemon/version.c @@ -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 diff --git a/src/inodedb/mkinodedb2.c b/src/inodedb/mkinodedb2.c index 30d41ddc..6317eb90 100644 --- a/src/inodedb/mkinodedb2.c +++ b/src/inodedb/mkinodedb2.c @@ -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); } diff --git a/sysdeps/aix/cpu.c b/sysdeps/aix/cpu.c index 81fb5c04..ad60fdc6 100644 --- a/sysdeps/aix/cpu.c +++ b/sysdeps/aix/cpu.c @@ -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; } diff --git a/sysdeps/aix/glibtop_machine.h b/sysdeps/aix/glibtop_machine.h index 8b4ebf5e..c20fdd19 100644 --- a/sysdeps/aix/glibtop_machine.h +++ b/sysdeps/aix/glibtop_machine.h @@ -1,6 +1,6 @@ /* $Id$ */ -/* +/* This file is part of LibGTop 1.0. Contributed by Martin Baulig <martin@home-of-linux.org>, March 1999. diff --git a/sysdeps/aix/loadavg.c b/sysdeps/aix/loadavg.c index 67913413..c4388e36 100644 --- a/sysdeps/aix/loadavg.c +++ b/sysdeps/aix/loadavg.c @@ -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. */ diff --git a/sysdeps/aix/mem.c b/sysdeps/aix/mem.c index c2811fd5..890f4fef 100644 --- a/sysdeps/aix/mem.c +++ b/sysdeps/aix/mem.c @@ -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); diff --git a/sysdeps/aix/msg_limits.c b/sysdeps/aix/msg_limits.c index 94bf4446..3b527f4d 100644 --- a/sysdeps/aix/msg_limits.c +++ b/sysdeps/aix/msg_limits.c @@ -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); diff --git a/sysdeps/aix/netload.c b/sysdeps/aix/netload.c index ffad1c66..61c80a99 100644 --- a/sysdeps/aix/netload.c +++ b/sysdeps/aix/netload.c @@ -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; diff --git a/sysdeps/aix/procargs.c b/sysdeps/aix/procargs.c index 3d0b3ee1..5e79374a 100644 --- a/sysdeps/aix/procargs.c +++ b/sysdeps/aix/procargs.c @@ -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); diff --git a/sysdeps/aix/proclist.c b/sysdeps/aix/proclist.c index a5746996..c5c52e01 100644 --- a/sysdeps/aix/proclist.c +++ b/sysdeps/aix/proclist.c @@ -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 diff --git a/sysdeps/aix/procmap.c b/sysdeps/aix/procmap.c index 5076ee07..58dad734 100644 --- a/sysdeps/aix/procmap.c +++ b/sysdeps/aix/procmap.c @@ -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; } diff --git a/sysdeps/aix/procmem.c b/sysdeps/aix/procmem.c index 2e7738d3..a98afda8 100644 --- a/sysdeps/aix/procmem.c +++ b/sysdeps/aix/procmem.c @@ -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; diff --git a/sysdeps/aix/procsegment.c b/sysdeps/aix/procsegment.c index b1cf02a1..bb1a42bd 100644 --- a/sysdeps/aix/procsegment.c +++ b/sysdeps/aix/procsegment.c @@ -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); diff --git a/sysdeps/aix/procsignal.c b/sysdeps/aix/procsignal.c index 29dd88cb..26f76336 100644 --- a/sysdeps/aix/procsignal.c +++ b/sysdeps/aix/procsignal.c @@ -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; } diff --git a/sysdeps/aix/procstate.c b/sysdeps/aix/procstate.c index dbd03c7d..1bf60ba6 100644 --- a/sysdeps/aix/procstate.c +++ b/sysdeps/aix/procstate.c @@ -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'; diff --git a/sysdeps/aix/procuid.c b/sysdeps/aix/procuid.c index c5fe476f..f0b0115d 100644 --- a/sysdeps/aix/procuid.c +++ b/sysdeps/aix/procuid.c @@ -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) + diff --git a/sysdeps/aix/sem_limits.c b/sysdeps/aix/sem_limits.c index f3fce8d5..24418ffb 100644 --- a/sysdeps/aix/sem_limits.c +++ b/sysdeps/aix/sem_limits.c @@ -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) + diff --git a/sysdeps/aix/shm_limits.c b/sysdeps/aix/shm_limits.c index 67d20517..01a0e6ab 100644 --- a/sysdeps/aix/shm_limits.c +++ b/sysdeps/aix/shm_limits.c @@ -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); diff --git a/sysdeps/aix/swap.c b/sysdeps/aix/swap.c index 7e4db97c..85eb159b 100644 --- a/sysdeps/aix/swap.c +++ b/sysdeps/aix/swap.c @@ -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); diff --git a/sysdeps/aix/sysinfo.c b/sysdeps/aix/sysinfo.c index 8185c6cc..4c8a1be1 100644 --- a/sysdeps/aix/sysinfo.c +++ b/sysdeps/aix/sysinfo.c @@ -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); diff --git a/sysdeps/aix/uptime.c b/sysdeps/aix/uptime.c index 616d7283..edf18313 100644 --- a/sysdeps/aix/uptime.c +++ b/sysdeps/aix/uptime.c @@ -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. */ diff --git a/sysdeps/aix/utils.h b/sysdeps/aix/utils.h index b41796cc..b075e32f 100644 --- a/sysdeps/aix/utils.h +++ b/sysdeps/aix/utils.h @@ -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 diff --git a/sysdeps/common/error.c b/sysdeps/common/error.c index f334ec50..9936dcd4 100644 --- a/sysdeps/common/error.c +++ b/sysdeps/common/error.c @@ -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"); diff --git a/sysdeps/common/error_suid.c b/sysdeps/common/error_suid.c index 9b2abe7e..93585fdc 100644 --- a/sysdeps/common/error_suid.c +++ b/sysdeps/common/error_suid.c @@ -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"); diff --git a/sysdeps/common/fsusage-frontend.c b/sysdeps/common/fsusage-frontend.c index c1d35cbf..92aabbc0 100644 --- a/sysdeps/common/fsusage-frontend.c +++ b/sysdeps/common/fsusage-frontend.c @@ -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; diff --git a/sysdeps/common/gnuslib.c b/sysdeps/common/gnuslib.c index b486569c..2fb1a241 100644 --- a/sysdeps/common/gnuslib.c +++ b/sysdeps/common/gnuslib.c @@ -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 diff --git a/sysdeps/common/inodedb.c b/sysdeps/common/inodedb.c index 249ba86f..daa99944 100644 --- a/sysdeps/common/inodedb.c +++ b/sysdeps/common/inodedb.c @@ -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); diff --git a/sysdeps/common/mountlist.c b/sysdeps/common/mountlist.c index 9152c054..7f2b898e 100644 --- a/sysdeps/common/mountlist.c +++ b/sysdeps/common/mountlist.c @@ -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); diff --git a/sysdeps/freebsd/cpu.c b/sysdeps/freebsd/cpu.c index 1a0cf141..426188e2 100644 --- a/sysdeps/freebsd/cpu.c +++ b/sysdeps/freebsd/cpu.c @@ -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; diff --git a/sysdeps/freebsd/glibtop_machine.h b/sysdeps/freebsd/glibtop_machine.h index 8df2bf1b..7c1cb920 100644 --- a/sysdeps/freebsd/glibtop_machine.h +++ b/sysdeps/freebsd/glibtop_machine.h @@ -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. */ diff --git a/sysdeps/freebsd/init.c b/sysdeps/freebsd/init.c index 11d89342..241754f3 100644 --- a/sysdeps/freebsd/init.c +++ b/sysdeps/freebsd/init.c @@ -40,6 +40,6 @@ glibtop_init_r (glibtop **server, glibtop_open (glibtop_global_server, "glibtop", features, flags); } - + return *server = glibtop_global_server; } diff --git a/sysdeps/freebsd/loadavg.c b/sysdeps/freebsd/loadavg.c index b0530e8a..569fb733 100644 --- a/sysdeps/freebsd/loadavg.c +++ b/sysdeps/freebsd/loadavg.c @@ -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++) { diff --git a/sysdeps/freebsd/mem.c b/sysdeps/freebsd/mem.c index a892983d..ccaf7c6d 100644 --- a/sysdeps/freebsd/mem.c +++ b/sysdeps/freebsd/mem.c @@ -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__) diff --git a/sysdeps/freebsd/msg_limits.c b/sysdeps/freebsd/msg_limits.c index e4752bf3..d0013fdf 100644 --- a/sysdeps/freebsd/msg_limits.c +++ b/sysdeps/freebsd/msg_limits.c @@ -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. */ diff --git a/sysdeps/freebsd/netload.c b/sysdeps/freebsd/netload.c index a2615e8b..dd52f7c8 100644 --- a/sysdeps/freebsd/netload.c +++ b/sysdeps/freebsd/netload.c @@ -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__) diff --git a/sysdeps/freebsd/open.c b/sysdeps/freebsd/open.c index 3689c159..8546ae2c 100644 --- a/sysdeps/freebsd/open.c +++ b/sysdeps/freebsd/open.c @@ -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. */ diff --git a/sysdeps/freebsd/ppp.c b/sysdeps/freebsd/ppp.c index 41ab1b36..af94c9b2 100644 --- a/sysdeps/freebsd/ppp.c +++ b/sysdeps/freebsd/ppp.c @@ -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, diff --git a/sysdeps/freebsd/procargs.c b/sysdeps/freebsd/procargs.c index 2730d2cf..8b19109c 100644 --- a/sysdeps/freebsd/procargs.c +++ b/sysdeps/freebsd/procargs.c @@ -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. */ diff --git a/sysdeps/freebsd/procdata.c b/sysdeps/freebsd/procdata.c index 65890cef..e8503cbf 100644 --- a/sysdeps/freebsd/procdata.c +++ b/sysdeps/freebsd/procdata.c @@ -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); diff --git a/sysdeps/freebsd/prockernel.c b/sysdeps/freebsd/prockernel.c index d601fea7..0d633770 100644 --- a/sysdeps/freebsd/prockernel.c +++ b/sysdeps/freebsd/prockernel.c @@ -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; } diff --git a/sysdeps/freebsd/proclist.c b/sysdeps/freebsd/proclist.c index 904905db..902c9754 100644 --- a/sysdeps/freebsd/proclist.c +++ b/sysdeps/freebsd/proclist.c @@ -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); diff --git a/sysdeps/freebsd/procmap.c b/sysdeps/freebsd/procmap.c index d3ad3eef..d8ac5b8b 100644 --- a/sysdeps/freebsd/procmap.c +++ b/sysdeps/freebsd/procmap.c @@ -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)) diff --git a/sysdeps/freebsd/procmem.c b/sysdeps/freebsd/procmem.c index 66a12c50..51f3a37c 100644 --- a/sysdeps/freebsd/procmem.c +++ b/sysdeps/freebsd/procmem.c @@ -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 diff --git a/sysdeps/freebsd/procsegment.c b/sysdeps/freebsd/procsegment.c index 915472ef..7e5473ad 100644 --- a/sysdeps/freebsd/procsegment.c +++ b/sysdeps/freebsd/procsegment.c @@ -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 */ diff --git a/sysdeps/freebsd/procsignal.c b/sysdeps/freebsd/procsignal.c index d8f83304..4b6fef19 100644 --- a/sysdeps/freebsd/procsignal.c +++ b/sysdeps/freebsd/procsignal.c @@ -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 */ diff --git a/sysdeps/freebsd/procstate.c b/sysdeps/freebsd/procstate.c index 094425e3..90c878a0 100644 --- a/sysdeps/freebsd/procstate.c +++ b/sysdeps/freebsd/procstate.c @@ -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)) { diff --git a/sysdeps/freebsd/proctime.c b/sysdeps/freebsd/proctime.c index 0b137cc3..a1571d86 100644 --- a/sysdeps/freebsd/proctime.c +++ b/sysdeps/freebsd/proctime.c @@ -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); diff --git a/sysdeps/freebsd/procuid.c b/sysdeps/freebsd/procuid.c index 2cc59284..53a4d40b 100644 --- a/sysdeps/freebsd/procuid.c +++ b/sysdeps/freebsd/procuid.c @@ -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)) { diff --git a/sysdeps/freebsd/sem_limits.c b/sysdeps/freebsd/sem_limits.c index c9a177de..36201468 100644 --- a/sysdeps/freebsd/sem_limits.c +++ b/sysdeps/freebsd/sem_limits.c @@ -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; } diff --git a/sysdeps/freebsd/shm_limits.c b/sysdeps/freebsd/shm_limits.c index 5abe88e8..d69ef1e0 100644 --- a/sysdeps/freebsd/shm_limits.c +++ b/sysdeps/freebsd/shm_limits.c @@ -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) diff --git a/sysdeps/freebsd/swap.c b/sysdeps/freebsd/swap.c index bdeec121..d2c64277 100644 --- a/sysdeps/freebsd/swap.c +++ b/sysdeps/freebsd/swap.c @@ -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)"); diff --git a/sysdeps/freebsd/uptime.c b/sysdeps/freebsd/uptime.c index 73275d7b..83ef50a0 100644 --- a/sysdeps/freebsd/uptime.c +++ b/sysdeps/freebsd/uptime.c @@ -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. */ diff --git a/sysdeps/kernel/loadavg.c b/sysdeps/kernel/loadavg.c index a31712d9..3c81d84a 100644 --- a/sysdeps/kernel/loadavg.c +++ b/sysdeps/kernel/loadavg.c @@ -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]; diff --git a/sysdeps/kernel/mem.c b/sysdeps/kernel/mem.c index 6e7e74d6..dd85de0a 100644 --- a/sysdeps/kernel/mem.c +++ b/sysdeps/kernel/mem.c @@ -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)); diff --git a/sysdeps/kernel/msg_limits.c b/sysdeps/kernel/msg_limits.c index 2ebd1b05..bd182db3 100644 --- a/sysdeps/kernel/msg_limits.c +++ b/sysdeps/kernel/msg_limits.c @@ -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; diff --git a/sysdeps/kernel/open.c b/sysdeps/kernel/open.c index bd4bf34b..260b899b 100644 --- a/sysdeps/kernel/open.c +++ b/sysdeps/kernel/open.c @@ -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; } diff --git a/sysdeps/kernel/procdata.c b/sysdeps/kernel/procdata.c index 64fa1583..aabebca9 100644 --- a/sysdeps/kernel/procdata.c +++ b/sysdeps/kernel/procdata.c @@ -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); diff --git a/sysdeps/kernel/prockernel.c b/sysdeps/kernel/prockernel.c index 4380d681..1c13dfbf 100644 --- a/sysdeps/kernel/prockernel.c +++ b/sysdeps/kernel/prockernel.c @@ -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; diff --git a/sysdeps/kernel/procmap.c b/sysdeps/kernel/procmap.c index 05a368c9..f5cfd940 100644 --- a/sysdeps/kernel/procmap.c +++ b/sysdeps/kernel/procmap.c @@ -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; } diff --git a/sysdeps/kernel/procmem.c b/sysdeps/kernel/procmem.c index de65f654..972af542 100644 --- a/sysdeps/kernel/procmem.c +++ b/sysdeps/kernel/procmem.c @@ -54,13 +54,13 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, if (table (TABLE_PROC_MEM, &tbl, &pid)) glibtop_error_io_r (server, "table(TABLE_PROC_MEM)"); - + buf->rss = tbl.proc_mem.rss; buf->rss_rlim = tbl.proc_mem.rlim; if (table (TABLE_PROC_SEGMENT, &tbl, &pid)) glibtop_error_io_r (server, "table(TABLE_PROC_SEGMENT)"); - + buf->flags = _glibtop_sysdeps_proc_mem; buf->vsize = tbl.proc_segment.vsize; diff --git a/sysdeps/kernel/procsegment.c b/sysdeps/kernel/procsegment.c index 2e6d3930..20fdc29f 100644 --- a/sysdeps/kernel/procsegment.c +++ b/sysdeps/kernel/procsegment.c @@ -59,7 +59,7 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf, if (table (TABLE_PROC_MEM, &tbl, &pid)) glibtop_error_io_r (server, "table(TABLE_PROC_MEM)"); - + buf->start_code = tbl.proc_mem.start_code; buf->end_code = tbl.proc_mem.end_code; buf->start_stack = tbl.proc_mem.start_stack; diff --git a/sysdeps/kernel/procuid.c b/sysdeps/kernel/procuid.c index 25012916..d934b9c7 100644 --- a/sysdeps/kernel/procuid.c +++ b/sysdeps/kernel/procuid.c @@ -53,7 +53,7 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, { union table tbl; long def_priority, priority, nice; - + glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_UID, 0); memset (buf, 0, sizeof (glibtop_proc_uid)); @@ -91,7 +91,7 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, if (buf->tty == 0) /* the old notty val, update elsewhere bef. moving to 0 */ buf->tty = -1; - + if (server->os_version_code < LINUX_VERSION(1,3,39)) { /* map old meanings to new */ buf->priority = 2*15 - buf->priority; @@ -100,6 +100,6 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, 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; - + buf->flags = _glibtop_sysdeps_proc_uid; } diff --git a/sysdeps/kernel/sem_limits.c b/sysdeps/kernel/sem_limits.c index f7402d29..4d227553 100644 --- a/sysdeps/kernel/sem_limits.c +++ b/sysdeps/kernel/sem_limits.c @@ -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; diff --git a/sysdeps/kernel/shm_limits.c b/sysdeps/kernel/shm_limits.c index d985217b..85a15618 100644 --- a/sysdeps/kernel/shm_limits.c +++ b/sysdeps/kernel/shm_limits.c @@ -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; diff --git a/sysdeps/kernel/swap.c b/sysdeps/kernel/swap.c index 34455327..f80a03dc 100644 --- a/sysdeps/kernel/swap.c +++ b/sysdeps/kernel/swap.c @@ -46,7 +46,7 @@ void glibtop_get_swap_s (glibtop *server, glibtop_swap *buf) { union table tbl; - + glibtop_init_s (&server, GLIBTOP_SYSDEPS_SWAP, 0); memset (buf, 0, sizeof (glibtop_swap)); diff --git a/sysdeps/kernel/sysinfo.c b/sysdeps/kernel/sysinfo.c index 49f374c4..2a42eaac 100644 --- a/sysdeps/kernel/sysinfo.c +++ b/sysdeps/kernel/sysinfo.c @@ -57,7 +57,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; } diff --git a/sysdeps/kernel/uptime.c b/sysdeps/kernel/uptime.c index b76a1e95..4f07b570 100644 --- a/sysdeps/kernel/uptime.c +++ b/sysdeps/kernel/uptime.c @@ -46,14 +46,14 @@ void glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf) { union table tbl; - + glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0); memset (buf, 0, sizeof (glibtop_uptime)); if (table (TABLE_UPTIME, &tbl, NULL)) glibtop_error_io_r (server, "table(TABLE_UPTIME)"); - + buf->flags = _glibtop_sysdeps_uptime; #if 0 diff --git a/sysdeps/linux/msg_limits.c b/sysdeps/linux/msg_limits.c index 81d19c1f..e2613c25 100644 --- a/sysdeps/linux/msg_limits.c +++ b/sysdeps/linux/msg_limits.c @@ -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; diff --git a/sysdeps/linux/netload.c b/sysdeps/linux/netload.c index c22989ff..d08d6482 100644 --- a/sysdeps/linux/netload.c +++ b/sysdeps/linux/netload.c @@ -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; diff --git a/sysdeps/linux/ppp.c b/sysdeps/linux/ppp.c index 7148aaa3..3f4ab222 100644 --- a/sysdeps/linux/ppp.c +++ b/sysdeps/linux/ppp.c @@ -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; } diff --git a/sysdeps/linux/procargs.c b/sysdeps/linux/procargs.c index 6db194d6..6c9ae544 100644 --- a/sysdeps/linux/procargs.c +++ b/sysdeps/linux/procargs.c @@ -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; } diff --git a/sysdeps/linux/prockernel.c b/sysdeps/linux/prockernel.c index 6fa34ce6..ba6fa2e8 100644 --- a/sysdeps/linux/prockernel.c +++ b/sysdeps/linux/prockernel.c @@ -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; diff --git a/sysdeps/linux/proclist.c b/sysdeps/linux/proclist.c index 23e9761d..9728ee92 100644 --- a/sysdeps/linux/proclist.c +++ b/sysdeps/linux/proclist.c @@ -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 diff --git a/sysdeps/linux/procmap.c b/sysdeps/linux/procmap.c index 0cf34ced..f217bc75 100644 --- a/sysdeps/linux/procmap.c +++ b/sysdeps/linux/procmap.c @@ -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; diff --git a/sysdeps/linux/procmem.c b/sysdeps/linux/procmem.c index 313ed0a5..c0562de3 100644 --- a/sysdeps/linux/procmem.c +++ b/sysdeps/linux/procmem.c @@ -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)); diff --git a/sysdeps/linux/procsegment.c b/sysdeps/linux/procsegment.c index 48fd0f59..8fc4b4b9 100644 --- a/sysdeps/linux/procsegment.c +++ b/sysdeps/linux/procsegment.c @@ -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)); diff --git a/sysdeps/linux/procsignal.c b/sysdeps/linux/procsignal.c index 6260428d..d7547ea9 100644 --- a/sysdeps/linux/procsignal.c +++ b/sysdeps/linux/procsignal.c @@ -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)); diff --git a/sysdeps/linux/procstate.c b/sysdeps/linux/procstate.c index e3bb9221..71653639 100644 --- a/sysdeps/linux/procstate.c +++ b/sysdeps/linux/procstate.c @@ -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; diff --git a/sysdeps/linux/proctime.c b/sysdeps/linux/proctime.c index e1f500fa..eb1c2d2b 100644 --- a/sysdeps/linux/proctime.c +++ b/sysdeps/linux/proctime.c @@ -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)); diff --git a/sysdeps/linux/sem_limits.c b/sysdeps/linux/sem_limits.c index 531b5f17..cd6c5bd8 100644 --- a/sysdeps/linux/sem_limits.c +++ b/sysdeps/linux/sem_limits.c @@ -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; diff --git a/sysdeps/linux/shm_limits.c b/sysdeps/linux/shm_limits.c index 859160f1..a1b6f282 100644 --- a/sysdeps/linux/shm_limits.c +++ b/sysdeps/linux/shm_limits.c @@ -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; diff --git a/sysdeps/linux/swap.c b/sysdeps/linux/swap.c index eb018123..b7b9b7be 100644 --- a/sysdeps/linux/swap.c +++ b/sysdeps/linux/swap.c @@ -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; diff --git a/sysdeps/linux/sysinfo.c b/sysdeps/linux/sysinfo.c index 157936a5..5761b1a8 100644 --- a/sysdeps/linux/sysinfo.c +++ b/sysdeps/linux/sysinfo.c @@ -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; } diff --git a/sysdeps/names/cpu.c b/sysdeps/names/cpu.c index 2ae5b452..2c6f8329 100644 --- a/sysdeps/names/cpu.c +++ b/sysdeps/names/cpu.c @@ -32,7 +32,7 @@ const char *glibtop_names_cpu [GLIBTOP_MAX_CPU] = }; const unsigned glibtop_types_cpu [GLIBTOP_MAX_CPU] = -{ +{ GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, diff --git a/sysdeps/names/fsusage.c b/sysdeps/names/fsusage.c index 10a63bc3..d4620405 100644 --- a/sysdeps/names/fsusage.c +++ b/sysdeps/names/fsusage.c @@ -30,7 +30,7 @@ const char *glibtop_names_fsusage [GLIBTOP_MAX_FSUSAGE] = }; const unsigned glibtop_types_fsusage [GLIBTOP_MAX_FSUSAGE] = -{ +{ GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG }; diff --git a/sysdeps/names/mem.c b/sysdeps/names/mem.c index dc20fd02..15a22275 100644 --- a/sysdeps/names/mem.c +++ b/sysdeps/names/mem.c @@ -25,13 +25,13 @@ #include "libgtop-i18n.h" const char *glibtop_names_mem [GLIBTOP_MAX_MEM] = -{ +{ "total", "used", "free", "shared", "buffer", "cached", "user", "locked" }; const unsigned glibtop_types_mem [GLIBTOP_MAX_MEM] = -{ +{ GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG diff --git a/sysdeps/names/netload.c b/sysdeps/names/netload.c index f87d4645..a49ded10 100644 --- a/sysdeps/names/netload.c +++ b/sysdeps/names/netload.c @@ -33,7 +33,7 @@ const char *glibtop_names_netload [GLIBTOP_MAX_NETLOAD] = }; const unsigned glibtop_types_netload [GLIBTOP_MAX_NETLOAD] = -{ +{ GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, diff --git a/sysdeps/names/ppp.c b/sysdeps/names/ppp.c index e73d3555..9d3bf519 100644 --- a/sysdeps/names/ppp.c +++ b/sysdeps/names/ppp.c @@ -30,7 +30,7 @@ const char *glibtop_names_ppp [GLIBTOP_MAX_PPP] = }; const unsigned glibtop_types_ppp [GLIBTOP_MAX_PPP] = -{ +{ GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG }; diff --git a/sysdeps/names/procuid.c b/sysdeps/names/procuid.c index 02142725..b2c532c4 100644 --- a/sysdeps/names/procuid.c +++ b/sysdeps/names/procuid.c @@ -27,7 +27,7 @@ const char *glibtop_names_proc_uid [GLIBTOP_MAX_PROC_UID] = { - "uid", "euid", "gid", "egid", "suid", "sgid", + "uid", "euid", "gid", "egid", "suid", "sgid", "fsuid", "fsgid", "pid", "ppid", "pgrp", "session", "tty", "tpgid", "priority", "nice", "ngroups", "groups" diff --git a/sysdeps/osf1/cpu.c b/sysdeps/osf1/cpu.c index 680c11f8..b8ccfc85 100644 --- a/sysdeps/osf1/cpu.c +++ b/sysdeps/osf1/cpu.c @@ -45,23 +45,23 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf) { struct tbl_sysinfo sysinfo; int ret; - + glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0); memset (buf, 0, sizeof (glibtop_cpu)); - + ret = table (TBL_SYSINFO, 0, (char *) &sysinfo, 1, - sizeof (struct tbl_sysinfo)); + sizeof (struct tbl_sysinfo)); if (ret != 1) return; buf->flags = _glibtop_sysdeps_cpu; - + buf->user = sysinfo.si_user; buf->nice = sysinfo.si_nice; buf->sys = sysinfo.si_sys; buf->idle = sysinfo.si_idle; - + buf->total = sysinfo.si_user + sysinfo.si_nice + sysinfo.si_sys + sysinfo.si_idle; diff --git a/sysdeps/osf1/loadavg.c b/sysdeps/osf1/loadavg.c index abf88ec7..3220492c 100644 --- a/sysdeps/osf1/loadavg.c +++ b/sysdeps/osf1/loadavg.c @@ -47,24 +47,24 @@ glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf) glibtop_init_s (&server, GLIBTOP_SYSDEPS_LOADAVG, 0); memset (buf, 0, sizeof (glibtop_loadavg)); - + ret = table (TBL_LOADAVG, 0, (char *) &loadavg, 1, - sizeof (struct tbl_loadavg)); + sizeof (struct tbl_loadavg)); if (ret != 1) return; buf->flags = _glibtop_sysdeps_loadavg; - + if (loadavg.tl_lscale == 0) { buf->loadavg [0] = loadavg.tl_avenrun.d [0]; buf->loadavg [1] = loadavg.tl_avenrun.d [1]; buf->loadavg [2] = loadavg.tl_avenrun.d [2]; } else { - buf->loadavg [0] = + buf->loadavg [0] = (double) loadavg.tl_avenrun.l [0] / (double) loadavg.tl_mach_factor [0]; buf->loadavg [1] = - (double) loadavg.tl_avenrun.l [1] + (double) loadavg.tl_avenrun.l [1] / (double) loadavg.tl_mach_factor [1]; buf->loadavg [2] = (double) loadavg.tl_avenrun.l [2] / diff --git a/sysdeps/osf1/mem.c b/sysdeps/osf1/mem.c index d76e595c..b1010589 100644 --- a/sysdeps/osf1/mem.c +++ b/sysdeps/osf1/mem.c @@ -55,14 +55,14 @@ glibtop_get_mem_s (glibtop *server, glibtop_mem *buf) memset (buf, 0, sizeof (glibtop_mem)); buf->flags = _glibtop_sysdeps_mem; - + (void) vm_statistics(task_self(), &vmstats); buf->free = vmstats.free_count * vmstats.pagesize; buf->used = vmstats.active_count * vmstats.pagesize; /* [FIXME]: Is this correct? */ - + buf->total = (vmstats.active_count + vmstats.inactive_count + vmstats.free_count + vmstats.wire_count) * vmstats.pagesize; diff --git a/sysdeps/osf1/msg_limits.c b/sysdeps/osf1/msg_limits.c index 2b198963..2d73bf92 100644 --- a/sysdeps/osf1/msg_limits.c +++ b/sysdeps/osf1/msg_limits.c @@ -27,7 +27,7 @@ static const unsigned long _glibtop_sysdeps_msg_limits = (1L << GLIBTOP_IPC_MSGMAP) + (1L << GLIBTOP_IPC_MSGMAX) + -(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) + +(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) + (1L << GLIBTOP_IPC_MSGTQL); /* Init function. */ @@ -48,36 +48,36 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) glibtop_init_s (&server, 0, 0); memset (buf, 0, sizeof (glibtop_msg_limits)); - + ret = table (TBL_MSGINFO, MSGINFO_MAX, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; - + buf->flags += (1L << GLIBTOP_IPC_MSGMAX); buf->msgmax = value; - + ret = table (TBL_MSGINFO, MSGINFO_MNB, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_MSGMNB); buf->msgmnb = value; - + ret = table (TBL_MSGINFO, MSGINFO_MNI, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_MSGMNI); buf->msgmni = value; - + ret = table (TBL_MSGINFO, MSGINFO_TQL, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; diff --git a/sysdeps/osf1/open_suid.c b/sysdeps/osf1/open_suid.c index d593556a..95f9d360 100644 --- a/sysdeps/osf1/open_suid.c +++ b/sysdeps/osf1/open_suid.c @@ -47,7 +47,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_INIT; } } @@ -61,7 +61,7 @@ glibtop_open_p (glibtop *server, const char *program_name, /* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */ server->name = program_name; - + server->machine.uid = getuid (); server->machine.euid = geteuid (); server->machine.gid = getgid (); @@ -69,22 +69,22 @@ glibtop_open_p (glibtop *server, const char *program_name, server->machine.proctable_entries = table (TBL_PROCINFO, 0, NULL, INT_MAX, 0); - + /* Drop priviledges; we only become root when necessary. - + setreuid (ruid, euid) - set real and effective user id; setregid (rgid, egid) - set real and effective group id; - + */ - + 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. */ diff --git a/sysdeps/osf1/procdata.c b/sysdeps/osf1/procdata.c index e82e64fa..952187a9 100644 --- a/sysdeps/osf1/procdata.c +++ b/sysdeps/osf1/procdata.c @@ -66,9 +66,9 @@ glibtop_get_procdata_r (glibtop *server, glibtop_procdata *buf, pid_t pid) glibtop_init (); memset (buf, 0, sizeof (glibtop_procdata)); - + ret = table (TBL_PROCINFO, pid, (char *) &procinfo, 1, - sizeof (struct tbl_procinfo)); + sizeof (struct tbl_procinfo)); if (ret != 1) return; @@ -85,63 +85,63 @@ glibtop_get_procdata_r (glibtop *server, glibtop_procdata *buf, pid_t pid) buf->sigignore = procinfo.pi_sigignore; buf->sigcatch = procinfo.pi_sigcatch; buf->signal = procinfo.pi_sig; - + buf->flags [0] += _glibtop_sysdeps_procdata_0; - + if (procinfo.pi_status != PI_ACTIVE) return; - + /* From that point on, we are only interested in active processes. */ - + buf->nice = getpriority (PRIO_PROCESS, pid); - + /* Get task structure. */ - + ret = task_by_unix_pid (task_self(), procinfo.pi_pid, &thistask); - + if (ret != KERN_SUCCESS) return; - + /* Get taskinfo about this task. */ - + info_count = TASK_BASIC_INFO_COUNT; - + ret = task_info (thistask, TASK_BASIC_INFO, (task_info_t) &taskinfo, &info_count); - + if (ret != KERN_SUCCESS) return; - + buf->priority = taskinfo.base_priority; buf->resident = taskinfo.resident_size; buf->rss = taskinfo.resident_size; buf->vsize = taskinfo.virtual_size; - + buf->flags [0] += BIT_SHIFT(GLIBTOP_PROCDATA_PRIORITY) + BIT_SHIFT(GLIBTOP_PROCDATA_RESIDENT) + BIT_SHIFT(GLIBTOP_PROCDATA_RSS) + BIT_SHIFT(GLIBTOP_PROCDATA_VSIZE); - + ret = table (TBL_UAREA, pid, (char *) &u, 1, sizeof (struct user)); - + if (ret != 1) return; - + buf->start_code = (unsigned long) u.u_text_start; buf->end_code = (unsigned long) u.u_data_start; buf->start_stack = (unsigned long) u.u_stack_start; - + buf->trs = u.u_tsize; buf->drs = u.u_dsize; - + buf->start_time = u.u_start.tv_sec; - + buf->utime = u.u_ru.ru_utime.tv_sec; buf->stime = u.u_ru.ru_stime.tv_sec; buf->cutime = u.u_cru.ru_utime.tv_sec; buf->cstime = u.u_cru.ru_stime.tv_sec; - + buf->flags [0] += BIT_SHIFT(GLIBTOP_PROCDATA_START_TIME) + BIT_SHIFT(GLIBTOP_PROCDATA_UTIME) + BIT_SHIFT(GLIBTOP_PROCDATA_STIME) + BIT_SHIFT(GLIBTOP_PROCDATA_CUTIME) + BIT_SHIFT(GLIBTOP_PROCDATA_CSTIME) + BIT_SHIFT(GLIBTOP_PROCDATA_TRS) + BIT_SHIFT(GLIBTOP_PROCDATA_DRS); - + buf->flags [1] += BIT_SHIFT(GLIBTOP_PROCDATA_START_CODE) + BIT_SHIFT(GLIBTOP_PROCDATA_END_CODE) + BIT_SHIFT(GLIBTOP_PROCDATA_START_STACK); diff --git a/sysdeps/osf1/prockernel.c b/sysdeps/osf1/prockernel.c index e7d961a1..e6417327 100644 --- a/sysdeps/osf1/prockernel.c +++ b/sysdeps/osf1/prockernel.c @@ -44,6 +44,6 @@ glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0); - + memset (buf, 0, sizeof (glibtop_proc_kernel)); } diff --git a/sysdeps/osf1/proclist.c b/sysdeps/osf1/proclist.c index 14ec1cb1..7ab357c4 100644 --- a/sysdeps/osf1/proclist.c +++ b/sysdeps/osf1/proclist.c @@ -61,7 +61,7 @@ glibtop_init_proclist_p (glibtop *server) * The calling function has to free the memory to which a pointer is returned. * * On error, NULL is returned and buf->flags is zero. */ - + /* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ unsigned * @@ -75,13 +75,13 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, int entry, max_elements, k; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROCLIST, 0); - + memset (buf, 0, sizeof (glibtop_proclist)); - + for (entry = 0; entry < server->machine.proctable_entries; entry += ELEMENTS_PER_ENTRY) { - /* !!! THE FOLLOWING CODE RUNS SUID ROOT - + /* !!! THE FOLLOWING CODE RUNS SUID ROOT - * CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); @@ -91,9 +91,9 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, ELEMENTS_PER_ENTRY, sizeof (struct tbl_procinfo)); glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + for (k = 0; k < max_elements; k++) { /* Does this entry contain a real process? */ @@ -124,17 +124,17 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, pids_size = new_size; pids_offset += BLOCK_COUNT; - + count = 0; } /* pids is now big enough to hold at least * one single pid. */ - + pids [count++] = procinfo [k].pi_pid; - + total++; - } + } } /* count is only zero if an error occured @@ -146,15 +146,15 @@ glibtop_get_proclist_p (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 (server, 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 diff --git a/sysdeps/osf1/procmem.c b/sysdeps/osf1/procmem.c index 05038c5b..d8617426 100644 --- a/sysdeps/osf1/procmem.c +++ b/sysdeps/osf1/procmem.c @@ -59,22 +59,22 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, struct user u; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_MEM, 0); - + memset (buf, 0, sizeof (glibtop_proc_mem)); /* Get task structure. */ - + ret = task_by_unix_pid (task_self(), pid, &thistask); - + if (ret != KERN_SUCCESS) return; - + /* Get taskinfo about this task. */ - + info_count = TASK_BASIC_INFO_COUNT; - + ret = task_info (thistask, TASK_BASIC_INFO, (task_info_t) &taskinfo, &info_count); - + if (ret != KERN_SUCCESS) return; buf->resident = taskinfo.resident_size; @@ -84,16 +84,16 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + ret = table (TBL_UAREA, pid, (char *) &u, 1, sizeof (struct user)); glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + if (ret != 1) return; - + buf->rss_rlim = u.u_rlimit [RLIMIT_RSS].rlim_cur; buf->share = u.u_ru.ru_ixrss; diff --git a/sysdeps/osf1/procsegment.c b/sysdeps/osf1/procsegment.c index 935a1b0b..5a664d4c 100644 --- a/sysdeps/osf1/procsegment.c +++ b/sysdeps/osf1/procsegment.c @@ -53,28 +53,28 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, struct user u; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0); - + memset (buf, 0, sizeof (glibtop_proc_segment)); /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + ret = table (TBL_UAREA, pid, (char *) &u, 1, sizeof (struct user)); glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + if (ret != 1) return; - + buf->start_code = (unsigned long) u.u_text_start; buf->end_code = (unsigned long) u.u_data_start; buf->start_stack = (unsigned long) u.u_stack_start; - + buf->text_rss = u.u_tsize; buf->data_rss = u.u_dsize; - + buf->flags = _glibtop_sysdeps_proc_segment; } diff --git a/sysdeps/osf1/procsignal.c b/sysdeps/osf1/procsignal.c index 36e1e2b9..3e4f1174 100644 --- a/sysdeps/osf1/procsignal.c +++ b/sysdeps/osf1/procsignal.c @@ -49,20 +49,20 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, int ret; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0); - + memset (buf, 0, sizeof (glibtop_proc_signal)); /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + ret = table (TBL_PROCINFO, pid, (char *) &procinfo, 1, - sizeof (struct tbl_procinfo)); + sizeof (struct tbl_procinfo)); glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + if (ret != 1) return; buf->signal [0] = procinfo.pi_sig; diff --git a/sysdeps/osf1/procstate.c b/sysdeps/osf1/procstate.c index 71447877..31edb4e4 100644 --- a/sysdeps/osf1/procstate.c +++ b/sysdeps/osf1/procstate.c @@ -55,20 +55,20 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, task_t thistask; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_STATE, 0); - + memset (buf, 0, sizeof (glibtop_proc_state)); /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + ret = table (TBL_PROCINFO, pid, (char *) &procinfo, 1, - sizeof (struct tbl_procinfo)); + sizeof (struct tbl_procinfo)); glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + if (ret != 1) return; /* Check whether the process actually exists. */ @@ -93,10 +93,10 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + /* Get task structure. */ ret = task_by_unix_pid (task_self(), procinfo.pi_pid, &thistask); - + if (ret == KERN_SUCCESS) { thread_array_t threadarr; unsigned int threadarr_l; @@ -116,7 +116,7 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, (thread_info_t) threadinfo, &threadinfo_l); if (tret == KERN_SUCCESS) { - if (minim_state > threadinfo->run_state) + if (minim_state > threadinfo->run_state) minim_state=threadinfo->run_state; } } @@ -125,20 +125,20 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, glibtop_suid_leave (server); /* !!! END OF SUID ROOT PART !!! */ - + if (ret != KERN_SUCCESS) return; switch (minim_state) { case TH_STATE_RUNNING: buf->state = GLIBTOP_PROCESS_RUNNING; break; - case TH_STATE_UNINTERRUPTIBLE: + case TH_STATE_UNINTERRUPTIBLE: buf->state = GLIBTOP_PROCESS_UNINTERRUPTIBLE; break; case TH_STATE_WAITING: buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE; break; - case TH_STATE_STOPPED: + case TH_STATE_STOPPED: case TH_STATE_HALTED: buf->state = GLIBTOP_PROCESS_STOPPED; break; diff --git a/sysdeps/osf1/proctime.c b/sysdeps/osf1/proctime.c index dc06da42..4208e926 100644 --- a/sysdeps/osf1/proctime.c +++ b/sysdeps/osf1/proctime.c @@ -52,28 +52,28 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, int ret; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_TIME, 0); - + memset (buf, 0, sizeof (glibtop_proc_time)); - + /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + ret = table (TBL_UAREA, pid, (char *) &u, 1, sizeof (struct user)); - + glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + if (ret != 1) return; buf->start_time = u.u_start.tv_sec; - + buf->utime = u.u_ru.ru_utime.tv_sec; buf->stime = u.u_ru.ru_stime.tv_sec; buf->cutime = u.u_cru.ru_utime.tv_sec; buf->cstime = u.u_cru.ru_stime.tv_sec; - buf->flags = _glibtop_sysdeps_proc_time; + buf->flags = _glibtop_sysdeps_proc_time; } diff --git a/sysdeps/osf1/procuid.c b/sysdeps/osf1/procuid.c index f5ca4636..5c12505d 100644 --- a/sysdeps/osf1/procuid.c +++ b/sysdeps/osf1/procuid.c @@ -60,50 +60,50 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, task_t thistask; glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_UID, 0); - + memset (buf, 0, sizeof (glibtop_proc_uid)); - + /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + ret = table (TBL_PROCINFO, pid, (char *) &procinfo, 1, - sizeof (struct tbl_procinfo)); + sizeof (struct tbl_procinfo)); glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + if (ret != 1) return; buf->uid = procinfo.pi_ruid; - buf->euid = procinfo.pi_svuid; + buf->euid = procinfo.pi_svuid; buf->gid = procinfo.pi_rgid; - buf->egid = procinfo.pi_svgid; - + buf->egid = procinfo.pi_svgid; + buf->pid = procinfo.pi_pid; buf->ppid = procinfo.pi_ppid; buf->pgrp = procinfo.pi_pgrp; buf->tty = procinfo.pi_ttyd; buf->session = procinfo.pi_session; buf->tpgid = procinfo.pi_tpgrp; - + buf->flags = _glibtop_sysdeps_proc_uid; - + /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + /* Get task structure. */ - + ret = task_by_unix_pid (task_self(), procinfo.pi_pid, &thistask); - + if (ret == KERN_SUCCESS) { /* Get taskinfo about this task. */ - + info_count = TASK_BASIC_INFO_COUNT; - + ret = task_info (thistask, TASK_BASIC_INFO, (task_info_t) &taskinfo, &info_count); @@ -111,22 +111,22 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, } glibtop_suid_leave (server); - + /* !!! END OF SUID ROOT PART !!! */ - + if (ret != KERN_SUCCESS) return; - + buf->priority = taskinfo.base_priority; - + buf->flags += (1L << GLIBTOP_PROC_UID_PRIORITY); errno = 0; - + ret = getpriority (PRIO_PROCESS, pid); - + if ((ret == -1) && (errno != 0)) return; - + buf->nice = ret; - + buf->flags += (1L << GLIBTOP_PROC_UID_NICE); } diff --git a/sysdeps/osf1/sem_limits.c b/sysdeps/osf1/sem_limits.c index 58512f0e..924890df 100644 --- a/sysdeps/osf1/sem_limits.c +++ b/sysdeps/osf1/sem_limits.c @@ -48,59 +48,59 @@ glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) glibtop_init_s (&server, 0, 0); memset (buf, 0, sizeof (glibtop_sem_limits)); - + ret = table (TBL_SEMINFO, SEMINFO_MNI, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_SEMMNI); buf->semmni = value; - - + + ret = table (TBL_SEMINFO, SEMINFO_MSL, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_SEMMSL); buf->semmsl = value; - - + + ret = table (TBL_SEMINFO, SEMINFO_OPM, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_SEMOPM); buf->semopm = value; - + ret = table (TBL_SEMINFO, SEMINFO_UME, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_SEMUME); buf->semume = value; - - + + ret = table (TBL_SEMINFO, SEMINFO_VMX, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_SEMVMX); buf->semvmx = value; - - + + ret = table (TBL_SEMINFO, SEMINFO_AEM, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; diff --git a/sysdeps/osf1/shm_limits.c b/sysdeps/osf1/shm_limits.c index 63689d31..9ce67a2a 100644 --- a/sysdeps/osf1/shm_limits.c +++ b/sysdeps/osf1/shm_limits.c @@ -47,43 +47,43 @@ glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) glibtop_init_s (&server, 0, 0); memset (buf, 0, sizeof (glibtop_shm_limits)); - + ret = table (TBL_SHMINFO, SHMINFO_MAX, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; buf->flags += (1L << GLIBTOP_IPC_SHMMAX); - + buf->shmmax = value; - + ret = table (TBL_SHMINFO, SHMINFO_MIN, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; - + buf->flags += (1L << GLIBTOP_IPC_SHMMIN); - + buf->shmmin = value; - + ret = table (TBL_SHMINFO, SHMINFO_MNI, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; - + buf->flags += (1L << GLIBTOP_IPC_SHMMNI); - + buf->shmmni = value; - + ret = table (TBL_SHMINFO, SHMINFO_SEG, (char *) &value, 1, - sizeof (value)); + sizeof (value)); if (ret != 1) return; - + buf->flags += (1L << GLIBTOP_IPC_SHMSEG); - + buf->shmseg = value; } diff --git a/sysdeps/osf1/swap.c b/sysdeps/osf1/swap.c index e1bdad08..917f8b4b 100644 --- a/sysdeps/osf1/swap.c +++ b/sysdeps/osf1/swap.c @@ -50,7 +50,7 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf) memset (buf, 0, sizeof (glibtop_swap)); i = 0; - + while (table (TBL_SWAPINFO, i, (char *) &swapinfo, 1, sizeof (struct tbl_swapinfo)) > 0) { buf->total += swapinfo.size * getpagesize (); @@ -59,6 +59,6 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf) } buf->flags = _glibtop_sysdeps_swap; - + buf->used = buf->total - buf->free; } diff --git a/sysdeps/osf1/uptime.c b/sysdeps/osf1/uptime.c index d77bfb5d..fbc7d4a2 100644 --- a/sysdeps/osf1/uptime.c +++ b/sysdeps/osf1/uptime.c @@ -44,15 +44,15 @@ void glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf) { struct tbl_sysinfo sysinfo; - + glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0); memset (buf, 0, sizeof (glibtop_uptime)); - + if(table (TBL_SYSINFO, 0, (char *) &sysinfo, 1, sizeof (struct tbl_sysinfo)) != 1) return; - + buf->uptime = (double) (time (NULL) - sysinfo.si_boottime); buf->boot_time = sysinfo.si_boottime; diff --git a/sysdeps/solaris/glibtop_machine.h b/sysdeps/solaris/glibtop_machine.h index 36de52ff..96dd4ae1 100644 --- a/sysdeps/solaris/glibtop_machine.h +++ b/sysdeps/solaris/glibtop_machine.h @@ -49,7 +49,7 @@ struct _glibtop_machine kvm_t *kd; kstat_ctl_t *kc; - + kstat_t *vminfo_kstat; hrtime_t vminfo_snaptime; vminfo_t vminfo; diff --git a/sysdeps/solaris/mem.c b/sysdeps/solaris/mem.c index 5365ed45..3be84e0f 100644 --- a/sysdeps/solaris/mem.c +++ b/sysdeps/solaris/mem.c @@ -52,7 +52,7 @@ glibtop_init_mem_s (glibtop *server) void glibtop_get_mem_s (glibtop *server, glibtop_mem *buf) { - kstat_ctl_t *kc = server->machine.kc; + kstat_ctl_t *kc = server->machine.kc; kstat_t *ksp; kstat_named_t *kn; int pagesize = server->machine.pagesize; diff --git a/sysdeps/solaris/open_suid.c b/sysdeps/solaris/open_suid.c index 502e7215..95d8ae95 100644 --- a/sysdeps/solaris/open_suid.c +++ b/sysdeps/solaris/open_suid.c @@ -47,7 +47,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_INIT; } } @@ -61,7 +61,7 @@ glibtop_open_p (glibtop *server, const char *program_name, /* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */ server->name = program_name; - + server->machine.uid = getuid (); server->machine.euid = geteuid (); server->machine.gid = getgid (); @@ -72,20 +72,20 @@ glibtop_open_p (glibtop *server, const char *program_name, glibtop_warn_io_r(server, "kvm_open()"); /* Drop priviledges; we only become root when necessary. - + setreuid (ruid, euid) - set real and effective user id; setregid (rgid, egid) - set real and effective group id; - + */ - + 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. */ diff --git a/sysdeps/solaris/proclist.c b/sysdeps/solaris/proclist.c index 32053972..84fb5ea1 100644 --- a/sysdeps/solaris/proclist.c +++ b/sysdeps/solaris/proclist.c @@ -206,12 +206,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++; } - + s_closedir (proc); /* count is only zero if an error occured (one a running Linux system, @@ -223,15 +223,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 diff --git a/sysdeps/solaris/procmap.c b/sysdeps/solaris/procmap.c index 2cd99bb0..e4d6f401 100644 --- a/sysdeps/solaris/procmap.c +++ b/sysdeps/solaris/procmap.c @@ -74,7 +74,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid) glibtop_map_entry *entry; struct stat inode; char buffer[BUFSIZ]; - + memset (buf, 0, sizeof (glibtop_proc_map)); #ifdef HAVE_PROCFS_H diff --git a/sysdeps/solaris/procsignal.c b/sysdeps/solaris/procsignal.c index 5b4d06a7..c20cb70f 100644 --- a/sysdeps/solaris/procsignal.c +++ b/sysdeps/solaris/procsignal.c @@ -26,7 +26,7 @@ #include <glibtop_private.h> -static const unsigned long _glibtop_sysdeps_proc_signal = +static const unsigned long _glibtop_sysdeps_proc_signal = (1L << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1L << GLIBTOP_PROC_SIGNAL_BLOCKED); /* Init function. */ @@ -51,7 +51,7 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, int size; memset (buf, 0, sizeof (glibtop_proc_signal)); - + if(glibtop_get_proc_status_s(server, &pstatus, pid)) return; diff --git a/sysdeps/solaris/procstate.c b/sysdeps/solaris/procstate.c index 01323085..75ef6a5a 100644 --- a/sysdeps/solaris/procstate.c +++ b/sysdeps/solaris/procstate.c @@ -73,7 +73,7 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid) switch(psinfo.pr_state) #endif { - case SONPROC: + case SONPROC: #if (LIBGTOP_VERSION_CODE >= 1001002) && defined(HAVE_PROCFS_H) buf->has_cpu = 1; buf->processor = psinfo.pr_lwp.pr_onpro; diff --git a/sysdeps/stub/procmap.c b/sysdeps/stub/procmap.c index 0626de71..c28fab88 100644 --- a/sysdeps/stub/procmap.c +++ b/sysdeps/stub/procmap.c @@ -42,8 +42,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; } diff --git a/sysdeps/stub_suid/cpu.c b/sysdeps/stub_suid/cpu.c index 7f05c827..5eb11297 100644 --- a/sysdeps/stub_suid/cpu.c +++ b/sysdeps/stub_suid/cpu.c @@ -43,6 +43,6 @@ void glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_CPU, 0); - + memset (buf, 0, sizeof (glibtop_cpu)); } diff --git a/sysdeps/stub_suid/init.c b/sysdeps/stub_suid/init.c index 0f643bd0..3d74cab2 100644 --- a/sysdeps/stub_suid/init.c +++ b/sysdeps/stub_suid/init.c @@ -40,6 +40,6 @@ glibtop_init_r (glibtop **server, glibtop_open (glibtop_global_server, "glibtop", features, flags); } - + return *server = glibtop_global_server; } diff --git a/sysdeps/stub_suid/loadavg.c b/sysdeps/stub_suid/loadavg.c index 6118d614..a59af22c 100644 --- a/sysdeps/stub_suid/loadavg.c +++ b/sysdeps/stub_suid/loadavg.c @@ -43,6 +43,6 @@ void glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_LOADAVG, 0); - + memset (buf, 0, sizeof (glibtop_loadavg)); } diff --git a/sysdeps/stub_suid/mem.c b/sysdeps/stub_suid/mem.c index 85c4fc5d..0a6b95a4 100644 --- a/sysdeps/stub_suid/mem.c +++ b/sysdeps/stub_suid/mem.c @@ -43,6 +43,6 @@ void glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_MEM, 0); - + memset (buf, 0, sizeof (glibtop_mem)); } diff --git a/sysdeps/stub_suid/msg_limits.c b/sysdeps/stub_suid/msg_limits.c index 7a2b8f93..07ee9ba9 100644 --- a/sysdeps/stub_suid/msg_limits.c +++ b/sysdeps/stub_suid/msg_limits.c @@ -43,6 +43,6 @@ void glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0); - + memset (buf, 0, sizeof (glibtop_msg_limits)); } diff --git a/sysdeps/stub_suid/open.c b/sysdeps/stub_suid/open.c index 86c2ab6f..b903acd9 100644 --- a/sysdeps/stub_suid/open.c +++ b/sysdeps/stub_suid/open.c @@ -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_INIT; } } @@ -60,16 +60,16 @@ glibtop_open_p (glibtop *server, const char *program_name, server->machine.gid = getgid (); server->machine.egid = getegid (); - /* 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. */ } diff --git a/sysdeps/stub_suid/procdata.c b/sysdeps/stub_suid/procdata.c index 1f24d61a..0991ca11 100644 --- a/sysdeps/stub_suid/procdata.c +++ b/sysdeps/stub_suid/procdata.c @@ -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_r (&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); diff --git a/sysdeps/stub_suid/prockernel.c b/sysdeps/stub_suid/prockernel.c index e7d961a1..e6417327 100644 --- a/sysdeps/stub_suid/prockernel.c +++ b/sysdeps/stub_suid/prockernel.c @@ -44,6 +44,6 @@ glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0); - + memset (buf, 0, sizeof (glibtop_proc_kernel)); } diff --git a/sysdeps/stub_suid/proclist.c b/sysdeps/stub_suid/proclist.c index 908dadb9..41b50e0f 100644 --- a/sysdeps/stub_suid/proclist.c +++ b/sysdeps/stub_suid/proclist.c @@ -42,7 +42,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, int64_t which, int64_t arg) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROCLIST, 0); - + memset (buf, 0, sizeof (glibtop_proclist)); return NULL; diff --git a/sysdeps/stub_suid/procmem.c b/sysdeps/stub_suid/procmem.c index 6084aa66..0282e3a4 100644 --- a/sysdeps/stub_suid/procmem.c +++ b/sysdeps/stub_suid/procmem.c @@ -44,6 +44,6 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_MEM, 0); - + memset (buf, 0, sizeof (glibtop_proc_mem)); } diff --git a/sysdeps/stub_suid/procsegment.c b/sysdeps/stub_suid/procsegment.c index 38499f83..9e77f23e 100644 --- a/sysdeps/stub_suid/procsegment.c +++ b/sysdeps/stub_suid/procsegment.c @@ -44,6 +44,6 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0); - + memset (buf, 0, sizeof (glibtop_proc_segment)); } diff --git a/sysdeps/stub_suid/procsignal.c b/sysdeps/stub_suid/procsignal.c index 9a89e8ab..ae1fe7d9 100644 --- a/sysdeps/stub_suid/procsignal.c +++ b/sysdeps/stub_suid/procsignal.c @@ -44,6 +44,6 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0); - + memset (buf, 0, sizeof (glibtop_proc_signal)); } diff --git a/sysdeps/stub_suid/procstate.c b/sysdeps/stub_suid/procstate.c index 576889c1..bfdfef58 100644 --- a/sysdeps/stub_suid/procstate.c +++ b/sysdeps/stub_suid/procstate.c @@ -44,6 +44,6 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_STATE, 0); - + memset (buf, 0, sizeof (glibtop_proc_state)); } diff --git a/sysdeps/stub_suid/proctime.c b/sysdeps/stub_suid/proctime.c index bc6c6c09..03408512 100644 --- a/sysdeps/stub_suid/proctime.c +++ b/sysdeps/stub_suid/proctime.c @@ -44,6 +44,6 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_TIME, 0); - + memset (buf, 0, sizeof (glibtop_proc_time)); } diff --git a/sysdeps/stub_suid/procuid.c b/sysdeps/stub_suid/procuid.c index e487375e..d058ecf4 100644 --- a/sysdeps/stub_suid/procuid.c +++ b/sysdeps/stub_suid/procuid.c @@ -44,6 +44,6 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, pid_t pid) { glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_UID, 0); - + memset (buf, 0, sizeof (glibtop_proc_uid)); } diff --git a/sysdeps/stub_suid/sem_limits.c b/sysdeps/stub_suid/sem_limits.c index b1aa85cd..c0404758 100644 --- a/sysdeps/stub_suid/sem_limits.c +++ b/sysdeps/stub_suid/sem_limits.c @@ -43,6 +43,6 @@ void glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0); - + memset (buf, 0, sizeof (glibtop_sem_limits)); } diff --git a/sysdeps/stub_suid/shm_limits.c b/sysdeps/stub_suid/shm_limits.c index 9aa3574c..feeb63d1 100644 --- a/sysdeps/stub_suid/shm_limits.c +++ b/sysdeps/stub_suid/shm_limits.c @@ -43,6 +43,6 @@ void glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0); - + memset (buf, 0, sizeof (glibtop_shm_limits)); } diff --git a/sysdeps/stub_suid/swap.c b/sysdeps/stub_suid/swap.c index 2c97ebc6..ce6aa972 100644 --- a/sysdeps/stub_suid/swap.c +++ b/sysdeps/stub_suid/swap.c @@ -43,6 +43,6 @@ void glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_SWAP, 0); - + memset (buf, 0, sizeof (glibtop_swap)); } diff --git a/sysdeps/stub_suid/uptime.c b/sysdeps/stub_suid/uptime.c index 76a1d5b6..3a72b5d7 100644 --- a/sysdeps/stub_suid/uptime.c +++ b/sysdeps/stub_suid/uptime.c @@ -43,6 +43,6 @@ void glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) { glibtop_init_p (server, GLIBTOP_SYSDEPS_UPTIME, 0); - + memset (buf, 0, sizeof (glibtop_uptime)); } diff --git a/sysdeps/sun4/cpu.c b/sysdeps/sun4/cpu.c index 9c27e538..94101c80 100644 --- a/sysdeps/sun4/cpu.c +++ b/sysdeps/sun4/cpu.c @@ -40,22 +40,22 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf) int i; glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_CPU), 0); - + memset (buf, 0, sizeof (glibtop_cpu)); /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ glibtop_suid_enter (server); - + /* get the cp_time array */ (void) _glibtop_getkval (server, _glibtop_nlist [X_CP_TIME].n_value, (int *) cp_time, sizeof (cp_time), _glibtop_nlist [X_CP_TIME].n_name); - + #ifdef MULTIPROCESSOR /* get the mp_time array as well */ - + if (server->machine.ncpu > 1) { (void) _glibtop_getkval (server, _glibtop_nlist [X_MP_TIME].n_value, (int *) mp_time, sizeof (mp_time), @@ -63,10 +63,10 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf) } #endif - glibtop_suid_leave (server); - + glibtop_suid_leave (server); + /* !!! END OF SUID ROOT PART !!! */ - + #ifdef MULTIPROCESSOR /* If we have multiple processors, we add the times for each of them * and set frequency to 100 times the number of the processors. */ diff --git a/sysdeps/sun4/loadavg.c b/sysdeps/sun4/loadavg.c index 530efb9a..fa765d11 100644 --- a/sysdeps/sun4/loadavg.c +++ b/sysdeps/sun4/loadavg.c @@ -42,9 +42,9 @@ glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf) memset (buf, 0, sizeof (glibtop_loadavg)); /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - + setregid (server->machine.gid, server->machine.egid); - + /* get the load average array */ (void) _glibtop_getkval (server, _glibtop_nlist [X_AVENRUN].n_value, @@ -53,7 +53,7 @@ glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf) if (setregid (server->machine.egid, server->machine.gid)) _exit (1); - + /* !!! END OF SGID KMEM PART !!! */ for (i = 0; i < 3; i++) { diff --git a/sysdeps/sun4/mem.c b/sysdeps/sun4/mem.c index 6bbac96b..7e8d7aeb 100644 --- a/sysdeps/sun4/mem.c +++ b/sysdeps/sun4/mem.c @@ -42,20 +42,20 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MEM), 0); memset (buf, 0, sizeof (glibtop_mem)); - + /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - + glibtop_suid_enter (server); - + /* get the array of physpage descriptors */ - + (void) _glibtop_getkval (server, server->machine.pages, (int *) server->machine.physpage, server->machine.bytesize, "array _page"); glibtop_suid_leave (server); - + /* !!! END OF SGID KMEM PART !!! */ @@ -65,7 +65,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) register int inuse; register int free; register int locked; - + /* bop thru the array counting page types */ pp = server->machine.physpage; @@ -80,7 +80,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) } /* convert memory stats to Kbytes */ - + buf->total = pagetok (inuse + free); buf->used = pagetok (inuse); buf->free = pagetok (free); diff --git a/sysdeps/sun4/msg_limits.c b/sysdeps/sun4/msg_limits.c index 7a01740c..154dc301 100644 --- a/sysdeps/sun4/msg_limits.c +++ b/sysdeps/sun4/msg_limits.c @@ -44,15 +44,15 @@ void glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) { struct msginfo msginfo; - + glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MSG_LIMITS), 0); memset (buf, 0, sizeof (glibtop_msg_limits)); - + /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - + setregid (server->machine.gid, server->machine.egid); - + /* get the load average array */ (void) _glibtop_getkval (server, _glibtop_nlist [X_MSGINFO].n_value, @@ -61,9 +61,9 @@ glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) if (setregid (server->machine.egid, server->machine.gid)) _exit (1); - + /* !!! END OF SGID KMEM PART !!! */ - + buf->msgmap = msginfo.msgmap; buf->msgmax = msginfo.msgmax; buf->msgmnb = msginfo.msgmnb; diff --git a/sysdeps/sun4/open.c b/sysdeps/sun4/open.c index 30b9d5f5..1e43bc8e 100644 --- a/sysdeps/sun4/open.c +++ b/sysdeps/sun4/open.c @@ -91,21 +91,21 @@ glibtop_open_p (glibtop *server, const char *program_name, /* initialize the kernel interface */ server->machine.kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "libgtop"); - + if (server->machine.kd == NULL) glibtop_error_io_r (server, "kvm_open"); - + /* get the list of symbols we want to access in the kernel */ - + server->machine.nlist_count = kvm_nlist (server->machine.kd, _glibtop_nlist); - + if (server->machine.nlist_count < 0) glibtop_error_io_r (server, "nlist"); #ifdef MULTIPROCESSOR /* were ncpu and xp_time not found in the nlist? */ - + if ((server->machine.nlist_count > 0) && (_glibtop_nlist[X_NCPU].n_type == 0) && (_glibtop_nlist[X_MP_TIME].n_type == 0)) { @@ -120,7 +120,7 @@ glibtop_open_p (glibtop *server, const char *program_name, #ifdef solbourne { unsigned int status, type; - + /* Get the number of CPUs on this system. */ syscall(SYS_getcpustatus, &status, &server->machine.ncpu, &type); @@ -152,7 +152,7 @@ glibtop_open_p (glibtop *server, const char *program_name, (server, server->machine.ptable_size); /* This are for the memory statistics. */ - + (void) _glibtop_getkval (server, _glibtop_nlist[X_PAGES].n_value, (int *)(&server->machine.pages), sizeof (server->machine.pages), @@ -187,16 +187,16 @@ glibtop_open_p (glibtop *server, const char *program_name, server->machine.pageshift -= LOG1024; - /* 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. */ @@ -214,12 +214,12 @@ int _glibtop_check_nlist (void *server, register struct nlist *nlst) { register int not_found; - + /* check to see if we got ALL the symbols we requested */ /* this will write one line to stderr for every symbol not found */ - + not_found = 0; - + while (nlst->n_name != NULL) { #ifdef i386 @@ -240,7 +240,7 @@ _glibtop_check_nlist (void *server, register struct nlist *nlst) nlst++; } - + return not_found; } @@ -255,11 +255,11 @@ _glibtop_getkval (void *void_server, unsigned long offset, int *ptr, if (kvm_read (server->machine.kd, offset, ptr, size) != size) { if (*refstr == '!') return 0; - + glibtop_error_r (server, "kvm_read(%s): %s", refstr, strerror (errno)); } - + return 1; } @@ -271,19 +271,19 @@ _glibtop_read_proc_table (void *void_server) glibtop *server = (glibtop *) void_server; /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - + setregid (server->machine.gid, server->machine.egid); - - /* Read process table from kernel. */ + + /* Read process table from kernel. */ (void) _glibtop_getkval (server, server->machine.ptable_offset, (int *) server->machine.proc_table, (size_t) server->machine.ptable_size, _glibtop_nlist[X_PROC].n_name); - + if (setregid (server->machine.egid, server->machine.gid)) _exit (1); - + /* !!! END OF SGID KMEM PART !!! */ } diff --git a/sysdeps/sun4/prockernel.c b/sysdeps/sun4/prockernel.c index 603e881b..3625225e 100644 --- a/sysdeps/sun4/prockernel.c +++ b/sysdeps/sun4/prockernel.c @@ -41,7 +41,7 @@ glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf, memset (buf, 0, sizeof (glibtop_proc_kernel)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); diff --git a/sysdeps/sun4/proclist.c b/sysdeps/sun4/proclist.c index a9bb80e1..af38ec79 100644 --- a/sysdeps/sun4/proclist.c +++ b/sysdeps/sun4/proclist.c @@ -50,7 +50,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, memset (buf, 0, sizeof (glibtop_proclist)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); diff --git a/sysdeps/sun4/procmem.c b/sysdeps/sun4/procmem.c index 979fc7af..23d6b478 100644 --- a/sysdeps/sun4/procmem.c +++ b/sysdeps/sun4/procmem.c @@ -42,7 +42,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, memset (buf, 0, sizeof (glibtop_proc_mem)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); diff --git a/sysdeps/sun4/procsegment.c b/sysdeps/sun4/procsegment.c index 8dd64bea..4ace858e 100644 --- a/sysdeps/sun4/procsegment.c +++ b/sysdeps/sun4/procsegment.c @@ -42,7 +42,7 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, memset (buf, 0, sizeof (glibtop_proc_segment)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); diff --git a/sysdeps/sun4/procsignal.c b/sysdeps/sun4/procsignal.c index 66a5a2bc..6a3e88ed 100644 --- a/sysdeps/sun4/procsignal.c +++ b/sysdeps/sun4/procsignal.c @@ -42,7 +42,7 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, memset (buf, 0, sizeof (glibtop_proc_signal)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); @@ -58,6 +58,6 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, buf->blocked [0] = pp->p_sigmask; buf->sigignore [0] = pp->p_sigignore; buf->sigcatch [0] = pp->p_sigcatch; - + buf->flags = _glibtop_sysdeps_proc_signal; } diff --git a/sysdeps/sun4/procstate.c b/sysdeps/sun4/procstate.c index 4ce3734d..372bf51c 100644 --- a/sysdeps/sun4/procstate.c +++ b/sysdeps/sun4/procstate.c @@ -41,7 +41,7 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, memset (buf, 0, sizeof (glibtop_proc_state)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); diff --git a/sysdeps/sun4/proctime.c b/sysdeps/sun4/proctime.c index 9541f948..353085fc 100644 --- a/sysdeps/sun4/proctime.c +++ b/sysdeps/sun4/proctime.c @@ -41,7 +41,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, memset (buf, 0, sizeof (glibtop_proc_time)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); diff --git a/sysdeps/sun4/procuid.c b/sysdeps/sun4/procuid.c index 5ff0e5bf..ef883fec 100644 --- a/sysdeps/sun4/procuid.c +++ b/sysdeps/sun4/procuid.c @@ -45,7 +45,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, memset (buf, 0, sizeof (glibtop_proc_uid)); - /* Read process table from kernel. */ + /* Read process table from kernel. */ _glibtop_read_proc_table (server); diff --git a/sysdeps/sun4/sem_limits.c b/sysdeps/sun4/sem_limits.c index e6f07c6c..47003813 100644 --- a/sysdeps/sun4/sem_limits.c +++ b/sysdeps/sun4/sem_limits.c @@ -46,15 +46,15 @@ void glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) { struct seminfo seminfo; - + glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SEM_LIMITS), 0); memset (buf, 0, sizeof (glibtop_sem_limits)); - + /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - + setregid (server->machine.gid, server->machine.egid); - + /* get the load average array */ (void) _glibtop_getkval (server, _glibtop_nlist [X_SEMINFO].n_value, @@ -63,9 +63,9 @@ glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) if (setregid (server->machine.egid, server->machine.gid)) _exit (1); - + /* !!! END OF SGID KMEM PART !!! */ - + buf->semmap = seminfo.semmap; buf->semmni = seminfo.semmni; buf->semmns = seminfo.semmns; diff --git a/sysdeps/sun4/shm_limits.c b/sysdeps/sun4/shm_limits.c index a5f638f2..a4e254cc 100644 --- a/sysdeps/sun4/shm_limits.c +++ b/sysdeps/sun4/shm_limits.c @@ -44,15 +44,15 @@ void glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) { struct shminfo shminfo; - + glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SHM_LIMITS), 0); memset (buf, 0, sizeof (glibtop_shm_limits)); - + /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - + setregid (server->machine.gid, server->machine.egid); - + /* get the load average array */ (void) _glibtop_getkval (server, _glibtop_nlist [X_SHMINFO].n_value, @@ -61,7 +61,7 @@ glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) if (setregid (server->machine.egid, server->machine.gid)) _exit (1); - + /* !!! END OF SGID KMEM PART !!! */ buf->shmmax = shminfo.shmmax; |