mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Use the 3-component version of the KERN_PROC_PROC sysctl.
This commit is contained in:
parent
4487ff65db
commit
f2dd06ab16
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120500
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user