diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pkill/pkill.c | 24 | ||||
-rw-r--r-- | usr.bin/systat/pigs.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/procname.c | 18 | ||||
-rw-r--r-- | usr.bin/top/machine.c | 84 | ||||
-rw-r--r-- | usr.bin/top/machine.h | 4 | ||||
-rw-r--r-- | usr.bin/top/utils.c | 4 | ||||
-rw-r--r-- | usr.bin/w/extern.h | 6 | ||||
-rw-r--r-- | usr.bin/w/proc_compare.c | 4 | ||||
-rw-r--r-- | usr.bin/w/w.c | 14 |
9 files changed, 85 insertions, 85 deletions
diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c index 60161a9aa4c..cfab3c7c211 100644 --- a/usr.bin/pkill/pkill.c +++ b/usr.bin/pkill/pkill.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkill.c,v 1.18 2009/10/27 23:59:41 deraadt Exp $ */ +/* $OpenBSD: pkill.c,v 1.19 2011/04/10 03:20:59 guenther Exp $ */ /* $NetBSD: pkill.c,v 1.5 2002/10/27 11:49:34 kleink Exp $ */ /*- @@ -73,7 +73,7 @@ struct list { SLIST_HEAD(listhead, list); -struct kinfo_proc2 *plist; +struct kinfo_proc *plist; char *selected; char *delim = "\n"; int nproc; @@ -98,8 +98,8 @@ struct listhead sidlist = SLIST_HEAD_INITIALIZER(list); int main(int, char **); void usage(void); -int killact(struct kinfo_proc2 *, int); -int grepact(struct kinfo_proc2 *, int); +int killact(struct kinfo_proc *, int); +int grepact(struct kinfo_proc *, int); void makelist(struct listhead *, enum listtype, char *); extern char *__progname; @@ -111,8 +111,8 @@ main(int argc, char **argv) extern int optind; char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q; int i, j, ch, bestidx, rv, criteria; - int (*action)(struct kinfo_proc2 *, int); - struct kinfo_proc2 *kp; + int (*action)(struct kinfo_proc *, int); + struct kinfo_proc *kp; struct list *li; u_int32_t bestsec, bestusec; regex_t reg; @@ -227,9 +227,9 @@ main(int argc, char **argv) if (kd == NULL) errx(STATUS_ERROR, "kvm_openfiles(): %s", buf); - plist = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc); + plist = kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc); if (plist == NULL) - errx(STATUS_ERROR, "kvm_getproc2() failed"); + errx(STATUS_ERROR, "kvm_getprocs() failed"); /* * Allocate memory which will be used to keep track of the @@ -253,7 +253,7 @@ main(int argc, char **argv) continue; if (matchargs) { - if ((pargv = kvm_getargv2(kd, kp, 0)) == NULL) + if ((pargv = kvm_getargv(kd, kp, 0)) == NULL) continue; j = 0; @@ -430,7 +430,7 @@ usage(void) } int -killact(struct kinfo_proc2 *kp, int dummy) +killact(struct kinfo_proc *kp, int dummy) { if (kill(kp->p_pid, signum) == -1 && errno != ESRCH) { @@ -441,14 +441,14 @@ killact(struct kinfo_proc2 *kp, int dummy) } int -grepact(struct kinfo_proc2 *kp, int printdelim) +grepact(struct kinfo_proc *kp, int printdelim) { char **argv; if (printdelim) fputs(delim, stdout); if (longfmt && matchargs) { - if ((argv = kvm_getargv2(kd, kp, 0)) == NULL) + if ((argv = kvm_getargv(kd, kp, 0)) == NULL) return (-1); printf("%d ", (int)kp->p_pid); diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c index beed407fb1b..257afab424b 100644 --- a/usr.bin/systat/pigs.c +++ b/usr.bin/systat/pigs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pigs.c,v 1.24 2011/03/02 06:48:17 jasper Exp $ */ +/* $OpenBSD: pigs.c,v 1.25 2011/04/10 03:20:59 guenther Exp $ */ /* $NetBSD: pigs.c,v 1.3 1995/04/29 05:54:50 cgd Exp $ */ /*- @@ -57,7 +57,7 @@ int read_pg(void); int select_pg(void); void showpigs(int k); -static struct kinfo_proc2 *procbase = NULL; +static struct kinfo_proc *procbase = NULL; static int nproc, pigs_cnt, *pb_indices = NULL; static int onproc = -1; @@ -124,7 +124,7 @@ int getprocs(void) { size_t size; - int mib[6] = {CTL_KERN, KERN_PROC2, KERN_PROC_KTHREAD, 0, sizeof(struct kinfo_proc2), 0}; + int mib[6] = {CTL_KERN, KERN_PROC, KERN_PROC_KTHREAD, 0, sizeof(struct kinfo_proc), 0}; int st; @@ -139,12 +139,12 @@ getprocs(void) if ((procbase = malloc(size + 1)) == NULL) return (1); - mib[5] = (int)(size / sizeof(struct kinfo_proc2)); + mib[5] = (int)(size / sizeof(struct kinfo_proc)); st = sysctl(mib, 6, procbase, &size, NULL, 0); if (st == -1) return (1); - nproc = (int)(size / sizeof(struct kinfo_proc2)); + nproc = (int)(size / sizeof(struct kinfo_proc)); return (0); } @@ -255,7 +255,7 @@ initpigs(void) void showpigs(int k) { - struct kinfo_proc2 *kp; + struct kinfo_proc *kp; double value; char *uname, *pname; diff --git a/usr.bin/tmux/procname.c b/usr.bin/tmux/procname.c index 3deb562ea3e..3c02b85c2dc 100644 --- a/usr.bin/tmux/procname.c +++ b/usr.bin/tmux/procname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procname.c,v 1.6 2009/12/24 22:29:15 guenther Exp $ */ +/* $OpenBSD: procname.c,v 1.7 2011/04/10 03:20:59 guenther Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -34,11 +34,11 @@ #define is_stopped(p) \ ((p)->p_stat == SSTOP || (p)->p_stat == SZOMB || (p)->p_stat == SDEAD) -struct kinfo_proc2 *cmp_procs(struct kinfo_proc2 *, struct kinfo_proc2 *); +struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *); char *get_proc_name(int, char *); -struct kinfo_proc2 * -cmp_procs(struct kinfo_proc2 *p1, struct kinfo_proc2 *p2) +struct kinfo_proc * +cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2) { if (is_runnable(p1) && !is_runnable(p2)) return (p1); @@ -78,11 +78,11 @@ cmp_procs(struct kinfo_proc2 *p1, struct kinfo_proc2 *p2) char * get_proc_name(int fd, char *tty) { - int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PGRP, 0, - sizeof(struct kinfo_proc2), 0 }; + int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PGRP, 0, + sizeof(struct kinfo_proc), 0 }; struct stat sb; size_t len; - struct kinfo_proc2 *buf, *newbuf, *bestp; + struct kinfo_proc *buf, *newbuf, *bestp; u_int i; char *name; @@ -102,7 +102,7 @@ retry: goto error; buf = newbuf; - mib[5] = (int)(len / sizeof(struct kinfo_proc2)); + mib[5] = (int)(len / sizeof(struct kinfo_proc)); if (sysctl(mib, nitems(mib), buf, &len, NULL, 0) == -1) { if (errno == ENOMEM) goto retry; @@ -110,7 +110,7 @@ retry: } bestp = NULL; - for (i = 0; i < len / sizeof (struct kinfo_proc2); i++) { + for (i = 0; i < len / sizeof (struct kinfo_proc); i++) { if ((dev_t)buf[i].p_tdev != sb.st_rdev) continue; if (bestp == NULL) diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index b156ba499ca..268edb7bff5 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.c,v 1.67 2010/04/26 00:30:58 deraadt Exp $ */ +/* $OpenBSD: machine.c,v 1.68 2011/04/10 03:20:59 guenther Exp $ */ /*- * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com> @@ -52,13 +52,13 @@ #include "loadavg.h" static int swapmode(int *, int *); -static char *state_abbr(struct kinfo_proc2 *); -static char *format_comm(struct kinfo_proc2 *); +static char *state_abbr(struct kinfo_proc *); +static char *format_comm(struct kinfo_proc *); /* get_process_info passes back a handle. This is what it looks like: */ struct handle { - struct kinfo_proc2 **next_proc; /* points to next valid proc pointer */ + struct kinfo_proc **next_proc; /* points to next valid proc pointer */ int remaining; /* number of pointers remaining */ }; @@ -123,8 +123,8 @@ char *ordernames[] = { static int nproc; static int onproc = -1; static int pref_len; -static struct kinfo_proc2 *pbase; -static struct kinfo_proc2 **pref; +static struct kinfo_proc *pbase; +static struct kinfo_proc **pref; /* these are for getting the memory statistics */ static int pageshift; /* log base 2 of the pagesize */ @@ -275,13 +275,13 @@ get_system_info(struct system_info *si) static struct handle handle; -struct kinfo_proc2 * +struct kinfo_proc * getprocs(int op, int arg, int *cnt) { size_t size; - int mib[6] = {CTL_KERN, KERN_PROC2, 0, 0, sizeof(struct kinfo_proc2), 0}; + int mib[6] = {CTL_KERN, KERN_PROC, 0, 0, sizeof(struct kinfo_proc), 0}; static int maxslp_mib[] = {CTL_VM, VM_MAXSLP}; - static struct kinfo_proc2 *procbase; + static struct kinfo_proc *procbase; int st; mib[2] = op; @@ -296,21 +296,21 @@ getprocs(int op, int arg, int *cnt) free(procbase); st = sysctl(mib, 6, NULL, &size, NULL, 0); if (st == -1) { - /* _kvm_syserr(kd, kd->program, "kvm_getproc2"); */ + /* _kvm_syserr(kd, kd->program, "kvm_getprocs"); */ return (0); } size = 5 * size / 4; /* extra slop */ if ((procbase = malloc(size)) == NULL) return (0); - mib[5] = (int)(size / sizeof(struct kinfo_proc2)); + mib[5] = (int)(size / sizeof(struct kinfo_proc)); st = sysctl(mib, 6, procbase, &size, NULL, 0); if (st == -1) { if (errno == ENOMEM) goto retry; - /* _kvm_syserr(kd, kd->program, "kvm_getproc2"); */ + /* _kvm_syserr(kd, kd->program, "kvm_getprocs"); */ return (0); } - *cnt = (int)(size / sizeof(struct kinfo_proc2)); + *cnt = (int)(size / sizeof(struct kinfo_proc)); return (procbase); } @@ -320,15 +320,15 @@ get_process_info(struct system_info *si, struct process_select *sel, { int show_idle, show_system, show_threads, show_uid, show_pid, show_cmd; int total_procs, active_procs; - struct kinfo_proc2 **prefp, *pp; + struct kinfo_proc **prefp, *pp; if ((pbase = getprocs(KERN_PROC_KTHREAD, 0, &nproc)) == NULL) { /* warnx("%s", kvm_geterr(kd)); */ quit(23); } if (nproc > onproc) - pref = (struct kinfo_proc2 **)realloc(pref, - sizeof(struct kinfo_proc2 *) * (onproc = nproc)); + pref = (struct kinfo_proc **)realloc(pref, + sizeof(struct kinfo_proc *) * (onproc = nproc)); if (pref == NULL) { warnx("Out of memory."); quit(23); @@ -377,7 +377,7 @@ get_process_info(struct system_info *si, struct process_select *sel, /* if requested, sort the "interesting" processes */ if (compare != NULL) qsort((char *) pref, active_procs, - sizeof(struct kinfo_proc2 *), compare); + sizeof(struct kinfo_proc *), compare); /* remember active and total counts */ si->p_total = total_procs; si->p_active = pref_len = active_procs; @@ -391,7 +391,7 @@ get_process_info(struct system_info *si, struct process_select *sel, char fmt[MAX_COLS]; /* static area where result is built */ static char * -state_abbr(struct kinfo_proc2 *pp) +state_abbr(struct kinfo_proc *pp) { static char buf[10]; @@ -405,7 +405,7 @@ state_abbr(struct kinfo_proc2 *pp) } static char * -format_comm(struct kinfo_proc2 *kp) +format_comm(struct kinfo_proc *kp) { static char **s, buf[MAX_COLS]; size_t siz = 100; @@ -443,7 +443,7 @@ char * format_next_process(caddr_t handle, char *(*get_userid)(uid_t), pid_t *pid) { char *p_wait, waddr[sizeof(void *) * 2 + 3]; /* Hexify void pointer */ - struct kinfo_proc2 *pp; + struct kinfo_proc *pp; struct handle *hp; int cputime; double pct; @@ -532,13 +532,13 @@ compare_cpu(const void *v1, const void *v2) { struct proc **pp1 = (struct proc **) v1; struct proc **pp2 = (struct proc **) v2; - struct kinfo_proc2 *p1, *p2; + struct kinfo_proc *p1, *p2; pctcpu lresult; int result; /* remove one level of indirection */ - p1 = *(struct kinfo_proc2 **) pp1; - p2 = *(struct kinfo_proc2 **) pp2; + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; ORDERKEY_PCTCPU ORDERKEY_CPUTIME @@ -556,13 +556,13 @@ compare_size(const void *v1, const void *v2) { struct proc **pp1 = (struct proc **) v1; struct proc **pp2 = (struct proc **) v2; - struct kinfo_proc2 *p1, *p2; + struct kinfo_proc *p1, *p2; pctcpu lresult; int result; /* remove one level of indirection */ - p1 = *(struct kinfo_proc2 **) pp1; - p2 = *(struct kinfo_proc2 **) pp2; + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; ORDERKEY_MEM ORDERKEY_RSSIZE @@ -580,13 +580,13 @@ compare_res(const void *v1, const void *v2) { struct proc **pp1 = (struct proc **) v1; struct proc **pp2 = (struct proc **) v2; - struct kinfo_proc2 *p1, *p2; + struct kinfo_proc *p1, *p2; pctcpu lresult; int result; /* remove one level of indirection */ - p1 = *(struct kinfo_proc2 **) pp1; - p2 = *(struct kinfo_proc2 **) pp2; + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; ORDERKEY_RSSIZE ORDERKEY_MEM @@ -604,13 +604,13 @@ compare_time(const void *v1, const void *v2) { struct proc **pp1 = (struct proc **) v1; struct proc **pp2 = (struct proc **) v2; - struct kinfo_proc2 *p1, *p2; + struct kinfo_proc *p1, *p2; pctcpu lresult; int result; /* remove one level of indirection */ - p1 = *(struct kinfo_proc2 **) pp1; - p2 = *(struct kinfo_proc2 **) pp2; + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; ORDERKEY_CPUTIME ORDERKEY_PCTCPU @@ -628,13 +628,13 @@ compare_prio(const void *v1, const void *v2) { struct proc **pp1 = (struct proc **) v1; struct proc **pp2 = (struct proc **) v2; - struct kinfo_proc2 *p1, *p2; + struct kinfo_proc *p1, *p2; pctcpu lresult; int result; /* remove one level of indirection */ - p1 = *(struct kinfo_proc2 **) pp1; - p2 = *(struct kinfo_proc2 **) pp2; + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; ORDERKEY_PRIO ORDERKEY_PCTCPU @@ -651,13 +651,13 @@ compare_pid(const void *v1, const void *v2) { struct proc **pp1 = (struct proc **) v1; struct proc **pp2 = (struct proc **) v2; - struct kinfo_proc2 *p1, *p2; + struct kinfo_proc *p1, *p2; pctcpu lresult; int result; /* remove one level of indirection */ - p1 = *(struct kinfo_proc2 **) pp1; - p2 = *(struct kinfo_proc2 **) pp2; + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; ORDERKEY_PID ORDERKEY_PCTCPU @@ -675,13 +675,13 @@ compare_cmd(const void *v1, const void *v2) { struct proc **pp1 = (struct proc **) v1; struct proc **pp2 = (struct proc **) v2; - struct kinfo_proc2 *p1, *p2; + struct kinfo_proc *p1, *p2; pctcpu lresult; int result; /* remove one level of indirection */ - p1 = *(struct kinfo_proc2 **) pp1; - p2 = *(struct kinfo_proc2 **) pp2; + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; ORDERKEY_CMD ORDERKEY_PCTCPU @@ -718,7 +718,7 @@ int (*proc_compares[])(const void *, const void *) = { uid_t proc_owner(pid_t pid) { - struct kinfo_proc2 **prefp, *pp; + struct kinfo_proc **prefp, *pp; int cnt; prefp = pref; diff --git a/usr.bin/top/machine.h b/usr.bin/top/machine.h index 55aee794e95..1ed4044267e 100644 --- a/usr.bin/top/machine.h +++ b/usr.bin/top/machine.h @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.h,v 1.15 2007/05/29 00:56:56 otto Exp $ */ +/* $OpenBSD: machine.h,v 1.16 2011/04/10 03:20:59 guenther Exp $ */ /* * Top users/processes display for Unix @@ -91,4 +91,4 @@ get_process_info(struct system_info *, struct process_select *, extern char *format_next_process(caddr_t, char *(*)(uid_t), pid_t *); extern uid_t proc_owner(pid_t); -extern struct kinfo_proc2 *getprocs(int, int, int *); +extern struct kinfo_proc *getprocs(int, int, int *); diff --git a/usr.bin/top/utils.c b/usr.bin/top/utils.c index 4a1f2a7e4ef..b0a19d63507 100644 --- a/usr.bin/top/utils.c +++ b/usr.bin/top/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.22 2010/01/29 00:36:09 tedu Exp $ */ +/* $OpenBSD: utils.c,v 1.23 2011/04/10 03:20:59 guenther Exp $ */ /* * Top users/processes display for Unix @@ -341,7 +341,7 @@ format_k(int amt) int find_pid(pid_t pid) { - struct kinfo_proc2 *pbase, *cur; + struct kinfo_proc *pbase, *cur; int nproc; if ((pbase = getprocs(KERN_PROC_KTHREAD, 0, &nproc)) == NULL) diff --git a/usr.bin/w/extern.h b/usr.bin/w/extern.h index c1fe4f6dfac..4c1e6507fbf 100644 --- a/usr.bin/w/extern.h +++ b/usr.bin/w/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.7 2004/09/14 22:24:24 deraadt Exp $ */ +/* $OpenBSD: extern.h,v 1.8 2011/04/10 03:20:59 guenther Exp $ */ /*- * Copyright (c) 1993 @@ -31,9 +31,9 @@ * @(#)extern.h 8.1 (Berkeley) 6/6/93 */ -struct kinfo_proc2; +struct kinfo_proc; void fmt_puts(const char *, int *); void fmt_putc(int, int *); void pr_attime(time_t *, time_t *); void pr_idle(time_t); -int proc_compare(const struct kinfo_proc2 *, const struct kinfo_proc2 *); +int proc_compare(const struct kinfo_proc *, const struct kinfo_proc *); diff --git a/usr.bin/w/proc_compare.c b/usr.bin/w/proc_compare.c index 727b881a071..a03ef9e84bb 100644 --- a/usr.bin/w/proc_compare.c +++ b/usr.bin/w/proc_compare.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc_compare.c,v 1.11 2009/10/27 23:59:49 deraadt Exp $ */ +/* $OpenBSD: proc_compare.c,v 1.12 2011/04/10 03:20:59 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -62,7 +62,7 @@ #define BOTH 3 int -proc_compare(const struct kinfo_proc2 *p1, const struct kinfo_proc2 *p2) +proc_compare(const struct kinfo_proc *p1, const struct kinfo_proc *p2) { if (p1 == NULL) return (1); diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index e625a640764..a9aa8321ae2 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -1,4 +1,4 @@ -/* $OpenBSD: w.c,v 1.47 2009/10/27 23:59:49 deraadt Exp $ */ +/* $OpenBSD: w.c,v 1.48 2011/04/10 03:20:59 guenther Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -92,10 +92,10 @@ struct entry { struct utmp utmp; dev_t tdev; /* dev_t of terminal */ time_t idle; /* idle time of terminal in seconds */ - struct kinfo_proc2 *kp; /* `most interesting' proc */ + struct kinfo_proc *kp; /* `most interesting' proc */ } *ep, *ehead = NULL, **nextp = &ehead; -static void pr_args(struct kinfo_proc2 *); +static void pr_args(struct kinfo_proc *); static void pr_header(time_t *, int); static struct stat *ttystat(char *); @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) { extern char *__progname; - struct kinfo_proc2 *kp; + struct kinfo_proc *kp; struct hostent *hp; struct stat *stp; FILE *ut; @@ -218,7 +218,7 @@ main(int argc, char *argv[]) #define WUSED (sizeof(HEADER) - sizeof("WHAT")) (void)puts(HEADER); - kp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(*kp), &nentries); + kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*kp), &nentries); if (kp == NULL) errx(1, "%s", kvm_geterr(kd)); for (i = 0; i < nentries; i++, kp++) { @@ -324,7 +324,7 @@ main(int argc, char *argv[]) } static void -pr_args(struct kinfo_proc2 *kp) +pr_args(struct kinfo_proc *kp) { char **argv, *str; int left; @@ -332,7 +332,7 @@ pr_args(struct kinfo_proc2 *kp) if (kp == NULL) goto nothing; /* XXX - can this happen? */ left = argwidth; - argv = kvm_getargv2(kd, kp, argwidth+60); /* +60 for ftpd snip */ + argv = kvm_getargv(kd, kp, argwidth+60); /* +60 for ftpd snip */ if (argv == NULL) goto nothing; |