diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2012-04-17 23:17:54 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2012-04-17 23:17:54 +0000 |
commit | 9423fd636fbb829a3beb96e6bf91a8435aca0dac (patch) | |
tree | 662e13cd8db382c4a64c9981a968e8662067d7d4 /usr.bin | |
parent | 0dda1e76ea40698dad18b59045a473096026880e (diff) |
Make it optional for kvm_getprocs() (and related sysctl) to return
thread information.
Add a KERN_PROC_SHOW_THREADS flag that has to be set in order to get the
thread info and make it off by default. This creates backwards compatibility
for applications that relied on a given size/number of items to be returned.
Modify ps(1) and top(1) accordingly.
Okay guenther@.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/top/machine.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 0bedc42da0f..5b5db66f81e 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.c,v 1.70 2012/04/12 14:59:19 pirofti Exp $ */ +/* $OpenBSD: machine.c,v 1.71 2012/04/17 23:17:53 pirofti Exp $ */ /*- * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com> @@ -332,8 +332,12 @@ 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_proc **prefp, *pp; + int what = KERN_PROC_KTHREAD; - if ((pbase = getprocs(KERN_PROC_KTHREAD, 0, &nproc)) == NULL) { + if (sel->threads) + what |= KERN_PROC_SHOW_THREADS; + + if ((pbase = getprocs(what, 0, &nproc)) == NULL) { /* warnx("%s", kvm_geterr(kd)); */ quit(23); } |