diff options
author | ngie <ngie@FreeBSD.org> | 2017-01-13 08:39:23 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-01-13 08:39:23 +0000 |
commit | 6e4d1572955308508af37e261c77dc3ddfbac38c (patch) | |
tree | f94a35e7eb68b4c7f336299cbccb45265ce33d8d /lib/libutil/kinfo_getproc.c | |
parent | f44aefe584e4062ac8afa6d8debc0321924b111d (diff) | |
download | FreeBSD-src-6e4d1572955308508af37e261c77dc3ddfbac38c.zip FreeBSD-src-6e4d1572955308508af37e261c77dc3ddfbac38c.tar.gz |
MFC r311714:
lib/libutil/kinfo_*: style cleanup
- Use nitems(mib) instead of hardcoding mib's length
- Sort sys/ #includes
Diffstat (limited to 'lib/libutil/kinfo_getproc.c')
-rw-r--r-- | lib/libutil/kinfo_getproc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libutil/kinfo_getproc.c b/lib/libutil/kinfo_getproc.c index 2ae6b57..496f71f 100644 --- a/lib/libutil/kinfo_getproc.c +++ b/lib/libutil/kinfo_getproc.c @@ -30,8 +30,8 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <sys/user.h> #include <sys/sysctl.h> +#include <sys/user.h> #include <stdlib.h> #include <string.h> @@ -49,14 +49,14 @@ kinfo_getproc(pid_t pid) mib[1] = KERN_PROC; mib[2] = KERN_PROC_PID; mib[3] = pid; - if (sysctl(mib, 4, NULL, &len, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), NULL, &len, NULL, 0) < 0) return (NULL); kipp = malloc(len); if (kipp == NULL) return (NULL); - if (sysctl(mib, 4, kipp, &len, NULL, 0) < 0) + if (sysctl(mib, nitems(mib), kipp, &len, NULL, 0) < 0) goto bad; if (len != sizeof(*kipp)) goto bad; |