MCPcopy Index your code
hub / github.com/F-Stack/f-stack / feature_present

Function feature_present

tools/compat/feature_present.c:51–69  ·  view source on GitHub ↗

* Returns true if the named feature is present in the currently * running kernel. A feature's presence is indicated by an integer * sysctl node called kern.feature. that is non-zero. */

Source from the content-addressed store, hash-verified

49 * sysctl node called kern.feature.<feature> that is non-zero.
50 */
51int
52feature_present(const char *feature)
53{
54 char *mib;
55 size_t len;
56 int i;
57
58 if (asprintf(&mib, "kern.features.%s", feature) < 0)
59 return (0);
60 len = sizeof(i);
61 if (sysctlbyname(mib, &i, &len, NULL, 0) < 0) {
62 free(mib);
63 return (0);
64 }
65 free(mib);
66 if (len != sizeof(i))
67 return (0);
68 return (i != 0);
69}

Callers 3

ifconfigFunction · 0.85
inet_ctorFunction · 0.85
inet6_ctorFunction · 0.85

Calls 3

asprintfFunction · 0.85
sysctlbynameFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected