sysctl-rs icon indicating copy to clipboard operation
sysctl-rs copied to clipboard

Thoughts on sysctls that take arguments?

Open inferiorhumanorgans opened this issue 2 years ago • 3 comments

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);
           }

inferiorhumanorgans avatar Apr 07 '22 21:04 inferiorhumanorgans

Can you elaborate what you mean?

orhun avatar Apr 10 '22 16:04 orhun

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.

inferiorhumanorgans avatar Apr 10 '22 19:04 inferiorhumanorgans

No plans myself to implement that at this time. PRs are always welcome though :)

johalun avatar Apr 18 '22 22:04 johalun