MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sysctlnametomib

Function sysctlnametomib

tools/compat/sysctlnametomib.c:45–58  ·  view source on GitHub ↗

* This function uses a presently undocumented interface to the kernel * to walk the tree and get the type so it can print the value. * This interface is under work and consideration, and should probably * be killed with a big axe by the first person who can find the time. * (be aware though, that the proper interface isn't as obvious as it * may seem, there are various conflicting requirement

Source from the content-addressed store, hash-verified

43 * may seem, there are various conflicting requirements.
44 */
45int
46sysctlnametomib(const char *name, int *mibp, size_t *sizep)
47{
48 int oid[2];
49 int error;
50
51 oid[0] = 0;
52 oid[1] = 3;
53
54 *sizep *= sizeof(int);
55 error = sysctl(oid, 2, mibp, sizep, name, strlen(name));
56 *sizep /= sizeof(int);
57 return (error);
58}

Callers 1

sysctlbynameFunction · 0.85

Calls 1

sysctlFunction · 0.85

Tested by

no test coverage detected