summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libkvm/kvm_proc.c6
-rw-r--r--usr.bin/killall/killall.c4
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 14228d5..4d4fa19 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -448,7 +448,8 @@ kvm_getprocs(kd, op, arg, cnt)
mib[1] = KERN_PROC;
mib[2] = op;
mib[3] = arg;
- st = sysctl(mib, op == KERN_PROC_ALL ? 3 : 4, NULL, &size, NULL, 0);
+ st = sysctl(mib, op == KERN_PROC_ALL || op == KERN_PROC_PROC ?
+ 3 : 4, NULL, &size, NULL, 0);
if (st == -1) {
_kvm_syserr(kd, kd->program, "kvm_getprocs");
return (0);
@@ -478,7 +479,8 @@ kvm_getprocs(kd, op, arg, cnt)
_kvm_realloc(kd, kd->procbase, size);
if (kd->procbase == 0)
return (0);
- st = sysctl(mib, op == KERN_PROC_ALL ? 3 : 4,
+ st = sysctl(mib, op == KERN_PROC_ALL ||
+ op == KERN_PROC_PROC ? 3 : 4,
kd->procbase, &size, NULL, 0);
} while (st == -1 && errno == ENOMEM);
if (st == -1) {
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c
index dfa5734..6681b2e 100644
--- a/usr.bin/killall/killall.c
+++ b/usr.bin/killall/killall.c
@@ -268,14 +268,16 @@ main(int ac, char **av)
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PROC;
mib[3] = 0;
- miblen = 4;
+ miblen = 3;
if (user) {
mib[2] = KERN_PROC_RUID;
mib[3] = uid;
+ miblen = 4;
} else if (tty) {
mib[2] = KERN_PROC_TTY;
mib[3] = tdev;
+ miblen = 4;
}
st = sysctl(mib, miblen, NULL, &size, NULL, 0);
OpenPOWER on IntegriCloud