| 58 | */ |
| 59 | |
| 60 | static void |
| 61 | static_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 */ |
| 94 | SYSINIT(hintenv, SI_SUB_KMEM + 1, SI_ORDER_SECOND, static_hints_to_env, NULL); |
nothing calls this directly
no test coverage detected