sysctl-rs
sysctl-rs copied to clipboard
Thoughts on sysctls that take arguments?
e.g. from the sysctl manpage:
int i, mib[4];
size_t len;
struct kinfo_proc kp;
/* Fill out the first three components of the mib */
len = 4;
sysctlnametomib("kern.proc.pid", mib, &len);
/* Fetch and print entries for pid's < 100 */
for (i = 0; i < 100; i++) {
mib[3] = i;
len = sizeof(kp);
if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
perror("sysctl");
else if (len > 0)
printkproc(&kp);
}
Can you elaborate what you mean?
Some sysctls like kern.proc.pid
take an argument (mib[3]
) and I was wondering if you had any thoughts/plans about implementing support for that.
No plans myself to implement that at this time. PRs are always welcome though :)