Follow up to r225617. In order to maximize the re-usability of kernel code

in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
This commit is contained in:
Davide Italiano 2014-10-16 18:04:43 +00:00
parent 148bdd15d5
commit 2be111bf7d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273174
43 changed files with 93 additions and 93 deletions

View File

@ -244,7 +244,7 @@ cpu_startup(dummy)
* We do this by disabling a bit in the SMI_EN (SMI Control and
* Enable register) of the Intel ICH LPC Interface Bridge.
*/
sysenv = getenv("smbios.system.product");
sysenv = kern_getenv("smbios.system.product");
if (sysenv != NULL) {
if (strncmp(sysenv, "MacBook1,1", 10) == 0 ||
strncmp(sysenv, "MacBook3,1", 10) == 0 ||
@ -276,7 +276,7 @@ cpu_startup(dummy)
* Display physical memory if SMBIOS reports reasonable amount.
*/
memsize = 0;
sysenv = getenv("smbios.memory.enabled");
sysenv = kern_getenv("smbios.memory.enabled");
if (sysenv != NULL) {
memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
freeenv(sysenv);
@ -2070,7 +2070,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
thread0.td_pcb->pcb_cr3 = KPML4phys; /* PCID 0 is reserved for kernel */
thread0.td_frame = &proc0_tf;
env = getenv("kernelname");
env = kern_getenv("kernelname");
if (env != NULL)
strlcpy(kernelname, env, sizeof(kernelname));

View File

@ -1934,7 +1934,7 @@ vmm_is_pptdev(int bus, int slot, int func)
/* set pptdevs="1/2/3 4/5/6 7/8/9 10/11/12" */
found = 0;
for (i = 0; names[i] != NULL && !found; i++) {
cp = val = getenv(names[i]);
cp = val = kern_getenv(names[i]);
while (cp != NULL && *cp != '\0') {
if ((cp2 = strchr(cp, ' ')) != NULL)
*cp2 = '\0';

View File

@ -1245,7 +1245,7 @@ initarm(struct arm_boot_params *abp)
debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp);
print_kenv();
env = getenv("kernelname");
env = kern_getenv("kernelname");
if (env != NULL)
strlcpy(kernelname, env, sizeof(kernelname));

View File

@ -1316,7 +1316,7 @@ adaregister(struct cam_periph *periph, void *arg)
softc->disk->d_name, softc->disk->d_unit);
snprintf(buf1, sizeof(buf1),
"ad%d", legacy_id);
setenv(announce_buf, buf1);
kern_setenv(announce_buf, buf1);
}
} else
legacy_id = -1;

View File

@ -13052,7 +13052,7 @@ dtrace_dof_property(const char *name)
char *p;
char *p_env;
if ((p_env = getenv(name)) == NULL)
if ((p_env = kern_getenv(name)) == NULL)
return (NULL);
len = strlen(p_env) / 2;

View File

@ -594,7 +594,7 @@ acpi_attach(device_t dev)
sc->acpi_sleep_delay = 1;
if (bootverbose)
sc->acpi_verbose = 1;
if ((env = getenv("hw.acpi.verbose")) != NULL) {
if ((env = kern_getenv("hw.acpi.verbose")) != NULL) {
if (strcmp(env, "0") != 0)
sc->acpi_verbose = 1;
freeenv(env);
@ -3337,7 +3337,7 @@ acpi_avoid(ACPI_HANDLE handle)
np = acpi_name(handle);
if (*np == '\\')
np++;
if ((env = getenv("debug.acpi.avoid")) == NULL)
if ((env = kern_getenv("debug.acpi.avoid")) == NULL)
return (0);
/* Scan the avoid list checking for a match */
@ -3370,7 +3370,7 @@ acpi_disabled(char *subsys)
char *cp, *env;
int len;
if ((env = getenv("debug.acpi.disabled")) == NULL)
if ((env = kern_getenv("debug.acpi.disabled")) == NULL)
return (0);
if (strcmp(env, "all") == 0) {
freeenv(env);
@ -3753,8 +3753,8 @@ acpi_set_debugging(void *junk)
AcpiDbgLevel = 0;
}
layer = getenv("debug.acpi.layer");
level = getenv("debug.acpi.level");
layer = kern_getenv("debug.acpi.layer");
level = kern_getenv("debug.acpi.level");
if (layer == NULL && level == NULL)
return;
@ -3813,9 +3813,9 @@ acpi_debug_sysctl(SYSCTL_HANDLER_ARGS)
/* If the user is setting a string, parse it. */
if (error == 0 && req->newptr != NULL) {
*dbg = 0;
setenv((char *)oidp->oid_arg1, (char *)req->newptr);
acpi_set_debugging(NULL);
*dbg = 0;
kern_setenv((char *)oidp->oid_arg1, (char *)req->newptr);
acpi_set_debugging(NULL);
}
ACPI_SERIAL_END(acpi);

View File

@ -310,7 +310,7 @@ asmc_match(device_t dev)
int i;
char *model;
model = getenv("smbios.system.product");
model = kern_getenv("smbios.system.product");
if (model == NULL)
return (NULL);

View File

@ -410,7 +410,7 @@ cfi_attach(device_t dev)
device_get_nameunit(dev)) < (sizeof(name) - 1) &&
snprintf(value, sizeof(value), "0x%016jx", ppr) <
(sizeof(value) - 1))
(void) setenv(name, value);
(void) kern_setenv(name, value);
}
#endif

View File

@ -53,7 +53,7 @@ drm_fetch_cmdline_mode_from_kenv(struct drm_connector *connector,
strlen(drm_get_connector_name(connector)), M_TEMP, M_WAITOK);
strcpy(tun_var_name, tun_prefix);
strcat(tun_var_name, drm_get_connector_name(connector));
tun_mode = getenv(tun_var_name);
tun_mode = kern_getenv(tun_var_name);
if (tun_mode != NULL) {
res = drm_mode_parse_command_line_for_connector(tun_mode,
connector, cmdline_mode);

View File

@ -1319,7 +1319,7 @@ kenv_getuint(struct hatm_softc *sc, const char *var,
snprintf(full, sizeof(full), "hw.%s.%s",
device_get_nameunit(sc->dev), var);
if ((val = getenv(full)) == NULL)
if ((val = kern_getenv(full)) == NULL)
return (0);
u = strtoul(val, &end, 0);
if (end == val || *end != '\0') {

View File

@ -171,7 +171,7 @@ detect_hs21(struct bce_softc *bce_sc)
found = 0;
if (bce_sc->bce_chipid == HS21_BCM_CHIPID) {
sysenv = getenv("smbios.system.product");
sysenv = kern_getenv("smbios.system.product");
if (sysenv != NULL) {
if (strncmp(sysenv, HS21_PRODUCT_ID,
strlen(HS21_PRODUCT_ID)) == 0)

View File

@ -345,8 +345,8 @@ nfe_detect_msik9(struct nfe_softc *sc)
int found;
found = 0;
m = getenv("smbios.planar.maker");
p = getenv("smbios.planar.product");
m = kern_getenv("smbios.planar.maker");
p = kern_getenv("smbios.planar.product");
if (m != NULL && p != NULL) {
if (strcmp(m, maker) == 0 && strcmp(p, product) == 0)
found = 1;
@ -839,8 +839,8 @@ nfe_can_use_msix(struct nfe_softc *sc)
* Search base board manufacturer and product name table
* to see this system has a known MSI/MSI-X issue.
*/
maker = getenv("smbios.planar.maker");
product = getenv("smbios.planar.product");
maker = kern_getenv("smbios.planar.maker");
product = kern_getenv("smbios.planar.product");
use_msix = 1;
if (maker != NULL && product != NULL) {
count = sizeof(msix_blacklists) / sizeof(msix_blacklists[0]);

View File

@ -579,7 +579,7 @@ patm_env_getuint(struct patm_softc *sc, u_int *var, const char *name)
snprintf(full, sizeof(full), "hw.%s.%s",
device_get_nameunit(sc->dev), name);
if ((val = getenv(full)) != NULL) {
if ((val = kern_getenv(full)) != NULL) {
u = strtoul(val, &end, 0);
if (end > val && *end == '\0') {
if (bootverbose)

View File

@ -3270,14 +3270,14 @@ pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg,
case 0x00dd10de:
/* Compaq R3000 BIOS sets wrong subordinate bus number. */
if ((cp = getenv("smbios.planar.maker")) == NULL)
if ((cp = kern_getenv("smbios.planar.maker")) == NULL)
break;
if (strncmp(cp, "Compal", 6) != 0) {
freeenv(cp);
break;
}
freeenv(cp);
if ((cp = getenv("smbios.planar.product")) == NULL)
if ((cp = kern_getenv("smbios.planar.product")) == NULL)
break;
if (strncmp(cp, "08A0", 4) != 0) {
freeenv(cp);

View File

@ -977,14 +977,14 @@ pcib_attach_common(device_t dev)
{
char *cp;
if ((cp = getenv("smbios.planar.maker")) == NULL)
if ((cp = kern_getenv("smbios.planar.maker")) == NULL)
break;
if (strncmp(cp, "Compal", 6) != 0) {
freeenv(cp);
break;
}
freeenv(cp);
if ((cp = getenv("smbios.planar.product")) == NULL)
if ((cp = kern_getenv("smbios.planar.product")) == NULL)
break;
if (strncmp(cp, "08A0", 4) != 0) {
freeenv(cp);

View File

@ -241,8 +241,8 @@ ether_request_mac(device_t dev, uint8_t *mac)
* "kmac" is passed via argv on RouterBOOT platforms
*/
#if defined(__U_BOOT__) || defined(__REDBOOT__) || defined(__ROUTERBOOT__)
if ((var = getenv("ethaddr")) != NULL ||
(var = getenv("kmac")) != NULL ) {
if ((var = kern_getenv("ethaddr")) != NULL ||
(var = kern_getenv("kmac")) != NULL ) {
if(!macaddr_atoi(var, mac)) {
printf("%s: use %s macaddr from KENV\n",

View File

@ -214,9 +214,9 @@ uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
* port (resp).
*/
if (devtype == UART_DEV_CONSOLE)
spec = getenv("hw.uart.console");
spec = kern_getenv("hw.uart.console");
else if (devtype == UART_DEV_DBGPORT)
spec = getenv("hw.uart.dbgport");
spec = kern_getenv("hw.uart.dbgport");
else
spec = NULL;
if (spec == NULL)

View File

@ -442,7 +442,7 @@ nfs_mountroot(struct mount *mp)
error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td);
if (error)
panic("nfs_mountroot: SIOCAIFADDR: %d", error);
if ((cp = getenv("boot.netif.mtu")) != NULL) {
if ((cp = kern_getenv("boot.netif.mtu")) != NULL) {
ir.ifr_mtu = strtol(cp, NULL, 10);
bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ);
freeenv(cp);

View File

@ -116,7 +116,7 @@ static void
g_dev_init(struct g_class *mp)
{
dumpdev = getenv("dumpdev");
dumpdev = kern_getenv("dumpdev");
}
static void
@ -302,7 +302,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
for (len = MIN(strlen(gp->name), sizeof(buf) - 15); len > 0; len--) {
snprintf(buf, sizeof(buf), "kern.devalias.%s", gp->name);
buf[14 + len] = 0;
val = getenv(buf);
val = kern_getenv(buf);
if (val != NULL) {
snprintf(buf, sizeof(buf), "%s%s",
val, gp->name + len);

View File

@ -1656,7 +1656,7 @@ g_raid_launch_provider(struct g_raid_volume *vol)
"kern.devalias.%s", name);
snprintf(buf1, sizeof(buf1),
"ar%d", vol->v_global_id);
setenv(announce_buf, buf1);
kern_setenv(announce_buf, buf1);
}
pp = g_new_providerf(sc->sc_geom, "%s", name);

View File

@ -1661,7 +1661,7 @@ g_sched_taste(struct g_class *mp, struct g_provider *pp,
if (pp->geom->class == mp)
break;
taste_names = getenv("geom.sched.taste");
taste_names = kern_getenv("geom.sched.taste");
if (taste_names == NULL)
break;
@ -1679,7 +1679,7 @@ g_sched_taste(struct g_class *mp, struct g_provider *pp,
pp->name, s);
/* look up the provider name in the list */
s = getenv("geom.sched.algo");
s = kern_getenv("geom.sched.algo");
if (s == NULL)
s = "rr";

View File

@ -106,7 +106,7 @@ bios32_init(void *junk)
}
/* Allow user override of PCI BIOS search */
if (((p = getenv("machdep.bios.pci")) == NULL) || strcmp(p, "disable")) {
if (((p = kern_getenv("machdep.bios.pci")) == NULL) || strcmp(p, "disable")) {
/* See if there's a PCI BIOS entrypoint here */
PCIbios.ident.id = 0x49435024; /* PCI systems should have this */
@ -125,7 +125,7 @@ bios32_init(void *junk)
*
* Allow user override of PnP BIOS search
*/
if ((((p = getenv("machdep.bios.pnp")) == NULL) || strcmp(p, "disable")) &&
if ((((p = kern_getenv("machdep.bios.pnp")) == NULL) || strcmp(p, "disable")) &&
((sigaddr = bios_sigsearch(0, "$PnP", 4, 16, 0)) != 0)) {
/* get a virtual pointer to the structure */

View File

@ -281,7 +281,7 @@ cpu_startup(dummy)
* We do this by disabling a bit in the SMI_EN (SMI Control and
* Enable register) of the Intel ICH LPC Interface Bridge.
*/
sysenv = getenv("smbios.system.product");
sysenv = kern_getenv("smbios.system.product");
if (sysenv != NULL) {
if (strncmp(sysenv, "MacBook1,1", 10) == 0 ||
strncmp(sysenv, "MacBook3,1", 10) == 0 ||
@ -314,7 +314,7 @@ cpu_startup(dummy)
* Display physical memory if SMBIOS reports reasonable amount.
*/
memsize = 0;
sysenv = getenv("smbios.memory.enabled");
sysenv = kern_getenv("smbios.memory.enabled");
if (sysenv != NULL) {
memsize = (uintmax_t)strtoul(sysenv, (char **)NULL, 10) << 10;
freeenv(sysenv);

View File

@ -165,7 +165,7 @@ xen_boothowto(char *envp)
/* get equivalents from the environment */
for (i = 0; howto_names[i].ev != NULL; i++)
if (getenv(howto_names[i].ev) != NULL)
if (kern_getenv(howto_names[i].ev) != NULL)
howto |= howto_names[i].mask;
return howto;
}

View File

@ -716,7 +716,7 @@ start_init(void *dummy)
p->p_vmspace->vm_maxsaddr = (caddr_t)addr;
p->p_vmspace->vm_ssize = 1;
if ((var = getenv("init_path")) != NULL) {
if ((var = kern_getenv("init_path")) != NULL) {
strlcpy(init_path, var, sizeof(init_path));
freeenv(var);
}

View File

@ -30,7 +30,7 @@
* dynamic array of strings later when the VM subsystem is up.
*
* We make these available through the kenv(2) syscall for userland
* and through getenv()/freeenv() setenv() unsetenv() testenv() for
* and through kern_getenv()/freeenv() kern_setenv() kern_unsetenv() testenv() for
* the kernel.
*/
@ -156,7 +156,7 @@ sys_kenv(td, uap)
if (error)
goto done;
#endif
value = getenv(name);
value = kern_getenv(name);
if (value == NULL) {
error = ENOENT;
goto done;
@ -188,7 +188,7 @@ sys_kenv(td, uap)
error = mac_kenv_check_set(td->td_ucred, name, value);
if (error == 0)
#endif
setenv(name, value);
kern_setenv(name, value);
free(value, M_TEMP);
break;
case KENV_UNSET:
@ -197,7 +197,7 @@ sys_kenv(td, uap)
if (error)
goto done;
#endif
error = unsetenv(name);
error = kern_unsetenv(name);
if (error)
error = ENOENT;
break;
@ -312,7 +312,7 @@ _getenv_static(const char *name)
* after use.
*/
char *
getenv(const char *name)
kern_getenv(const char *name)
{
char buf[KENV_MNAMELEN + 1 + KENV_MVALLEN + 1];
char *ret;
@ -373,7 +373,7 @@ setenv_static(const char *name, const char *value)
* Set an environment variable by name.
*/
int
setenv(const char *name, const char *value)
kern_setenv(const char *name, const char *value)
{
char *buf, *cp, *oldenv;
int namelen, vallen, i;
@ -422,7 +422,7 @@ setenv(const char *name, const char *value)
* Unset an environment variable string.
*/
int
unsetenv(const char *name)
kern_unsetenv(const char *name)
{
char *cp, *oldenv;
int i, j;

View File

@ -241,7 +241,7 @@ sysctl_load_tunable_by_oid_locked(struct sysctl_oid *oidp)
req.newptr = &val_64;
break;
case CTLTYPE_STRING:
penv = getenv(path + rem);
penv = kern_getenv(path + rem);
if (penv == NULL)
return;
req.newlen = strlen(penv);

View File

@ -109,7 +109,7 @@ sysctl_hintmode(SYSCTL_HANDLER_ARGS)
line = malloc(i+1, M_TEMP, M_WAITOK);
strcpy(line, cp);
line[eqidx] = '\0';
setenv(line, line + eqidx + 1);
kern_setenv(line, line + eqidx + 1);
free(line, M_TEMP);
cp += i + 1;
}

View File

@ -188,7 +188,7 @@ detect_virtual(void)
char *sysenv;
int i;
sysenv = getenv("smbios.bios.vendor");
sysenv = kern_getenv("smbios.bios.vendor");
if (sysenv != NULL) {
for (i = 0; vm_bnames[i] != NULL; i++)
if (strcmp(sysenv, vm_bnames[i]) == 0) {
@ -197,7 +197,7 @@ detect_virtual(void)
}
freeenv(sysenv);
}
sysenv = getenv("smbios.system.product");
sysenv = kern_getenv("smbios.system.product");
if (sysenv != NULL) {
for (i = 0; vm_pnames[i] != NULL; i++)
if (strcmp(sysenv, vm_pnames[i]) == 0) {

View File

@ -445,7 +445,7 @@ parse_dir_ask_printenv(const char *var)
{
char *val;
val = getenv(var);
val = kern_getenv(var);
if (val != NULL) {
printf(" %s=%s\n", var, val);
freeenv(val);
@ -836,9 +836,9 @@ vfs_mountroot_conf0(struct sbuf *sb)
sbuf_printf(sb, "cd9660:/dev/acd0 ro\n");
sbuf_printf(sb, ".timeout %d\n", root_mount_timeout);
}
s = getenv("vfs.root.mountfrom");
s = kern_getenv("vfs.root.mountfrom");
if (s != NULL) {
opt = getenv("vfs.root.mountfrom.options");
opt = kern_getenv("vfs.root.mountfrom.options");
tok = s;
error = parse_token(&tok, &mnt);
while (!error) {

View File

@ -92,9 +92,9 @@ parse_argv(char *str)
} else {
n = strsep(&v, "=");
if (v == NULL)
setenv(n, "1");
kern_setenv(n, "1");
else
setenv(n, v);
kern_setenv(n, v);
}
}
}
@ -127,8 +127,8 @@ ar71xx_redboot_get_macaddr(void)
* "ethaddr" is passed via envp on RedBoot platforms
* "kmac" is passed via argv on RouterBOOT platforms
*/
if ((var = getenv("ethaddr")) != NULL ||
(var = getenv("kmac")) != NULL) {
if ((var = kern_getenv("ethaddr")) != NULL ||
(var = kern_getenv("kmac")) != NULL) {
count = sscanf(var, "%x%*c%x%*c%x%*c%x%*c%x%*c%x",
&ar711_base_mac[0], &ar711_base_mac[1],
&ar711_base_mac[2], &ar711_base_mac[3],
@ -296,7 +296,7 @@ platform_start(__register_t a0 __unused, __register_t a1 __unused,
if (MIPS_IS_VALID_PTR(envp)) {
for (i = 0; envp[i]; i+=2) {
printf(" %s = %s\n", envp[i], envp[i+1]);
setenv(envp[i], envp[i+1]);
kern_setenv(envp[i], envp[i+1]);
}
}
else

View File

@ -282,9 +282,9 @@ xlp_parse_bootargs(char *cmdline)
} else {
n = strsep(&v, "=");
if (v == NULL)
setenv(n, "1");
kern_setenv(n, "1");
else
setenv(n, v);
kern_setenv(n, v);
}
}
}
@ -349,9 +349,9 @@ xlp_bootargs_init(__register_t arg)
v = buf;
n = strsep(&v, "=");
if (v == NULL)
setenv(n, "1");
kern_setenv(n, "1");
else
setenv(n, v);
kern_setenv(n, v);
p += strlen(p) + 1;
}
@ -360,7 +360,7 @@ xlp_bootargs_init(__register_t arg)
xlp_hw_thread_mask = mask;
/* command line argument */
v = getenv("bootargs");
v = kern_getenv("bootargs");
if (v != NULL) {
strlcpy(buf, v, sizeof(buf));
xlp_parse_bootargs(buf);

View File

@ -148,7 +148,7 @@ xlr_parse_mmu_options(void)
* We don't support sharing TLB per core - TODO
*/
xlr_shtlb_enabled = 0;
if ((hw_env = getenv("xlr.shtlb")) != NULL) {
if ((hw_env = kern_getenv("xlr.shtlb")) != NULL) {
start = hw_env;
tmp = strtoul(start, &end, 0);
if (start != end)
@ -230,9 +230,9 @@ xlr_set_boot_flags(void)
{
char *p;
p = getenv("bootflags");
p = kern_getenv("bootflags");
if (p == NULL)
p = getenv("boot_flags"); /* old style */
p = kern_getenv("boot_flags"); /* old style */
if (p == NULL)
return;

View File

@ -1452,7 +1452,7 @@ bootpc_decode_reply(struct nfsv3_diskless *nd, struct bootpc_ifcontext *ifctx,
* the server value).
*/
p = NULL;
if ((s = getenv("vfs.root.mountfrom")) != NULL) {
if ((s = kern_getenv("vfs.root.mountfrom")) != NULL) {
if ((p = strstr(s, "nfs:")) != NULL)
p = strdup(p + 4, M_TEMP);
freeenv(s);
@ -1723,7 +1723,7 @@ bootpc_init(void)
if (gctx->gotrootpath != 0) {
setenv("boot.netif.name", ifctx->ifp->if_xname);
kern_setenv("boot.netif.name", ifctx->ifp->if_xname);
error = md_mount(&nd->root_saddr, nd->root_hostnam,
nd->root_fh, &nd->root_fhsize,

View File

@ -175,7 +175,7 @@ nfs_setup_diskless(void)
return;
/* get handle size. If this succeeds, it's an NFSv3 setup. */
if ((cp = getenv("boot.nfsroot.nfshandlelen")) != NULL) {
if ((cp = kern_getenv("boot.nfsroot.nfshandlelen")) != NULL) {
cnt = sscanf(cp, "%d", &len);
freeenv(cp);
if (cnt != 1 || len == 0 || len > NFSX_V3FHMAX) {
@ -237,7 +237,7 @@ nfs_setup_diskless(void)
printf("nfs_diskless: no interface\n");
return; /* no matching interface */
match_done:
setenv("boot.netif.name", ifp->if_xname);
kern_setenv("boot.netif.name", ifp->if_xname);
if (is_nfsv3 != 0) {
strlcpy(nd3->myif.ifra_name, ifp->if_xname,
sizeof(nd3->myif.ifra_name));
@ -267,11 +267,11 @@ nfs_setup_diskless(void)
printf("nfs_diskless: bad NFS handle len=%d\n", fhlen);
return;
}
if ((cp = getenv("boot.nfsroot.path")) != NULL) {
if ((cp = kern_getenv("boot.nfsroot.path")) != NULL) {
strncpy(nd3->root_hostnam, cp, MNAMELEN - 1);
freeenv(cp);
}
if ((cp = getenv("boot.nfsroot.options")) != NULL) {
if ((cp = kern_getenv("boot.nfsroot.options")) != NULL) {
nfs_parse_options(cp, &nd3->root_args);
freeenv(cp);
}
@ -301,11 +301,11 @@ nfs_setup_diskless(void)
printf("nfs_diskless: no NFS handle\n");
return;
}
if ((cp = getenv("boot.nfsroot.path")) != NULL) {
if ((cp = kern_getenv("boot.nfsroot.path")) != NULL) {
strncpy(nd->root_hostnam, cp, MNAMELEN - 1);
freeenv(cp);
}
if ((cp = getenv("boot.nfsroot.options")) != NULL) {
if ((cp = kern_getenv("boot.nfsroot.options")) != NULL) {
struct nfs_args args;
/*
@ -339,7 +339,7 @@ inaddr_to_sockaddr(char *ev, struct sockaddr_in *sa)
sa->sin_len = sizeof(*sa);
sa->sin_family = AF_INET;
if ((cp = getenv(ev)) == NULL)
if ((cp = kern_getenv(ev)) == NULL)
return (1);
count = sscanf(cp, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]);
freeenv(cp);
@ -362,7 +362,7 @@ hwaddr_to_sockaddr(char *ev, struct sockaddr_dl *sa)
sa->sdl_family = AF_LINK;
sa->sdl_type = IFT_ETHER;
sa->sdl_alen = ETHER_ADDR_LEN;
if ((cp = getenv(ev)) == NULL)
if ((cp = kern_getenv(ev)) == NULL)
return (1);
count = sscanf(cp, "%x:%x:%x:%x:%x:%x",
&a[0], &a[1], &a[2], &a[3], &a[4], &a[5]);
@ -384,7 +384,7 @@ decode_nfshandle(char *ev, u_char *fh, int maxfh)
u_char *cp, *ep;
int len, val;
ep = cp = getenv(ev);
ep = cp = kern_getenv(ev);
if (cp == NULL)
return (0);
if ((strlen(cp) < 2) || (*cp != 'X')) {

View File

@ -485,7 +485,7 @@ nfs_mountroot(struct mount *mp)
if (error)
panic("nfs_mountroot: SIOCAIFADDR: %d", error);
if ((cp = getenv("boot.netif.mtu")) != NULL) {
if ((cp = kern_getenv("boot.netif.mtu")) != NULL) {
ir.ifr_mtu = strtol(cp, NULL, 10);
bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ);
freeenv(cp);

View File

@ -566,7 +566,7 @@ powerpc_init(vm_offset_t startkernel, vm_offset_t endkernel,
/*
* Grab booted kernel's name
*/
env = getenv("kernelname");
env = kern_getenv("kernelname");
if (env != NULL) {
strlcpy(kernelname, env, sizeof(kernelname));
freeenv(env);

View File

@ -511,7 +511,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
* Initialize tunables.
*/
init_param2(physmem);
env = getenv("kernelname");
env = kern_getenv("kernelname");
if (env != NULL) {
strlcpy(kernelname, env, sizeof(kernelname));
freeenv(env);

View File

@ -296,7 +296,7 @@ int cr_cansee(struct ucred *u1, struct ucred *u2);
int cr_canseesocket(struct ucred *cred, struct socket *so);
int cr_canseeinpcb(struct ucred *cred, struct inpcb *inp);
char *getenv(const char *name);
char *kern_getenv(const char *name);
void freeenv(char *env);
int getenv_int(const char *name, int *data);
int getenv_uint(const char *name, unsigned int *data);
@ -304,8 +304,8 @@ int getenv_long(const char *name, long *data);
int getenv_ulong(const char *name, unsigned long *data);
int getenv_string(const char *name, char *data, int size);
int getenv_quad(const char *name, quad_t *data);
int setenv(const char *name, const char *value);
int unsetenv(const char *name);
int kern_setenv(const char *name, const char *value);
int kern_unsetenv(const char *name);
int testenv(const char *name);
typedef uint64_t (cpu_tick_f)(void);

View File

@ -453,7 +453,7 @@ vm_page_startup(vm_offset_t vaddr)
*/
vm_cnt.v_page_count = 0;
vm_cnt.v_free_count = 0;
list = getenv("vm.blacklist");
list = kern_getenv("vm.blacklist");
for (i = 0; phys_avail[i + 1] != 0; i += 2) {
pa = phys_avail[i];
last_pa = phys_avail[i + 1];

View File

@ -76,7 +76,7 @@ dmar_bus_dma_is_dev_disabled(int domain, int bus, int slot, int func)
snprintf(str, sizeof(str), "hw.busdma.pci%d.%d.%d.%d.bounce",
domain, bus, slot, func);
env = getenv(str);
env = kern_getenv(str);
if (env == NULL)
return (false);
freeenv(env);

View File

@ -155,7 +155,7 @@ tsc_freq_vmware(void)
if (strncmp(hv_sig, "VMwareVMware", 12) != 0)
return (0);
} else {
p = getenv("smbios.system.serial");
p = kern_getenv("smbios.system.serial");
if (p == NULL)
return (0);
if (strncmp(p, "VMware-", 7) != 0 &&

View File

@ -309,7 +309,7 @@ xen_pv_set_boothowto(void)
/* get equivalents from the environment */
for (i = 0; howto_names[i].ev != NULL; i++) {
if (getenv(howto_names[i].ev) != NULL)
if (kern_getenv(howto_names[i].ev) != NULL)
boothowto |= howto_names[i].mask;
}
}