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

Function static_hints_to_env

freebsd/kern/subr_hints.c:60–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 */
59
60static void
61static_hints_to_env(void *data __unused)
62{
63 const char *cp;
64 char *line, *eq;
65 int eqidx, i;
66
67 cp = static_hints;
68 while (cp && *cp != '\0') {
69 eq = strchr(cp, '=');
70 if (eq == NULL)
71 /* Bad hint value */
72 continue;
73 eqidx = eq - cp;
74
75 i = strlen(cp);
76 line = malloc(i + 1, M_TEMP, M_WAITOK);
77 strcpy(line, cp);
78 line[eqidx] = line[i] = '\0';
79 /*
80 * Before adding a hint to the dynamic environment, check if
81 * another value for said hint has already been added. This is
82 * needed because static environment overrides static hints and
83 * dynamic environment overrides all.
84 */
85 if (testenv(line) == 0)
86 kern_setenv(line, line + eqidx + 1);
87 free(line, M_TEMP);
88 cp += i + 1;
89 }
90 hintenv_merged = true;
91}
92
93/* Any time after dynamic env is setup */
94SYSINIT(hintenv, SI_SUB_KMEM + 1, SI_ORDER_SECOND, static_hints_to_env, NULL);

Callers

nothing calls this directly

Calls 5

strchrFunction · 0.85
mallocFunction · 0.85
testenvFunction · 0.70
kern_setenvFunction · 0.70
freeFunction · 0.70

Tested by

no test coverage detected