summaryrefslogtreecommitdiff
path: root/usr.bin/top
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-07-07 21:36:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-07-07 21:36:53 +0000
commit83036cf1c12eac42e9fcb4e6691ecc46dc8e654e (patch)
treec5d3ac18eb1b07a15bce95ace0ce7adb91c6f596 /usr.bin/top
parenta738290cbdde31b237de1a4fec2f5511fdf9ead7 (diff)
protos
Diffstat (limited to 'usr.bin/top')
-rw-r--r--usr.bin/top/machine.c18
-rw-r--r--usr.bin/top/machine.h4
-rw-r--r--usr.bin/top/top.c22
-rw-r--r--usr.bin/top/username.c3
-rw-r--r--usr.bin/top/utils.c3
5 files changed, 26 insertions, 24 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index fdcd85ee70a..f0825c9291d 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machine.c,v 1.35 2003/06/18 08:36:31 deraadt Exp $ */
+/* $OpenBSD: machine.c,v 1.36 2003/07/07 21:36:52 deraadt Exp $ */
/*-
* Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
@@ -146,7 +146,7 @@ static int pageshift; /* log base 2 of the pagesize */
unsigned int maxslp;
-int
+static int
getstathz(void)
{
struct clockinfo cinf;
@@ -260,7 +260,7 @@ get_system_info(struct system_info *si)
static struct handle handle;
-struct kinfo_proc *
+static struct kinfo_proc *
getprocs(int op, int arg, int *cnt)
{
size_t size = sizeof(int);
@@ -374,7 +374,7 @@ get_process_info(struct system_info *si, struct process_select *sel,
char fmt[MAX_COLS]; /* static area where result is built */
char *
-format_next_process(caddr_t handle, char *(*get_userid)())
+format_next_process(caddr_t handle, char *(*get_userid)(uid_t))
{
char *p_wait, waddr[sizeof(void *) * 2 + 3]; /* Hexify void pointer */
struct kinfo_proc *pp;
@@ -470,7 +470,7 @@ static unsigned char sorted_state[] =
if ((result = PROCSIZE(p2) - PROCSIZE(p1)) == 0)
/* compare_cpu - the comparison function for sorting by cpu percentage */
-int
+static int
compare_cpu(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
@@ -494,7 +494,7 @@ compare_cpu(const void *v1, const void *v2)
}
/* compare_size - the comparison function for sorting by total memory usage */
-int
+static int
compare_size(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
@@ -518,7 +518,7 @@ compare_size(const void *v1, const void *v2)
}
/* compare_res - the comparison function for sorting by resident set size */
-int
+static int
compare_res(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
@@ -542,7 +542,7 @@ compare_res(const void *v1, const void *v2)
}
/* compare_time - the comparison function for sorting by CPU time */
-int
+static int
compare_time(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
@@ -566,7 +566,7 @@ compare_time(const void *v1, const void *v2)
}
/* compare_prio - the comparison function for sorting by CPU time */
-int
+static int
compare_prio(const void *v1, const void *v2)
{
struct proc **pp1 = (struct proc **) v1;
diff --git a/usr.bin/top/machine.h b/usr.bin/top/machine.h
index 040c761604f..f360d89471f 100644
--- a/usr.bin/top/machine.h
+++ b/usr.bin/top/machine.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: machine.h,v 1.8 2003/06/15 16:24:44 millert Exp $ */
+/* $OpenBSD: machine.h,v 1.9 2003/07/07 21:36:52 deraadt Exp $ */
/*
* Top users/processes display for Unix
@@ -86,6 +86,6 @@ extern void get_system_info(struct system_info *);
extern caddr_t
get_process_info(struct system_info *, struct process_select *,
int (*) (const void *, const void *));
-extern char *format_next_process(caddr_t, char *(*) ());
+extern char *format_next_process(caddr_t, char *(*)(uid_t));
extern int proc_compate(const void *, const void *);
extern uid_t proc_owner(pid_t);
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index 9472a5567bd..3d70b81f873 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: top.c,v 1.26 2003/06/19 22:40:45 millert Exp $ */
+/* $OpenBSD: top.c,v 1.27 2003/07/07 21:36:52 deraadt Exp $ */
/*
* Top users/processes display for Unix
@@ -75,13 +75,13 @@ extern int (*proc_compares[])(const void *, const void *);
int order_index;
/* pointers to display routines */
-void (*d_loadave) () = i_loadave;
-void (*d_procstates) () = i_procstates;
-void (*d_cpustates) () = i_cpustates;
-void (*d_memory) () = i_memory;
-void (*d_message) () = i_message;
-void (*d_header) () = i_header;
-void (*d_process) () = i_process;
+void (*d_loadave) (int, double *) = i_loadave;
+void (*d_procstates) (int, int *) = i_procstates;
+void (*d_cpustates) (int *) = i_cpustates;
+void (*d_memory) (int *) = i_memory;
+void (*d_message) (void) = i_message;
+void (*d_header) (char *) = i_header;
+void (*d_process) (int, char *) = i_process;
int displays = 0; /* indicates unspecified */
char do_unames = Yes;
@@ -121,7 +121,7 @@ char topn_specified = No;
#define CMD_system 15
#define CMD_order 16
-void
+static void
usage(void)
{
extern char *__progname;
@@ -131,7 +131,7 @@ usage(void)
__progname);
}
-void
+static void
parseargs(int ac, char **av)
{
char *endp;
@@ -231,7 +231,7 @@ int
main(int argc, char *argv[])
{
char *uname_field = "USERNAME", *header_text, *env_top;
- char *(*get_userid)() = username, **preset_argv, **av;
+ char *(*get_userid)(uid_t) = username, **preset_argv, **av;
int preset_argc = 0, ac, active_procs, i;
sigset_t mask, oldmask;
time_t curr_time;
diff --git a/usr.bin/top/username.c b/usr.bin/top/username.c
index ff99c932e57..2d5cc0f3745 100644
--- a/usr.bin/top/username.c
+++ b/usr.bin/top/username.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: username.c,v 1.12 2003/06/19 22:40:45 millert Exp $ */
+/* $OpenBSD: username.c,v 1.13 2003/07/07 21:36:52 deraadt Exp $ */
/*
* Top users/processes display for Unix
@@ -53,6 +53,7 @@
#include <pwd.h>
#include "top.local.h"
+#include "top.h"
#include "utils.h"
struct hash_el {
diff --git a/usr.bin/top/utils.c b/usr.bin/top/utils.c
index 74be677604e..7a6ec4f2e28 100644
--- a/usr.bin/top/utils.c
+++ b/usr.bin/top/utils.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utils.c,v 1.12 2003/06/20 16:53:15 deraadt Exp $ */
+/* $OpenBSD: utils.c,v 1.13 2003/07/07 21:36:52 deraadt Exp $ */
/*
* Top users/processes display for Unix
@@ -39,6 +39,7 @@
#include <unistd.h>
#include "top.h"
+#include "utils.h"
int
atoiwi(char *str)