Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Oct 2014 18:04:43 +0000 (UTC)
From:      Davide Italiano <davide@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273174 - in head/sys: amd64/amd64 amd64/vmm arm/arm cam/ata cddl/contrib/opensolaris/uts/common/dtrace dev/acpica dev/asmc dev/cfi dev/drm2 dev/hatm dev/mii dev/nfe dev/patm dev/pci de...
Message-ID:  <201410161804.s9GI4hed091471@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davide
Date: Thu Oct 16 18:04:43 2014
New Revision: 273174
URL: https://svnweb.freebsd.org/changeset/base/273174

Log:
  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

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/vmm/vmm.c
  head/sys/arm/arm/machdep.c
  head/sys/cam/ata/ata_da.c
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/dev/acpica/acpi.c
  head/sys/dev/asmc/asmc.c
  head/sys/dev/cfi/cfi_core.c
  head/sys/dev/drm2/drm_crtc_helper.c
  head/sys/dev/hatm/if_hatm.c
  head/sys/dev/mii/brgphy.c
  head/sys/dev/nfe/if_nfe.c
  head/sys/dev/patm/if_patm_attach.c
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/rt/if_rt.c
  head/sys/dev/uart/uart_subr.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/geom/geom_dev.c
  head/sys/geom/raid/g_raid.c
  head/sys/geom/sched/g_sched.c
  head/sys/i386/i386/bios.c
  head/sys/i386/i386/machdep.c
  head/sys/i386/xen/xen_machdep.c
  head/sys/kern/init_main.c
  head/sys/kern/kern_environment.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/subr_hints.c
  head/sys/kern/subr_param.c
  head/sys/kern/vfs_mountroot.c
  head/sys/mips/atheros/ar71xx_machdep.c
  head/sys/mips/nlm/xlp_machdep.c
  head/sys/mips/rmi/xlr_machdep.c
  head/sys/nfs/bootp_subr.c
  head/sys/nfs/nfs_diskless.c
  head/sys/nfsclient/nfs_vfsops.c
  head/sys/powerpc/aim/machdep.c
  head/sys/sparc64/sparc64/machdep.c
  head/sys/sys/systm.h
  head/sys/vm/vm_page.c
  head/sys/x86/iommu/busdma_dmar.c
  head/sys/x86/x86/tsc.c
  head/sys/x86/xen/pv.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/amd64/amd64/machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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
 	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));
 

Modified: head/sys/amd64/vmm/vmm.c
==============================================================================
--- head/sys/amd64/vmm/vmm.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/amd64/vmm/vmm.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -1934,7 +1934,7 @@ vmm_is_pptdev(int bus, int slot, int fun
 	/* 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';

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/arm/arm/machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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));
 

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/cam/ata/ata_da.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -1316,7 +1316,7 @@ adaregister(struct cam_periph *periph, v
 			    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;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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;

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/acpica/acpi.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);
 

Modified: head/sys/dev/asmc/asmc.c
==============================================================================
--- head/sys/dev/asmc/asmc.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/asmc/asmc.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);
 

Modified: head/sys/dev/cfi/cfi_core.c
==============================================================================
--- head/sys/dev/cfi/cfi_core.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/cfi/cfi_core.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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
 

Modified: head/sys/dev/drm2/drm_crtc_helper.c
==============================================================================
--- head/sys/dev/drm2/drm_crtc_helper.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/drm2/drm_crtc_helper.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -53,7 +53,7 @@ drm_fetch_cmdline_mode_from_kenv(struct 
 	    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);

Modified: head/sys/dev/hatm/if_hatm.c
==============================================================================
--- head/sys/dev/hatm/if_hatm.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/hatm/if_hatm.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -1319,7 +1319,7 @@ kenv_getuint(struct hatm_softc *sc, cons
 	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') {

Modified: head/sys/dev/mii/brgphy.c
==============================================================================
--- head/sys/dev/mii/brgphy.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/mii/brgphy.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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)

Modified: head/sys/dev/nfe/if_nfe.c
==============================================================================
--- head/sys/dev/nfe/if_nfe.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/nfe/if_nfe.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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]);

Modified: head/sys/dev/patm/if_patm_attach.c
==============================================================================
--- head/sys/dev/patm/if_patm_attach.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/patm/if_patm_attach.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -579,7 +579,7 @@ patm_env_getuint(struct patm_softc *sc, 
 	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)

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/pci/pci.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -3270,14 +3270,14 @@ pci_reserve_secbus(device_t bus, device_
 
 	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);

Modified: head/sys/dev/pci/pci_pci.c
==============================================================================
--- head/sys/dev/pci/pci_pci.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/pci/pci_pci.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);

Modified: head/sys/dev/rt/if_rt.c
==============================================================================
--- head/sys/dev/rt/if_rt.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/rt/if_rt.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -241,8 +241,8 @@ ether_request_mac(device_t dev, uint8_t 
 	 * "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",

Modified: head/sys/dev/uart/uart_subr.c
==============================================================================
--- head/sys/dev/uart/uart_subr.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/dev/uart/uart_subr.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -214,9 +214,9 @@ uart_getenv(int devtype, struct uart_dev
 	 * 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)

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/geom/geom_dev.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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
 	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);

Modified: head/sys/geom/raid/g_raid.c
==============================================================================
--- head/sys/geom/raid/g_raid.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/geom/raid/g_raid.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -1656,7 +1656,7 @@ g_raid_launch_provider(struct g_raid_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);

Modified: head/sys/geom/sched/g_sched.c
==============================================================================
--- head/sys/geom/sched/g_sched.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/geom/sched/g_sched.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -1661,7 +1661,7 @@ g_sched_taste(struct g_class *mp, struct
 		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
 		    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";
 

Modified: head/sys/i386/i386/bios.c
==============================================================================
--- head/sys/i386/i386/bios.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/i386/i386/bios.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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 */

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/i386/i386/machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);

Modified: head/sys/i386/xen/xen_machdep.c
==============================================================================
--- head/sys/i386/xen/xen_machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/i386/xen/xen_machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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;
 }

Modified: head/sys/kern/init_main.c
==============================================================================
--- head/sys/kern/init_main.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/kern/init_main.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);
 	}

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/kern/kern_environment.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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 ch
  * 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 *val
  * Unset an environment variable string.
  */
 int
-unsetenv(const char *name)
+kern_unsetenv(const char *name)
 {
 	char *cp, *oldenv;
 	int i, j;

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/kern/kern_sysctl.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -241,7 +241,7 @@ sysctl_load_tunable_by_oid_locked(struct
 		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);

Modified: head/sys/kern/subr_hints.c
==============================================================================
--- head/sys/kern/subr_hints.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/kern/subr_hints.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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;
 	}

Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/kern/subr_param.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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) {

Modified: head/sys/kern/vfs_mountroot.c
==============================================================================
--- head/sys/kern/vfs_mountroot.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/kern/vfs_mountroot.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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) {

Modified: head/sys/mips/atheros/ar71xx_machdep.c
==============================================================================
--- head/sys/mips/atheros/ar71xx_machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/mips/atheros/ar71xx_machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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,
 	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 

Modified: head/sys/mips/nlm/xlp_machdep.c
==============================================================================
--- head/sys/mips/nlm/xlp_machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/mips/nlm/xlp_machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);

Modified: head/sys/mips/rmi/xlr_machdep.c
==============================================================================
--- head/sys/mips/rmi/xlr_machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/mips/rmi/xlr_machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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;
 

Modified: head/sys/nfs/bootp_subr.c
==============================================================================
--- head/sys/nfs/bootp_subr.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/nfs/bootp_subr.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -1452,7 +1452,7 @@ bootpc_decode_reply(struct nfsv3_diskles
 	 *    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 @@ retry:
 
 	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,

Modified: head/sys/nfs/nfs_diskless.c
==============================================================================
--- head/sys/nfs/nfs_diskless.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/nfs/nfs_diskless.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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 @@ match_done:
 			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 @@ match_done:
 			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 sock
 	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 sock
 	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, i
 	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')) {

Modified: head/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- head/sys/nfsclient/nfs_vfsops.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/nfsclient/nfs_vfsops.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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);

Modified: head/sys/powerpc/aim/machdep.c
==============================================================================
--- head/sys/powerpc/aim/machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/powerpc/aim/machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -566,7 +566,7 @@ powerpc_init(vm_offset_t startkernel, vm
 	/*
 	 * Grab booted kernel's name
 	 */
-        env = getenv("kernelname");
+        env = kern_getenv("kernelname");
         if (env != NULL) {
 		strlcpy(kernelname, env, sizeof(kernelname));
 		freeenv(env);

Modified: head/sys/sparc64/sparc64/machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/machdep.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/sparc64/sparc64/machdep.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -511,7 +511,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
 	 * Initialize tunables.
 	 */
 	init_param2(physmem);
-	env = getenv("kernelname");
+	env = kern_getenv("kernelname");
 	if (env != NULL) {
 		strlcpy(kernelname, env, sizeof(kernelname));
 		freeenv(env);

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/sys/systm.h	Thu Oct 16 18:04:43 2014	(r273174)
@@ -296,7 +296,7 @@ int	cr_cansee(struct ucred *u1, struct u
 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 *
 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);

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/vm/vm_page.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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];

Modified: head/sys/x86/iommu/busdma_dmar.c
==============================================================================
--- head/sys/x86/iommu/busdma_dmar.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/x86/iommu/busdma_dmar.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -76,7 +76,7 @@ dmar_bus_dma_is_dev_disabled(int domain,
 
 	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);

Modified: head/sys/x86/x86/tsc.c
==============================================================================
--- head/sys/x86/x86/tsc.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/x86/x86/tsc.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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 &&

Modified: head/sys/x86/xen/pv.c
==============================================================================
--- head/sys/x86/xen/pv.c	Thu Oct 16 15:59:00 2014	(r273173)
+++ head/sys/x86/xen/pv.c	Thu Oct 16 18:04:43 2014	(r273174)
@@ -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;
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410161804.s9GI4hed091471>