Date: Tue, 26 Aug 2008 21:38:28 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 148559 for review Message-ID: <200808262138.m7QLcSOW025490@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148559 Change 148559 by jb@freebsd3 on 2008/08/26 21:38:26 IF6 Affected files ... .. //depot/projects/dtrace6/src/Makefile.inc1#7 integrate .. //depot/projects/dtrace6/src/sys/dev/gem/if_gem.c#3 integrate .. //depot/projects/dtrace6/src/sys/sparc64/central/central.c#2 integrate .. //depot/projects/dtrace6/src/sys/sparc64/conf/GENERIC#4 integrate .. //depot/projects/dtrace6/src/sys/sparc64/ebus/ebus.c#3 integrate .. //depot/projects/dtrace6/src/sys/sparc64/fhc/fhc.c#2 integrate .. //depot/projects/dtrace6/src/sys/sparc64/fhc/fhc_central.c#2 integrate .. //depot/projects/dtrace6/src/sys/sparc64/include/cpufunc.h#3 integrate .. //depot/projects/dtrace6/src/sys/sparc64/sbus/dma_sbus.c#2 integrate .. //depot/projects/dtrace6/src/sys/sparc64/sbus/sbus.c#4 integrate .. //depot/projects/dtrace6/src/usr.bin/ldd/Makefile#2 integrate .. //depot/projects/dtrace6/src/usr.bin/ldd/ldd.1#3 integrate .. //depot/projects/dtrace6/src/usr.bin/ldd/ldd.c#4 integrate .. //depot/projects/dtrace6/src/usr.sbin/mountd/mountd.8#2 integrate .. //depot/projects/dtrace6/src/usr.sbin/mountd/mountd.c#2 integrate Differences ... ==== //depot/projects/dtrace6/src/Makefile.inc1#7 (text+ko) ==== @@ -1,5 +1,5 @@ # -# $FreeBSD: src/Makefile.inc1,v 1.499.2.21 2007/05/16 21:39:44 ambrisko Exp $ +# $FreeBSD: src/Makefile.inc1,v 1.499.2.22 2008/08/26 17:40:41 jhb Exp $ # # Make command line options: # -DNO_DYNAMICROOT do not link /bin and /sbin dynamically @@ -472,8 +472,8 @@ cd ${.CURDIR}; \ ${LIB32WMAKE} -f Makefile.inc1 libraries .for _t in obj depend all - cd ${.CURDIR}/libexec/rtld-elf; \ - PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t} + cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t} + cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t} .endfor distribute32 install32: @@ -487,10 +487,11 @@ .if !defined(NO_CRYPT) cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} .endif - cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} + cd ${.CURDIR}/libexec/rtld-elf; \ + PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} + cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} .endif - WMAKE_TGTS= .if !defined(SUBDIR_OVERRIDE) WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools @@ -610,7 +611,8 @@ @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute .if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32) - ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32 + ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ + DISTRIBUTION=lib32 .endif distrib-dirs distribution: ==== //depot/projects/dtrace6/src/sys/dev/gem/if_gem.c#3 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem.c,v 1.29.2.8 2008/07/13 21:36:42 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem.c,v 1.29.2.9 2008/08/26 18:13:40 marius Exp $"); /* * Driver for Apple GMAC, Sun ERI and Sun GEM Ethernet controllers @@ -87,7 +87,7 @@ #define TRIES 10000 /* - * The GEM hardware support basic TCP/UDP checksum offloading. However, + * The hardware supports basic TCP/UDP checksum offloading. However, * the hardware doesn't compensate the checksum for UDP datagram which * can yield to 0x0. As a safe guard, UDP checksum offload is disabled * by default. It can be reactivated by setting special link option @@ -537,18 +537,26 @@ { struct gem_softc *sc = arg; struct ifnet *ifp; + uint32_t v; GEM_LOCK_ASSERT(sc, MA_OWNED); ifp = sc->sc_ifp; /* - * Unload collision counters. + * Unload collision and error counters. */ ifp->if_collisions += GEM_BANK1_READ_4(sc, GEM_MAC_NORM_COLL_CNT) + - GEM_BANK1_READ_4(sc, GEM_MAC_FIRST_COLL_CNT) + - GEM_BANK1_READ_4(sc, GEM_MAC_EXCESS_COLL_CNT) + + GEM_BANK1_READ_4(sc, GEM_MAC_FIRST_COLL_CNT); + v = GEM_BANK1_READ_4(sc, GEM_MAC_EXCESS_COLL_CNT) + GEM_BANK1_READ_4(sc, GEM_MAC_LATE_COLL_CNT); + ifp->if_collisions += v; + ifp->if_oerrors += v; + ifp->if_ierrors += + GEM_BANK1_READ_4(sc, GEM_MAC_RX_LEN_ERR_CNT) + + GEM_BANK1_READ_4(sc, GEM_MAC_RX_ALIGN_ERR) + + GEM_BANK1_READ_4(sc, GEM_MAC_RX_CRC_ERR_CNT) + + GEM_BANK1_READ_4(sc, GEM_MAC_RX_CODE_VIOL); /* * Then clear the hardware counters. @@ -557,6 +565,10 @@ GEM_BANK1_WRITE_4(sc, GEM_MAC_FIRST_COLL_CNT, 0); GEM_BANK1_WRITE_4(sc, GEM_MAC_EXCESS_COLL_CNT, 0); GEM_BANK1_WRITE_4(sc, GEM_MAC_LATE_COLL_CNT, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_LEN_ERR_CNT, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_ALIGN_ERR, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_CRC_ERR_CNT, 0); + GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_CODE_VIOL, 0); mii_tick(sc->sc_mii); @@ -1826,7 +1838,7 @@ /* * MII interface * - * The GEM MII interface supports at least three different operating modes: + * The MII interface supports at least three different operating modes: * * Bitbang mode is implemented using data, clock and output enable registers. * @@ -2058,12 +2070,12 @@ v |= GEM_MAC_XIF_TX_MII_ENA; if ((sc->sc_flags & GEM_SERDES) == 0) { if ((GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & - GEM_MIF_CONFIG_PHY_SEL) != 0 && - (IFM_OPTIONS(sc->sc_mii->mii_media_active) & - IFM_FDX) == 0) + GEM_MIF_CONFIG_PHY_SEL) != 0) { /* External MII needs echo disable if half duplex. */ - v |= GEM_MAC_XIF_ECHO_DISABL; - else + if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & + IFM_FDX) == 0) + v |= GEM_MAC_XIF_ECHO_DISABL; + } else /* * Internal MII needs buffer enable. * XXX buffer enable makes only sense for an ==== //depot/projects/dtrace6/src/sys/sparc64/central/central.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/sparc64/central/central.c,v 1.8.2.1 2006/01/30 22:30:50 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/sparc64/central/central.c,v 1.8.2.2 2008/08/26 18:46:08 marius Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -112,6 +112,7 @@ static devclass_t central_devclass; DRIVER_MODULE(central, nexus, central_driver, central_devclass, 0, 0); +MODULE_VERSION(central, 1); static int central_probe(device_t dev) ==== //depot/projects/dtrace6/src/sys/sparc64/conf/GENERIC#4 (text+ko) ==== @@ -18,7 +18,7 @@ # # For hardware specific information check HARDWARE.TXT # -# $FreeBSD: src/sys/sparc64/conf/GENERIC,v 1.96.2.14 2008/04/24 10:46:23 dfr Exp $ +# $FreeBSD: src/sys/sparc64/conf/GENERIC,v 1.96.2.15 2008/08/26 18:06:49 marius Exp $ machine sparc64 cpu SUN4U @@ -113,6 +113,8 @@ device atkbd # AT keyboard device psm # PS/2 mouse +device kbdmux # keyboard multiplexer + # syscons is the default console driver, resembling an SCO console device sc device creator # Creator, Creator3D and Elite3D framebuffers @@ -143,7 +145,7 @@ #device plip # TCP/IP over parallel #device ppi # Parallel port interface device #device vpo # Requires scbus and da - + # PCI Ethernet NICs. #device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel PRO/1000 adapter Gigabit Ethernet Card ==== //depot/projects/dtrace6/src/sys/sparc64/ebus/ebus.c#3 (text+ko) ==== @@ -30,21 +30,10 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/sparc64/ebus/ebus.c,v 1.23.2.2 2007/10/03 20:41:35 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/sparc64/ebus/ebus.c,v 1.23.2.3 2008/08/26 18:22:11 marius Exp $"); /* - * UltraSPARC 5 and beyond Ebus support. - * - * note that this driver is not complete: - * - ebus2 dma code is completely unwritten - * - interrupt establish is written and appears to work - * - bus map code is written and appears to work - * XXX: This is PCI specific, however, there exist SBus-to-EBus bridges... - * XXX: The EBus was designed to allow easy adaption of ISA devices to it - a - * compatability layer for ISA devices might be nice, although probably not - * easily possible because of some cruft (like in[bwl]/out[bwl] and friends). - * Additionally, the existing ISA code is limited to one ISA bus, however, - * there are machines with both ISA and EBus. + * UltraSPARC 5 and beyond EBus support */ #include <sys/param.h> @@ -92,8 +81,6 @@ }; struct ebus_softc { - phandle_t sc_node; - struct isa_ranges *sc_range; struct ebus_rinfo *sc_rinfo; @@ -132,7 +119,7 @@ /* Bus interface */ DEVMETHOD(bus_print_child, ebus_print_child), DEVMETHOD(bus_probe_nomatch, ebus_probe_nomatch), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_alloc_resource, ebus_alloc_resource), DEVMETHOD(bus_get_resource_list, ebus_get_resource_list), @@ -160,6 +147,8 @@ static devclass_t ebus_devclass; DRIVER_MODULE(ebus, pci, ebus_driver, ebus_devclass, 0, 0); +MODULE_DEPEND(ebus, pci, 1, 1, 1); +MODULE_VERSION(ebus, 1); static int ebus_probe(device_t dev) @@ -192,8 +181,8 @@ int i, rnum, rid; sc = device_get_softc(dev); - sc->sc_node = node = ofw_bus_get_node(dev); + node = ofw_bus_get_node(dev); sc->sc_nrange = OF_getprop_alloc(node, "ranges", sizeof(*sc->sc_range), (void **)&sc->sc_range); if (sc->sc_nrange == -1) { @@ -224,7 +213,7 @@ goto fail; } if (rman_manage_region(&eri->eri_rman, rman_get_start(res), - rman_get_end(res)) != 0) { + rman_get_end(res)) != 0) { printf("ebus_attach: failed to register region!"); rman_fini(&eri->eri_rman); goto fail; @@ -307,7 +296,7 @@ sc = (struct ebus_softc *)device_get_softc(bus); rl = BUS_GET_RESOURCE_LIST(bus, child); /* - * Map ebus ranges to PCI ranges. This may include changing the + * Map EBus ranges to PCI ranges. This may include changing the * allocation type. */ switch (type) { @@ -353,11 +342,10 @@ return (resource_list_alloc(rl, bus, child, type, rid, start, end, count, flags)); } - return (NULL); } -int +static int ebus_release_resource(device_t bus, device_t child, int type, int rid, struct resource *res) { @@ -368,7 +356,7 @@ rl = BUS_GET_RESOURCE_LIST(bus, child); switch (type) { - case SYS_RES_MEMORY: + case SYS_RES_MEMORY: if ((rv = rman_release_resource(res)) != 0) return (rv); if (!passthrough) { ==== //depot/projects/dtrace6/src/sys/sparc64/fhc/fhc.c#2 (text+ko) ==== @@ -25,13 +25,14 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/sparc64/fhc/fhc.c,v 1.13 2005/06/05 10:16:27 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/sparc64/fhc/fhc.c,v 1.13.2.1 2008/08/26 18:46:08 marius Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/module.h> #include <sys/pcpu.h> #include <dev/led/led.h> @@ -68,6 +69,8 @@ static void fhc_intr_stub(void *); static void fhc_led_func(void *, int); +MODULE_VERSION(fhc, 1); + int fhc_probe(device_t dev) { @@ -388,7 +391,7 @@ const char * fhc_get_compat(device_t bus, device_t dev) -{ +{ struct fhc_devinfo *dinfo; dinfo = device_get_ivars(dev); ==== //depot/projects/dtrace6/src/sys/sparc64/fhc/fhc_central.c#2 (text+ko) ==== @@ -24,8 +24,8 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/sparc64/fhc/fhc_central.c,v 1.8.2.1 2006/01/30 22:30:50 marius Exp $"); +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/sys/sparc64/fhc/fhc_central.c,v 1.8.2.2 2008/08/26 18:46:08 marius Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -86,6 +86,7 @@ static devclass_t fhc_central_devclass; DRIVER_MODULE(fhc, central, fhc_central_driver, fhc_central_devclass, 0, 0); +MODULE_DEPEND(fhc, central, 1, 1, 1); static int fhc_central_probe(device_t dev) ==== //depot/projects/dtrace6/src/sys/sparc64/include/cpufunc.h#3 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sparc64/include/cpufunc.h,v 1.20.2.2 2008/08/24 19:19:49 marius Exp $ + * $FreeBSD: src/sys/sparc64/include/cpufunc.h,v 1.20.2.3 2008/08/26 18:50:52 marius Exp $ */ #ifndef _MACHINE_CPUFUNC_H_ @@ -177,14 +177,16 @@ * Macro intended to be used instead of wr(asr23, val, xor) for writing to * the TICK_COMPARE register in order to avoid a bug in BlackBird CPUs that * can cause these writes to fail under certain condidtions which in turn - * causes the hardclock to stop. The workaround is to perform the write - * at the beginning of an I-Cache line directly followed by a dummy read. + * causes the hardclock to stop. The workaround is to read the TICK_COMPARE + * register back immediately after writing to it with these two instructions + * aligned to a quadword boundary in order to ensure that I$ misses won't + * split them up. */ #define wrtickcmpr(val, xor) ({ \ __asm __volatile( \ " ba,pt %%xcc, 1f ; " \ " nop ; " \ - " .align 64 ; " \ + " .align 128 ; " \ "1: wr %0, %1, %%asr23 ; " \ " rd %%asr23, %%g0 ; " \ : : "r" (val), "rI" (xor)); \ ==== //depot/projects/dtrace6/src/sys/sparc64/sbus/dma_sbus.c#2 (text+ko) ==== @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/sparc64/sbus/dma_sbus.c,v 1.1.2.1 2006/01/30 22:30:51 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/sparc64/sbus/dma_sbus.c,v 1.1.2.2 2008/08/26 18:18:30 marius Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -155,6 +155,8 @@ }; DRIVER_MODULE(dma, sbus, dma_driver, dma_devclass, 0, 0); +MODULE_DEPEND(dma, sbus, 1, 1, 1); +MODULE_VERSION(dma, 1); static int dma_probe(device_t dev) ==== //depot/projects/dtrace6/src/sys/sparc64/sbus/sbus.c#4 (text+ko) ==== @@ -98,7 +98,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/sparc64/sbus/sbus.c,v 1.35.2.5 2008/05/19 19:23:05 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/sparc64/sbus/sbus.c,v 1.35.2.6 2008/08/26 18:18:30 marius Exp $"); /* * SBus support. @@ -261,6 +261,7 @@ static devclass_t sbus_devclass; DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0); +MODULE_VERSION(sbus, 1); #define OFW_SBUS_TYPE "sbus" #define OFW_SBUS_NAME "sbus" ==== //depot/projects/dtrace6/src/usr.bin/ldd/Makefile#2 (text+ko) ==== @@ -1,6 +1,6 @@ -# $FreeBSD: src/usr.bin/ldd/Makefile,v 1.13 2004/06/29 21:13:15 dwmalone Exp $ +# $FreeBSD: src/usr.bin/ldd/Makefile,v 1.13.8.1 2008/08/26 17:40:41 jhb Exp $ -PROG= ldd +PROG?= ldd SRCS= ldd.c .if ${MACHINE_ARCH} == "i386" SRCS+= sods.c ==== //depot/projects/dtrace6/src/usr.bin/ldd/ldd.1#3 (text+ko) ==== @@ -1,4 +1,4 @@ -.\" $FreeBSD: src/usr.bin/ldd/ldd.1,v 1.23.12.2 2008/07/10 01:33:48 edwin Exp $ +.\" $FreeBSD: src/usr.bin/ldd/ldd.1,v 1.23.12.3 2008/08/26 17:40:41 jhb Exp $ .\" .Dd October 22, 1993 .Dt LDD 1 @@ -57,12 +57,6 @@ encoded in the executable. See the source code and include files for the definitive meaning of all the fields. -.Sh BUGS -On 64 bit architectures, dlopen() cannot open 32 bit dynamic libraries, -so -.Nm -will show the error -.Qq "unsupported file layout" . .Sh SEE ALSO .Xr ld 1 , .Xr nm 1 , ==== //depot/projects/dtrace6/src/usr.bin/ldd/ldd.c#4 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/usr.bin/ldd/ldd.c,v 1.33.14.2 2008/07/30 03:32:32 edwin Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/ldd/ldd.c,v 1.33.14.3 2008/08/26 17:40:41 jhb Exp $"); #include <sys/wait.h> @@ -44,10 +44,17 @@ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include "extern.h" +#ifdef COMPAT_32BIT +#define LD_ "LD_32_" +#else +#define LD_ "LD_" +#endif + /* * 32-bit ELF data structures can only be used if the system header[s] declare * them. There is no official macro for determining whether they are declared, @@ -66,30 +73,57 @@ #define TYPE_ELF 2 /* Architecture default */ #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) #define TYPE_ELF32 3 /* Explicit 32 bits on architectures >32 bits */ -#endif + +#define _PATH_LDD32 "/usr/bin/ldd32" + +static int +execldd32(char *file, char *fmt1, char *fmt2, int aflag, int vflag) +{ + char *argv[8]; + int i, rval, status; -#define ENV_OBJECTS 0 -#define ENV_OBJECTS_FMT1 1 -#define ENV_OBJECTS_FMT2 2 -#define ENV_OBJECTS_PROGNAME 3 -#define ENV_OBJECTS_ALL 4 -#define ENV_LAST 5 + unsetenv(LD_ "TRACE_LOADED_OBJECTS"); + rval = 0; + i = 0; + argv[i++] = strdup(_PATH_LDD32); + if (aflag) + argv[i++] = strdup("-a"); + if (vflag) + argv[i++] = strdup("-v"); + if (fmt1 != NULL) { + argv[i++] = strdup("-f"); + argv[i++] = strdup(fmt1); + } + if (fmt2 != NULL) { + argv[i++] = strdup("-f"); + argv[i++] = strdup(fmt2); + } + argv[i++] = strdup(file); + argv[i++] = NULL; -const char *envdef[ENV_LAST] = { - "LD_TRACE_LOADED_OBJECTS", - "LD_TRACE_LOADED_OBJECTS_FMT1", - "LD_TRACE_LOADED_OBJECTS_FMT2", - "LD_TRACE_LOADED_OBJECTS_PROGNAME", - "LD_TRACE_LOADED_OBJECTS_ALL", -}; -#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) -const char *env32[ENV_LAST] = { - "LD_32_TRACE_LOADED_OBJECTS", - "LD_32_TRACE_LOADED_OBJECTS_FMT1", - "LD_32_TRACE_LOADED_OBJECTS_FMT2", - "LD_32_TRACE_LOADED_OBJECTS_PROGNAME", - "LD_32_TRACE_LOADED_OBJECTS_ALL", -}; + switch (fork()) { + case -1: + err(1, "fork"); + break; + case 0: + execv(_PATH_LDD32, argv); + warn("%s", _PATH_LDD32); + _exit(127); + break; + default: + if (wait(&status) < 0) + rval = 1; + else if (WIFSIGNALED(status)) + rval = 1; + else if (WIFEXITED(status) && WEXITSTATUS(status) != 0) + rval = 1; + break; + } + while (i--) + free(argv[i]); + setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1); + return (rval); +} #endif int @@ -144,7 +178,6 @@ rval = 0; for (; argc > 0; argc--, argv++) { int fd, status, is_shlib, rv, type; - const char **env; if ((fd = open(*argv, O_RDONLY, 0)) < 0) { warn("%s", *argv); @@ -161,12 +194,11 @@ switch (type) { case TYPE_ELF: case TYPE_AOUT: - env = envdef; break; #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) case TYPE_ELF32: - env = env32; - break; + rval |= execldd32(*argv, fmt1, fmt2, aflag, vflag); + continue; #endif case TYPE_UNKNOWN: default: @@ -178,15 +210,15 @@ } /* ld.so magic */ - setenv(env[ENV_OBJECTS], "yes", 1); + setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1); if (fmt1 != NULL) - setenv(env[ENV_OBJECTS_FMT1], fmt1, 1); + setenv(LD_ "TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); if (fmt2 != NULL) - setenv(env[ENV_OBJECTS_FMT2], fmt2, 1); + setenv(LD_ "TRACE_LOADED_OBJECTS_FMT2", fmt2, 1); - setenv(env[ENV_OBJECTS_PROGNAME], *argv, 1); + setenv(LD_ "TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); if (aflag) - setenv(env[ENV_OBJECTS_ALL], "1", 1); + setenv(LD_ "TRACE_LOADED_OBJECTS_ALL", "1", 1); else if (fmt1 == NULL && fmt2 == NULL) /* Default formats */ printf("%s:\n", *argv); @@ -197,14 +229,15 @@ err(1, "fork"); break; default: - if (wait(&status) <= 0) { + if (wait(&status) < 0) { warn("wait"); rval |= 1; } else if (WIFSIGNALED(status)) { fprintf(stderr, "%s: signal %d\n", *argv, WTERMSIG(status)); rval |= 1; - } else if (WIFEXITED(status) && WEXITSTATUS(status)) { + } else if (WIFEXITED(status) && + WEXITSTATUS(status) != 0) { fprintf(stderr, "%s: exit status %d\n", *argv, WEXITSTATUS(status)); rval |= 1; ==== //depot/projects/dtrace6/src/usr.sbin/mountd/mountd.8#2 (text+ko) ==== @@ -26,9 +26,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 -.\" $FreeBSD: src/usr.sbin/mountd/mountd.8,v 1.27.8.1 2006/05/10 19:45:56 keramida Exp $ +.\" $FreeBSD: src/usr.sbin/mountd/mountd.8,v 1.27.8.2 2008/08/26 12:05:37 matteo Exp $ .\" -.Dd May 10, 2006 +.Dd October 20, 2007 .Dt MOUNTD 8 .Os .Sh NAME @@ -39,6 +39,7 @@ .Sh SYNOPSIS .Nm .Op Fl 2dlnr +.Op Fl h Ar bindip .Op Fl p Ar port .Op Ar exportsfile .Sh DESCRIPTION @@ -67,6 +68,23 @@ .Nm will not detach from the controlling terminal and will print debugging messages to stderr. +.It Fl h Ar bindip +Specify specific IP addresses to bind to for TCP and UDP requests. +This option may be specified multiple times. +If no +.Fl h +option is specified, +.Nm +will bind to +.Dv INADDR_ANY . +Note that when specifying IP addresses with +.Fl h , +.Nm +will automatically add +.Li 127.0.0.1 +and if IPv6 is enabled, +.Li ::1 +to the list. .It Fl l Cause all succeeded .Nm ==== //depot/projects/dtrace6/src/usr.sbin/mountd/mountd.c#2 (text+ko) ==== @@ -43,7 +43,7 @@ #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/usr.sbin/mountd/mountd.c,v 1.81.2.7 2006/12/19 01:17:58 rodrigc Exp $"); +__FBSDID("$FreeBSD: src/usr.sbin/mountd/mountd.c,v 1.81.2.8 2008/08/26 12:05:37 matteo Exp $"); #include <sys/param.h> #include <sys/mount.h> @@ -161,6 +161,7 @@ int check_options(struct dirlist *); int checkmask(struct sockaddr *sa); int chk_host(struct dirlist *, struct sockaddr *, int *, int *); +void create_service(struct netconfig *nconf); void del_mlist(char *hostp, char *dirp); struct dirlist *dirp_search(struct dirlist *, char *); int do_mount(struct exportlist *, struct grouplist *, int, @@ -206,6 +207,7 @@ struct mountlist *mlhead; struct grouplist *grphead; char exname[MAXPATHLEN]; +char **hosts = NULL; struct xucred def_anon = { XUCRED_VERSION, (uid_t)-2, @@ -215,9 +217,13 @@ }; int force_v2 = 0; int resvport_only = 1; +int nhosts = 0; int dir_only = 1; int dolog = 0; int got_sighup = 0; +int xcreated = 0; + +char *svcport_str = NULL; int opt_flags; static int have_v6 = 1; @@ -255,22 +261,14 @@ char **argv; { fd_set readfds; - struct sockaddr_in sin; - struct sockaddr_in6 sin6; - char *endptr; - SVCXPRT *udptransp, *tcptransp, *udp6transp, *tcp6transp; - struct netconfig *udpconf, *tcpconf, *udp6conf, *tcp6conf; + struct netconfig *nconf; + char *endptr, **hosts_bak; + void *nc_handle; pid_t otherpid; - int udpsock, tcpsock, udp6sock, tcp6sock; - int xcreated = 0, s; + in_port_t svcport; + int c, k, s; int maxrec = RPC_MAXDATASIZE; - int one = 1; - int c, r; - in_port_t svcport = 0; - udp6conf = tcp6conf = NULL; - udp6sock = tcp6sock = 0; - /* Check that another mountd isn't already running. */ pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &otherpid); if (pfh == NULL) { @@ -290,7 +288,7 @@ errx(1, "NFS server is not available or loadable"); } - while ((c = getopt(argc, argv, "2dlnp:r")) != -1) + while ((c = getopt(argc, argv, "2dh:lnp:r")) != -1) switch (c) { case '2': force_v2 = 1; @@ -313,7 +311,29 @@ if (endptr == NULL || *endptr != '\0' || svcport == 0 || svcport >= IPPORT_MAX) usage(); + svcport_str = strdup(optarg); break; + case 'h': + ++nhosts; + hosts_bak = hosts; + hosts_bak = realloc(hosts, nhosts * sizeof(char *)); + if (hosts_bak == NULL) { + if (hosts != NULL) { + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } + } + hosts = hosts_bak; + hosts[nhosts - 1] = strdup(optarg); + if (hosts[nhosts - 1] == NULL) { + for (k = 0; k < (nhosts - 1); k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } + break; default: usage(); }; @@ -349,36 +369,8 @@ rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL); rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL); - udpsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - tcpsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - udpconf = getnetconfigent("udp"); - tcpconf = getnetconfigent("tcp"); - rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); - if (!have_v6) - goto skip_v6; - udp6sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); - tcp6sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); - /* - * We're doing host-based access checks here, so don't allow - * v4-in-v6 to confuse things. The kernel will disable it - * by default on NFS sockets too. - */ - if (udp6sock != -1 && setsockopt(udp6sock, IPPROTO_IPV6, - IPV6_V6ONLY, &one, sizeof one) < 0) { - syslog(LOG_ERR, "can't disable v4-in-v6 on UDP socket"); - exit(1); - } - if (tcp6sock != -1 && setsockopt(tcp6sock, IPPROTO_IPV6, - IPV6_V6ONLY, &one, sizeof one) < 0) { - syslog(LOG_ERR, "can't disable v4-in-v6 on TCP socket"); - exit(1); - } - udp6conf = getnetconfigent("udp6"); - tcp6conf = getnetconfigent("tcp6"); - -skip_v6: if (!resvport_only) { if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL, &resvport_only, sizeof(resvport_only)) != 0 && @@ -387,129 +379,60 @@ exit(1); } } - if (svcport != 0) { - bzero(&sin, sizeof(struct sockaddr_in)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_family = AF_INET; - sin.sin_port = htons(svcport); - bzero(&sin6, sizeof(struct sockaddr_in6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_family = AF_INET6; - sin6.sin6_port = htons(svcport); - } - if (udpsock != -1 && udpconf != NULL) { - if (svcport != 0) { - r = bindresvport(udpsock, &sin); - if (r != 0) { - syslog(LOG_ERR, "bindresvport: %m"); - exit(1); + /* + * If no hosts were specified, add a wildcard entry to bind to + * INADDR_ANY. Otherwise make sure 127.0.0.1 and ::1 are added to the + * list. + */ + if (nhosts == 0) { + hosts = malloc(sizeof(char**)); + if (hosts == NULL) + out_of_mem(); + hosts[0] = "*"; + nhosts = 1; + } else { + hosts_bak = hosts; + if (have_v6) { + hosts_bak = realloc(hosts, (nhosts + 2) * + sizeof(char *)); + if (hosts_bak == NULL) { + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } else + hosts = hosts_bak; + nhosts += 2; + hosts[nhosts - 2] = "::1"; + } else { + hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); + if (hosts_bak == NULL) { + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } else { + nhosts += 1; + hosts = hosts_bak; } - } else - (void)bindresvport(udpsock, NULL); - udptransp = svc_dg_create(udpsock, 0, 0); - if (udptransp != NULL) { - if (!svc_reg(udptransp, RPCPROG_MNT, RPCMNT_VER1, - mntsrv, udpconf)) - syslog(LOG_WARNING, "can't register UDP RPCMNT_VER1 service"); - else - xcreated++; - if (!force_v2) { - if (!svc_reg(udptransp, RPCPROG_MNT, RPCMNT_VER3, - mntsrv, udpconf)) - syslog(LOG_WARNING, "can't register UDP RPCMNT_VER3 service"); - else - xcreated++; - } - } else - syslog(LOG_WARNING, "can't create UDP services"); + } + hosts[nhosts - 1] = "127.0.0.1"; } - if (tcpsock != -1 && tcpconf != NULL) { - if (svcport != 0) { - r = bindresvport(tcpsock, &sin); - if (r != 0) { - syslog(LOG_ERR, "bindresvport: %m"); - exit(1); - } - } else - (void)bindresvport(tcpsock, NULL); - listen(tcpsock, SOMAXCONN); - tcptransp = svc_vc_create(tcpsock, RPC_MAXDATASIZE, RPC_MAXDATASIZE); - if (tcptransp != NULL) { - if (!svc_reg(tcptransp, RPCPROG_MNT, RPCMNT_VER1, - mntsrv, tcpconf)) - syslog(LOG_WARNING, "can't register TCP RPCMNT_VER1 service"); - else - xcreated++; - if (!force_v2) { - if (!svc_reg(tcptransp, RPCPROG_MNT, RPCMNT_VER3, - mntsrv, tcpconf)) - syslog(LOG_WARNING, "can't register TCP RPCMNT_VER3 service"); - else - xcreated++; - } - } else - syslog(LOG_WARNING, "can't create TCP service"); + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + if (nconf->nc_flag & NC_VISIBLE) { + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, + "inet6") == 0) { + /* DO NOTHING */ + } else + create_service(nconf); + } } - if (have_v6 && udp6sock != -1 && udp6conf != NULL) { - if (svcport != 0) { - r = bindresvport_sa(udp6sock, - (struct sockaddr *)&sin6); - if (r != 0) { - syslog(LOG_ERR, "bindresvport_sa: %m"); - exit(1); - } - } else - (void)bindresvport_sa(udp6sock, NULL); - udp6transp = svc_dg_create(udp6sock, 0, 0); - if (udp6transp != NULL) { - if (!svc_reg(udp6transp, RPCPROG_MNT, RPCMNT_VER1, - mntsrv, udp6conf)) - syslog(LOG_WARNING, "can't register UDP6 RPCMNT_VER1 service"); - else - xcreated++; - if (!force_v2) { - if (!svc_reg(udp6transp, RPCPROG_MNT, RPCMNT_VER3, - mntsrv, udp6conf)) - syslog(LOG_WARNING, "can't register UDP6 RPCMNT_VER3 service"); - else - xcreated++; - } - } else - syslog(LOG_WARNING, "can't create UDP6 service"); + endnetconfig(nc_handle); - } - if (have_v6 && tcp6sock != -1 && tcp6conf != NULL) { - if (svcport != 0) { - r = bindresvport_sa(tcp6sock, - (struct sockaddr *)&sin6); - if (r != 0) { - syslog(LOG_ERR, "bindresvport_sa: %m"); - exit(1); - } - } else - (void)bindresvport_sa(tcp6sock, NULL); - listen(tcp6sock, SOMAXCONN); - tcp6transp = svc_vc_create(tcp6sock, RPC_MAXDATASIZE, RPC_MAXDATASIZE); - if (tcp6transp != NULL) { >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808262138.m7QLcSOW025490>