Date: Mon, 21 Oct 2013 09:03:31 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r256837 - in projects/camlock: . bin/sh contrib/binutils/gas/config contrib/jemalloc contrib/jemalloc/doc contrib/jemalloc/include/jemalloc contrib/jemalloc/include/jemalloc/internal co... Message-ID: <201310210903.r9L93VVa061530@svn.freebsd.org>
index | next in thread | raw e-mail
Author: mav Date: Mon Oct 21 09:03:30 2013 New Revision: 256837 URL: http://svnweb.freebsd.org/changeset/base/256837 Log: MFC @ r256836 Added: projects/camlock/share/man/man4/altera_atse.4 - copied unchanged from r256836, head/share/man/man4/altera_atse.4 projects/camlock/sys/arm/conf/IMX53-QSB - copied unchanged from r256836, head/sys/arm/conf/IMX53-QSB projects/camlock/sys/boot/fdt/dts/imx53-qsb.dts - copied unchanged from r256836, head/sys/boot/fdt/dts/imx53-qsb.dts projects/camlock/sys/dev/altera/atse/ - copied from r256836, head/sys/dev/altera/atse/ projects/camlock/sys/dev/ffec/ - copied from r256836, head/sys/dev/ffec/ projects/camlock/sys/powerpc/powerpc/clock.c - copied unchanged from r256836, head/sys/powerpc/powerpc/clock.c projects/camlock/sys/powerpc/powerpc/nexus.c - copied unchanged from r256836, head/sys/powerpc/powerpc/nexus.c projects/camlock/sys/powerpc/powerpc/vm_machdep.c - copied unchanged from r256836, head/sys/powerpc/powerpc/vm_machdep.c projects/camlock/sys/powerpc/pseries/phyp_llan.c - copied unchanged from r256836, head/sys/powerpc/pseries/phyp_llan.c Deleted: projects/camlock/sys/powerpc/aim/clock.c projects/camlock/sys/powerpc/aim/nexus.c projects/camlock/sys/powerpc/aim/vm_machdep.c projects/camlock/sys/powerpc/booke/clock.c projects/camlock/sys/powerpc/booke/vm_machdep.c projects/camlock/sys/powerpc/mpc85xx/nexus.c Modified: projects/camlock/ObsoleteFiles.inc projects/camlock/bin/sh/jobs.c projects/camlock/contrib/binutils/gas/config/tc-arm.c projects/camlock/contrib/jemalloc/ChangeLog projects/camlock/contrib/jemalloc/FREEBSD-diffs projects/camlock/contrib/jemalloc/FREEBSD-upgrade projects/camlock/contrib/jemalloc/VERSION projects/camlock/contrib/jemalloc/doc/jemalloc.3 projects/camlock/contrib/jemalloc/include/jemalloc/internal/arena.h projects/camlock/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h projects/camlock/contrib/jemalloc/include/jemalloc/internal/private_namespace.h projects/camlock/contrib/jemalloc/include/jemalloc/internal/tcache.h projects/camlock/contrib/jemalloc/include/jemalloc/jemalloc.h projects/camlock/contrib/jemalloc/src/arena.c projects/camlock/contrib/jemalloc/src/chunk.c projects/camlock/contrib/jemalloc/src/ctl.c projects/camlock/contrib/jemalloc/src/jemalloc.c projects/camlock/etc/defaults/rc.conf projects/camlock/etc/mtree/BSD.usr.dist projects/camlock/etc/rc projects/camlock/etc/rc.d/jail projects/camlock/etc/rc.d/sendmail projects/camlock/etc/sendmail/freebsd.mc projects/camlock/lib/libc/gen/popen.c projects/camlock/lib/libc/gen/syslog.c projects/camlock/lib/libc/iconv/citrus_mapper.c projects/camlock/lib/libcrypt/tests/Makefile projects/camlock/sbin/ifconfig/ifconfig.8 projects/camlock/sbin/ifconfig/ifgroup.c projects/camlock/sbin/route/route.c projects/camlock/share/man/man4/Makefile projects/camlock/share/man/man5/rc.conf.5 projects/camlock/share/man/man8/rc.8 projects/camlock/share/man/man8/rc.sendmail.8 projects/camlock/share/mk/atf.test.mk projects/camlock/share/mk/bsd.test.mk projects/camlock/sys/arm/arm/cpufunc_asm_armv7.S projects/camlock/sys/arm/arm/fusu.S projects/camlock/sys/arm/arm/pmap-v6.c projects/camlock/sys/arm/freescale/imx/files.imx53 projects/camlock/sys/arm/freescale/imx/imx51_ccm.c projects/camlock/sys/arm/include/pmap.h projects/camlock/sys/arm/mv/common.c projects/camlock/sys/arm/mv/mvreg.h projects/camlock/sys/arm/xscale/i80321/ep80219_machdep.c projects/camlock/sys/arm/xscale/i80321/iq31244_machdep.c projects/camlock/sys/arm/xscale/i8134x/crb_machdep.c projects/camlock/sys/arm/xscale/ixp425/avila_machdep.c projects/camlock/sys/arm/xscale/pxa/pxa_machdep.c projects/camlock/sys/boot/fdt/dts/digi-ccwmx53.dts projects/camlock/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c projects/camlock/sys/cddl/dev/dtrace/amd64/dtrace_isa.c projects/camlock/sys/conf/files projects/camlock/sys/conf/files.powerpc projects/camlock/sys/conf/options projects/camlock/sys/contrib/dev/run/rt2870.fw.uu projects/camlock/sys/dev/altera/sdcard/altera_sdcard.c projects/camlock/sys/dev/altera/sdcard/altera_sdcard_io.c projects/camlock/sys/dev/cfi/cfi_core.c projects/camlock/sys/dev/cxgbe/iw_cxgbe/device.c projects/camlock/sys/dev/drm2/radeon/radeon_drv.c projects/camlock/sys/dev/fdt/fdtbus.c projects/camlock/sys/dev/ofw/ofw_bus_subr.c projects/camlock/sys/dev/re/if_re.c projects/camlock/sys/dev/uart/uart_dev_pl011.c projects/camlock/sys/dev/usb/controller/xhci.c projects/camlock/sys/dev/usb/serial/uslcom.c projects/camlock/sys/dev/usb/usbdevs projects/camlock/sys/dev/usb/wlan/if_run.c projects/camlock/sys/dev/usb/wlan/if_runreg.h projects/camlock/sys/geom/geom_slice.c projects/camlock/sys/geom/label/g_label.c projects/camlock/sys/kern/subr_taskqueue.c projects/camlock/sys/mips/beri/beri_machdep.c projects/camlock/sys/mips/beri/files.beri projects/camlock/sys/modules/Makefile projects/camlock/sys/modules/cxgb/Makefile projects/camlock/sys/modules/cxgbe/Makefile projects/camlock/sys/net/if_media.h projects/camlock/sys/netinet/in.h projects/camlock/sys/pci/if_rlreg.h projects/camlock/sys/powerpc/aim/machdep.c projects/camlock/sys/powerpc/booke/machdep.c projects/camlock/sys/powerpc/conf/GENERIC64 projects/camlock/sys/powerpc/ofw/ofw_pci.c projects/camlock/sys/powerpc/ofw/ofw_pcib_pci.c projects/camlock/sys/powerpc/ofw/ofw_pcibus.c projects/camlock/sys/powerpc/pseries/phyp-hvcall.S projects/camlock/sys/sys/_task.h projects/camlock/sys/sys/param.h projects/camlock/sys/sys/taskqueue.h projects/camlock/sys/ufs/ffs/ffs_extern.h projects/camlock/sys/ufs/ffs/ffs_softdep.c projects/camlock/sys/ufs/ffs/ffs_vfsops.c projects/camlock/sys/ufs/ffs/softdep.h projects/camlock/sys/ufs/ufs/ufs_extern.h projects/camlock/sys/ufs/ufs/ufsmount.h projects/camlock/sys/xen/xen-os.h projects/camlock/tools/build/mk/OptionalObsoleteFiles.inc projects/camlock/usr.bin/pathchk/pathchk.c projects/camlock/usr.sbin/bhyve/bhyverun.c projects/camlock/usr.sbin/bhyve/bhyverun.h projects/camlock/usr.sbin/bhyve/mptbl.c projects/camlock/usr.sbin/bhyve/pci_ahci.c projects/camlock/usr.sbin/bhyve/pci_hostbridge.c projects/camlock/usr.sbin/bhyve/pci_virtio_block.c projects/camlock/usr.sbin/bhyve/pci_virtio_net.c projects/camlock/usr.sbin/bhyve/rtc.c projects/camlock/usr.sbin/freebsd-update/freebsd-update.sh projects/camlock/usr.sbin/pkg/pkg.c Directory Properties: projects/camlock/ (props changed) projects/camlock/contrib/binutils/ (props changed) projects/camlock/lib/libc/ (props changed) projects/camlock/sbin/ (props changed) projects/camlock/share/man/man4/ (props changed) projects/camlock/sys/ (props changed) projects/camlock/sys/boot/ (props changed) projects/camlock/sys/cddl/contrib/opensolaris/ (props changed) projects/camlock/sys/conf/ (props changed) projects/camlock/usr.sbin/bhyve/ (props changed) Modified: projects/camlock/ObsoleteFiles.inc ============================================================================== --- projects/camlock/ObsoleteFiles.inc Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/ObsoleteFiles.inc Mon Oct 21 09:03:30 2013 (r256837) @@ -97,7 +97,7 @@ OLD_FILES+=usr/include/lwres/result.h OLD_FILES+=usr/include/lwres/version.h OLD_FILES+=usr/lib/liblwres.a OLD_FILES+=usr/lib/liblwres.so -OLD_LIBS+=usr/lib/liblwres.so.50 +OLD_LIBS+=usr/lib/liblwres.so.90 OLD_FILES+=usr/lib/liblwres_p.a OLD_FILES+=usr/sbin/arpaname OLD_FILES+=usr/sbin/ddns-confgen @@ -107,6 +107,7 @@ OLD_FILES+=usr/sbin/dnssec-keygen OLD_FILES+=usr/sbin/dnssec-revoke OLD_FILES+=usr/sbin/dnssec-settime OLD_FILES+=usr/sbin/dnssec-signzone +OLD_FILES+=usr/sbin/dnssec-verify OLD_FILES+=usr/sbin/genrandom OLD_FILES+=usr/sbin/isc-hmac-fixup OLD_FILES+=usr/sbin/lwresd @@ -270,6 +271,7 @@ OLD_FILES+=usr/share/man/man8/dnssec-key OLD_FILES+=usr/share/man/man8/dnssec-revoke.8.gz OLD_FILES+=usr/share/man/man8/dnssec-settime.8.gz OLD_FILES+=usr/share/man/man8/dnssec-signzone.8.gz +OLD_FILES+=usr/share/man/man8/dnssec-verify.8.gz OLD_FILES+=usr/share/man/man8/genrandom.8.gz OLD_FILES+=usr/share/man/man8/isc-hmac-fixup.8.gz OLD_FILES+=usr/share/man/man8/lwresd.8.gz @@ -304,6 +306,8 @@ OLD_DIRS+=var/named/var/run OLD_DIRS+=var/named/var/run/named OLD_DIRS+=var/named/var/stats OLD_DIRS+=var/run/named +# 20130923: example moved +OLD_FILES+=usr/share/examples/bsdconfig/browse_packages.sh # 20130908: libssh becomes private OLD_FILES+=usr/lib/libssh.a OLD_FILES+=usr/lib/libssh.so Modified: projects/camlock/bin/sh/jobs.c ============================================================================== --- projects/camlock/bin/sh/jobs.c Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/bin/sh/jobs.c Mon Oct 21 09:03:30 2013 (r256837) @@ -978,7 +978,6 @@ int waitforjob(struct job *jp, int *origstatus) { #if JOBS - pid_t mypgrp = getpgrp(); int propagate_int = jp->jobctl && jp->foreground; #endif int status; @@ -992,7 +991,7 @@ waitforjob(struct job *jp, int *origstat dotrap(); #if JOBS if (jp->jobctl) { - if (tcsetpgrp(ttyfd, mypgrp) < 0) + if (tcsetpgrp(ttyfd, rootpid) < 0) error("tcsetpgrp failed, errno=%d\n", errno); } if (jp->state == JOBSTOPPED) Modified: projects/camlock/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- projects/camlock/contrib/binutils/gas/config/tc-arm.c Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/binutils/gas/config/tc-arm.c Mon Oct 21 09:03:30 2013 (r256837) @@ -12660,14 +12660,14 @@ do_vfp_nsyn_cvt (enum neon_shape rs, int /* Conversions without bitshift. */ const char *enc[] = { - "ftosis", - "ftouis", + "ftosizs", + "ftouizs", "fsitos", "fuitos", "fcvtsd", "fcvtds", - "ftosid", - "ftouid", + "ftosizd", + "ftouizd", "fsitod", "fuitod" }; Modified: projects/camlock/contrib/jemalloc/ChangeLog ============================================================================== --- projects/camlock/contrib/jemalloc/ChangeLog Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/ChangeLog Mon Oct 21 09:03:30 2013 (r256837) @@ -6,6 +6,21 @@ found in the git revision history: http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git git://canonware.com/jemalloc.git +* 3.4.1 (October 20, 2013) + + Bug fixes: + - Fix a race in the "arenas.extend" mallctl that could cause memory corruption + of internal data structures and subsequent crashes. + - Fix Valgrind integration flaws that caused Valgrind warnings about reads of + uninitialized memory in: + + arena chunk headers + + internal zero-initialized data structures (relevant to tcache and prof + code) + - Preserve errno during the first allocation. A readlink(2) call during + initialization fails unless /etc/malloc.conf exists, so errno was typically + set during the first allocation prior to this fix. + - Fix compilation warnings reported by gcc 4.8.1. + * 3.4.0 (June 2, 2013) This version is essentially a small bugfix release, but the addition of @@ -60,7 +75,7 @@ found in the git revision history: Bug fixes: - Fix "arenas.extend" mallctl to output the number of arenas. - - Fix chunk_recycyle() to unconditionally inform Valgrind that returned memory + - Fix chunk_recycle() to unconditionally inform Valgrind that returned memory is undefined. - Fix build break on FreeBSD related to alloca.h. Modified: projects/camlock/contrib/jemalloc/FREEBSD-diffs ============================================================================== --- projects/camlock/contrib/jemalloc/FREEBSD-diffs Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/FREEBSD-diffs Mon Oct 21 09:03:30 2013 (r256837) @@ -45,7 +45,7 @@ index abd5e6f..1d7491a 100644 + </refsect1> </refentry> diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in -index e46ac54..527449d 100644 +index 53c135c..c547339 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -1,5 +1,8 @@ @@ -97,10 +97,10 @@ index de44e14..564d604 100644 bool malloc_mutex_init(malloc_mutex_t *mutex); diff --git a/include/jemalloc/internal/private_namespace.h b/include/jemalloc/internal/private_namespace.h -index 65de316..366676b 100644 +index cdb0b0e..2a98d1f 100644 --- a/include/jemalloc/internal/private_namespace.h +++ b/include/jemalloc/internal/private_namespace.h -@@ -216,7 +216,6 @@ +@@ -218,7 +218,6 @@ #define iralloc JEMALLOC_N(iralloc) #define irallocx JEMALLOC_N(irallocx) #define isalloc JEMALLOC_N(isalloc) @@ -244,7 +244,7 @@ index 0000000..e6c8407 +#endif + diff --git a/src/jemalloc.c b/src/jemalloc.c -index bc350ed..352c98e 100644 +index ae56db6..1412a5e 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -8,6 +8,10 @@ malloc_tsd_data(, arenas, arena_t *, NULL) Modified: projects/camlock/contrib/jemalloc/FREEBSD-upgrade ============================================================================== --- projects/camlock/contrib/jemalloc/FREEBSD-upgrade Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/FREEBSD-upgrade Mon Oct 21 09:03:30 2013 (r256837) @@ -60,7 +60,7 @@ do_extract() { local rev=$1 # Clone. rm -rf ${work} - git clone git://canonware.com/jemalloc.git ${work} + git clone https://github.com/jemalloc/jemalloc.git ${work} ( cd ${work} if [ "x${rev}" != "x" ] ; then Modified: projects/camlock/contrib/jemalloc/VERSION ============================================================================== --- projects/camlock/contrib/jemalloc/VERSION Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/VERSION Mon Oct 21 09:03:30 2013 (r256837) @@ -1 +1 @@ -3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775 +3.4.1-0-g0135fb806e4137dc9cdf152541926a2bc95e33f0 Modified: projects/camlock/contrib/jemalloc/doc/jemalloc.3 ============================================================================== --- projects/camlock/contrib/jemalloc/doc/jemalloc.3 Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/doc/jemalloc.3 Mon Oct 21 09:03:30 2013 (r256837) @@ -2,12 +2,12 @@ .\" Title: JEMALLOC .\" Author: Jason Evans .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/> -.\" Date: 06/02/2013 +.\" Date: 10/20/2013 .\" Manual: User Manual -.\" Source: jemalloc 3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775 +.\" Source: jemalloc 3.4.1-0-g0135fb806e4137dc9cdf152541926a2bc95e33f0 .\" Language: English .\" -.TH "JEMALLOC" "3" "06/02/2013" "jemalloc 3.4.0-0-g0ed518e5dab7" "User Manual" +.TH "JEMALLOC" "3" "10/20/2013" "jemalloc 3.4.1-0-g0135fb806e41" "User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,7 +31,7 @@ jemalloc \- general purpose memory allocation functions .SH "LIBRARY" .PP -This manual describes jemalloc 3\&.4\&.0\-0\-g0ed518e5dab789ad2171bb38977a8927e2a26775\&. More information can be found at the +This manual describes jemalloc 3\&.4\&.1\-0\-g0135fb806e4137dc9cdf152541926a2bc95e33f0\&. More information can be found at the \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The following configuration options are enabled in libc\*(Aqs built\-in jemalloc: Modified: projects/camlock/contrib/jemalloc/include/jemalloc/internal/arena.h ============================================================================== --- projects/camlock/contrib/jemalloc/include/jemalloc/internal/arena.h Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/include/jemalloc/internal/arena.h Mon Oct 21 09:03:30 2013 (r256837) @@ -441,6 +441,7 @@ void arena_postfork_child(arena_t *arena #ifndef JEMALLOC_ENABLE_INLINE arena_chunk_map_t *arena_mapp_get(arena_chunk_t *chunk, size_t pageind); size_t *arena_mapbitsp_get(arena_chunk_t *chunk, size_t pageind); +size_t arena_mapbitsp_read(size_t *mapbitsp); size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_unallocated_size_get(arena_chunk_t *chunk, size_t pageind); @@ -451,6 +452,7 @@ size_t arena_mapbits_dirty_get(arena_chu size_t arena_mapbits_unzeroed_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_large_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_allocated_get(arena_chunk_t *chunk, size_t pageind); +void arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits); void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags); void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind, @@ -498,10 +500,17 @@ arena_mapbitsp_get(arena_chunk_t *chunk, } JEMALLOC_ALWAYS_INLINE size_t +arena_mapbitsp_read(size_t *mapbitsp) +{ + + return (*mapbitsp); +} + +JEMALLOC_ALWAYS_INLINE size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind) { - return (*arena_mapbitsp_get(chunk, pageind)); + return (arena_mapbitsp_read(arena_mapbitsp_get(chunk, pageind))); } JEMALLOC_ALWAYS_INLINE size_t @@ -585,82 +594,89 @@ arena_mapbits_allocated_get(arena_chunk_ } JEMALLOC_ALWAYS_INLINE void +arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits) +{ + + *mapbitsp = mapbits; +} + +JEMALLOC_ALWAYS_INLINE void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); assert((flags & ~CHUNK_MAP_FLAGS_MASK) == 0); assert((flags & (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == flags); - *mapbitsp = size | CHUNK_MAP_BININD_INVALID | flags; + arena_mapbitsp_write(mapbitsp, size | CHUNK_MAP_BININD_INVALID | flags); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind, size_t size) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); - assert((*mapbitsp & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0); - *mapbitsp = size | (*mapbitsp & PAGE_MASK); + assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0); + arena_mapbitsp_write(mapbitsp, size | (mapbits & PAGE_MASK)); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_large_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); size_t unzeroed; - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); assert((flags & CHUNK_MAP_DIRTY) == flags); - unzeroed = *mapbitsp & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ - *mapbitsp = size | CHUNK_MAP_BININD_INVALID | flags | unzeroed | - CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED; + unzeroed = mapbits & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ + arena_mapbitsp_write(mapbitsp, size | CHUNK_MAP_BININD_INVALID | flags + | unzeroed | CHUNK_MAP_LARGE | CHUNK_MAP_ALLOCATED); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_large_binind_set(arena_chunk_t *chunk, size_t pageind, size_t binind) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); assert(binind <= BININD_INVALID); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert(arena_mapbits_large_size_get(chunk, pageind) == PAGE); - *mapbitsp = (*mapbitsp & ~CHUNK_MAP_BININD_MASK) | (binind << - CHUNK_MAP_BININD_SHIFT); + arena_mapbitsp_write(mapbitsp, (mapbits & ~CHUNK_MAP_BININD_MASK) | + (binind << CHUNK_MAP_BININD_SHIFT)); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_small_set(arena_chunk_t *chunk, size_t pageind, size_t runind, size_t binind, size_t flags) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); size_t unzeroed; assert(binind < BININD_INVALID); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert(pageind - runind >= map_bias); assert((flags & CHUNK_MAP_DIRTY) == flags); - unzeroed = *mapbitsp & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ - *mapbitsp = (runind << LG_PAGE) | (binind << CHUNK_MAP_BININD_SHIFT) | - flags | unzeroed | CHUNK_MAP_ALLOCATED; + unzeroed = mapbits & CHUNK_MAP_UNZEROED; /* Preserve unzeroed. */ + arena_mapbitsp_write(mapbitsp, (runind << LG_PAGE) | (binind << + CHUNK_MAP_BININD_SHIFT) | flags | unzeroed | CHUNK_MAP_ALLOCATED); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_unzeroed_set(arena_chunk_t *chunk, size_t pageind, size_t unzeroed) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); - mapbitsp = arena_mapbitsp_get(chunk, pageind); - *mapbitsp = (*mapbitsp & ~CHUNK_MAP_UNZEROED) | unzeroed; + arena_mapbitsp_write(mapbitsp, (mapbits & ~CHUNK_MAP_UNZEROED) | + unzeroed); } JEMALLOC_INLINE bool Modified: projects/camlock/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h ============================================================================== --- projects/camlock/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h Mon Oct 21 09:03:30 2013 (r256837) @@ -232,9 +232,18 @@ static const bool config_ivsalloc = # define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) #endif +/* + * JEMALLOC_ALWAYS_INLINE is used within header files for functions that are + * static inline functions if inlining is enabled, and single-definition + * library-private functions if inlining is disabled. + * + * JEMALLOC_ALWAYS_INLINE_C is for use in .c files, in which case the denoted + * functions are always static, regardless of whether inlining is enabled. + */ #ifdef JEMALLOC_DEBUG /* Disable inlining to make debugging easier. */ # define JEMALLOC_ALWAYS_INLINE +# define JEMALLOC_ALWAYS_INLINE_C static # define JEMALLOC_INLINE # define inline #else @@ -242,8 +251,11 @@ static const bool config_ivsalloc = # ifdef JEMALLOC_HAVE_ATTR # define JEMALLOC_ALWAYS_INLINE \ static inline JEMALLOC_ATTR(unused) JEMALLOC_ATTR(always_inline) +# define JEMALLOC_ALWAYS_INLINE_C \ + static inline JEMALLOC_ATTR(always_inline) # else # define JEMALLOC_ALWAYS_INLINE static inline +# define JEMALLOC_ALWAYS_INLINE_C static inline # endif # define JEMALLOC_INLINE static inline # ifdef _MSC_VER Modified: projects/camlock/contrib/jemalloc/include/jemalloc/internal/private_namespace.h ============================================================================== --- projects/camlock/contrib/jemalloc/include/jemalloc/internal/private_namespace.h Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/include/jemalloc/internal/private_namespace.h Mon Oct 21 09:03:30 2013 (r256837) @@ -33,6 +33,8 @@ #define arena_mapbits_unzeroed_get JEMALLOC_N(arena_mapbits_unzeroed_get) #define arena_mapbits_unzeroed_set JEMALLOC_N(arena_mapbits_unzeroed_set) #define arena_mapbitsp_get JEMALLOC_N(arena_mapbitsp_get) +#define arena_mapbitsp_read JEMALLOC_N(arena_mapbitsp_read) +#define arena_mapbitsp_write JEMALLOC_N(arena_mapbitsp_write) #define arena_mapp_get JEMALLOC_N(arena_mapp_get) #define arena_maxclass JEMALLOC_N(arena_maxclass) #define arena_new JEMALLOC_N(arena_new) Modified: projects/camlock/contrib/jemalloc/include/jemalloc/internal/tcache.h ============================================================================== --- projects/camlock/contrib/jemalloc/include/jemalloc/internal/tcache.h Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/include/jemalloc/internal/tcache.h Mon Oct 21 09:03:30 2013 (r256837) @@ -313,6 +313,7 @@ tcache_alloc_small(tcache_t *tcache, siz } else if (opt_zero) memset(ret, 0, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } else { if (config_fill && opt_junk) { arena_alloc_junk_small(ret, &arena_bin_info[binind], @@ -321,7 +322,6 @@ tcache_alloc_small(tcache_t *tcache, siz VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); } - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); if (config_stats) tbin->tstats.nrequests++; @@ -368,11 +368,11 @@ tcache_alloc_large(tcache_t *tcache, siz else if (opt_zero) memset(ret, 0, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } else { VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); } - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); if (config_stats) tbin->tstats.nrequests++; Modified: projects/camlock/contrib/jemalloc/include/jemalloc/jemalloc.h ============================================================================== --- projects/camlock/contrib/jemalloc/include/jemalloc/jemalloc.h Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/include/jemalloc/jemalloc.h Mon Oct 21 09:03:30 2013 (r256837) @@ -7,12 +7,12 @@ extern "C" { #include <limits.h> #include <strings.h> -#define JEMALLOC_VERSION "3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775" +#define JEMALLOC_VERSION "3.4.1-0-g0135fb806e4137dc9cdf152541926a2bc95e33f0" #define JEMALLOC_VERSION_MAJOR 3 #define JEMALLOC_VERSION_MINOR 4 -#define JEMALLOC_VERSION_BUGFIX 0 +#define JEMALLOC_VERSION_BUGFIX 1 #define JEMALLOC_VERSION_NREV 0 -#define JEMALLOC_VERSION_GID "0ed518e5dab789ad2171bb38977a8927e2a26775" +#define JEMALLOC_VERSION_GID "0135fb806e4137dc9cdf152541926a2bc95e33f0" #include "jemalloc_defs.h" #include "jemalloc_FreeBSD.h" Modified: projects/camlock/contrib/jemalloc/src/arena.c ============================================================================== --- projects/camlock/contrib/jemalloc/src/arena.c Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/src/arena.c Mon Oct 21 09:03:30 2013 (r256837) @@ -369,13 +369,20 @@ arena_run_zero(arena_chunk_t *chunk, siz } static inline void +arena_run_page_mark_zeroed(arena_chunk_t *chunk, size_t run_ind) +{ + + VALGRIND_MAKE_MEM_DEFINED((void *)((uintptr_t)chunk + (run_ind << + LG_PAGE)), PAGE); +} + +static inline void arena_run_page_validate_zeroed(arena_chunk_t *chunk, size_t run_ind) { size_t i; UNUSED size_t *p = (size_t *)((uintptr_t)chunk + (run_ind << LG_PAGE)); - VALGRIND_MAKE_MEM_DEFINED((void *)((uintptr_t)chunk + (run_ind << - LG_PAGE)), PAGE); + arena_run_page_mark_zeroed(chunk, run_ind); for (i = 0; i < PAGE / sizeof(size_t); i++) assert(p[i] == 0); } @@ -458,6 +465,9 @@ arena_run_split(arena_t *arena, arena_ru } else if (config_debug) { arena_run_page_validate_zeroed( chunk, run_ind+i); + } else { + arena_run_page_mark_zeroed( + chunk, run_ind+i); } } } else { @@ -467,6 +477,9 @@ arena_run_split(arena_t *arena, arena_ru */ arena_run_zero(chunk, run_ind, need_pages); } + } else { + VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + + (run_ind << LG_PAGE)), (need_pages << LG_PAGE)); } /* @@ -508,9 +521,9 @@ arena_run_split(arena_t *arena, arena_ru arena_run_page_validate_zeroed(chunk, run_ind+need_pages-1); } + VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + + (run_ind << LG_PAGE)), (need_pages << LG_PAGE)); } - VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk + (run_ind << - LG_PAGE)), (need_pages << LG_PAGE)); } static arena_chunk_t * @@ -569,17 +582,24 @@ arena_chunk_alloc(arena_t *arena) * unless the chunk is not zeroed. */ if (zero == false) { + VALGRIND_MAKE_MEM_UNDEFINED( + (void *)arena_mapp_get(chunk, map_bias+1), + (size_t)((uintptr_t) arena_mapp_get(chunk, + chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk, + map_bias+1))); for (i = map_bias+1; i < chunk_npages-1; i++) arena_mapbits_unzeroed_set(chunk, i, unzeroed); - } else if (config_debug) { + } else { VALGRIND_MAKE_MEM_DEFINED( (void *)arena_mapp_get(chunk, map_bias+1), - (void *)((uintptr_t) - arena_mapp_get(chunk, chunk_npages-1) - - (uintptr_t)arena_mapp_get(chunk, map_bias+1))); - for (i = map_bias+1; i < chunk_npages-1; i++) { - assert(arena_mapbits_unzeroed_get(chunk, i) == - unzeroed); + (size_t)((uintptr_t) arena_mapp_get(chunk, + chunk_npages-1) - (uintptr_t)arena_mapp_get(chunk, + map_bias+1))); + if (config_debug) { + for (i = map_bias+1; i < chunk_npages-1; i++) { + assert(arena_mapbits_unzeroed_get(chunk, + i) == unzeroed); + } } } arena_mapbits_unallocated_set(chunk, chunk_npages-1, @@ -1458,6 +1478,7 @@ arena_malloc_small(arena_t *arena, size_ } else if (opt_zero) memset(ret, 0, size); } + VALGRIND_MAKE_MEM_UNDEFINED(ret, size); } else { if (config_fill && opt_junk) { arena_alloc_junk_small(ret, &arena_bin_info[binind], @@ -1466,7 +1487,6 @@ arena_malloc_small(arena_t *arena, size_ VALGRIND_MAKE_MEM_UNDEFINED(ret, size); memset(ret, 0, size); } - VALGRIND_MAKE_MEM_UNDEFINED(ret, size); return (ret); } Modified: projects/camlock/contrib/jemalloc/src/chunk.c ============================================================================== --- projects/camlock/contrib/jemalloc/src/chunk.c Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/src/chunk.c Mon Oct 21 09:03:30 2013 (r256837) @@ -294,7 +294,7 @@ label_return: if (xnode != NULL) base_node_dealloc(xnode); if (xprev != NULL) - base_node_dealloc(prev); + base_node_dealloc(xprev); } void Modified: projects/camlock/contrib/jemalloc/src/ctl.c ============================================================================== --- projects/camlock/contrib/jemalloc/src/ctl.c Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/src/ctl.c Mon Oct 21 09:03:30 2013 (r256837) @@ -546,43 +546,30 @@ ctl_arena_refresh(arena_t *arena, unsign static bool ctl_grow(void) { - size_t astats_size; ctl_arena_stats_t *astats; arena_t **tarenas; - /* Extend arena stats and arenas arrays. */ - astats_size = (ctl_stats.narenas + 2) * sizeof(ctl_arena_stats_t); - if (ctl_stats.narenas == narenas_auto) { - /* ctl_stats.arenas and arenas came from base_alloc(). */ - astats = (ctl_arena_stats_t *)imalloc(astats_size); - if (astats == NULL) - return (true); - memcpy(astats, ctl_stats.arenas, (ctl_stats.narenas + 1) * - sizeof(ctl_arena_stats_t)); - - tarenas = (arena_t **)imalloc((ctl_stats.narenas + 1) * - sizeof(arena_t *)); - if (tarenas == NULL) { - idalloc(astats); - return (true); - } - memcpy(tarenas, arenas, ctl_stats.narenas * sizeof(arena_t *)); - } else { - astats = (ctl_arena_stats_t *)iralloc(ctl_stats.arenas, - astats_size, 0, 0, false, false); - if (astats == NULL) - return (true); - - tarenas = (arena_t **)iralloc(arenas, (ctl_stats.narenas + 1) * - sizeof(arena_t *), 0, 0, false, false); - if (tarenas == NULL) - return (true); + /* Allocate extended arena stats and arenas arrays. */ + astats = (ctl_arena_stats_t *)imalloc((ctl_stats.narenas + 2) * + sizeof(ctl_arena_stats_t)); + if (astats == NULL) + return (true); + tarenas = (arena_t **)imalloc((ctl_stats.narenas + 1) * + sizeof(arena_t *)); + if (tarenas == NULL) { + idalloc(astats); + return (true); } - /* Initialize the new astats and arenas elements. */ + + /* Initialize the new astats element. */ + memcpy(astats, ctl_stats.arenas, (ctl_stats.narenas + 1) * + sizeof(ctl_arena_stats_t)); memset(&astats[ctl_stats.narenas + 1], 0, sizeof(ctl_arena_stats_t)); - if (ctl_arena_init(&astats[ctl_stats.narenas + 1])) + if (ctl_arena_init(&astats[ctl_stats.narenas + 1])) { + idalloc(tarenas); + idalloc(astats); return (true); - tarenas[ctl_stats.narenas] = NULL; + } /* Swap merged stats to their new location. */ { ctl_arena_stats_t tstats; @@ -593,13 +580,34 @@ ctl_grow(void) memcpy(&astats[ctl_stats.narenas + 1], &tstats, sizeof(ctl_arena_stats_t)); } + /* Initialize the new arenas element. */ + tarenas[ctl_stats.narenas] = NULL; + { + arena_t **arenas_old = arenas; + /* + * Swap extended arenas array into place. Although ctl_mtx + * protects this function from other threads extending the + * array, it does not protect from other threads mutating it + * (i.e. initializing arenas and setting array elements to + * point to them). Therefore, array copying must happen under + * the protection of arenas_lock. + */ + malloc_mutex_lock(&arenas_lock); + arenas = tarenas; + memcpy(arenas, arenas_old, ctl_stats.narenas * + sizeof(arena_t *)); + narenas_total++; + arenas_extend(narenas_total - 1); + malloc_mutex_unlock(&arenas_lock); + /* + * Deallocate arenas_old only if it came from imalloc() (not + * base_alloc()). + */ + if (ctl_stats.narenas != narenas_auto) + idalloc(arenas_old); + } ctl_stats.arenas = astats; ctl_stats.narenas++; - malloc_mutex_lock(&arenas_lock); - arenas = tarenas; - narenas_total++; - arenas_extend(narenas_total - 1); - malloc_mutex_unlock(&arenas_lock); return (false); } @@ -1109,7 +1117,7 @@ epoch_ctl(const size_t *mib, size_t mibl void *newp, size_t newlen) { int ret; - uint64_t newval; + UNUSED uint64_t newval; malloc_mutex_lock(&ctl_mtx); WRITE(newval, uint64_t); Modified: projects/camlock/contrib/jemalloc/src/jemalloc.c ============================================================================== --- projects/camlock/contrib/jemalloc/src/jemalloc.c Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/contrib/jemalloc/src/jemalloc.c Mon Oct 21 09:03:30 2013 (r256837) @@ -286,7 +286,7 @@ arenas_cleanup(void *arg) malloc_mutex_unlock(&arenas_lock); } -static JEMALLOC_ATTR(always_inline) void +JEMALLOC_ALWAYS_INLINE_C void malloc_thread_init(void) { @@ -303,7 +303,7 @@ malloc_thread_init(void) quarantine_alloc_hook(); } -static JEMALLOC_ATTR(always_inline) bool +JEMALLOC_ALWAYS_INLINE_C bool malloc_init(void) { @@ -440,8 +440,9 @@ malloc_conf_init(void) } break; case 1: { + int linklen = 0; #ifndef _WIN32 - int linklen; + int saved_errno = errno; const char *linkname = # ifdef JEMALLOC_PREFIX "/etc/"JEMALLOC_PREFIX"malloc.conf" @@ -450,21 +451,20 @@ malloc_conf_init(void) # endif ; - if ((linklen = readlink(linkname, buf, - sizeof(buf) - 1)) != -1) { - /* - * Use the contents of the "/etc/malloc.conf" - * symbolic link's name. - */ - buf[linklen] = '\0'; - opts = buf; - } else -#endif - { + /* + * Try to use the contents of the "/etc/malloc.conf" + * symbolic link's name. + */ + linklen = readlink(linkname, buf, sizeof(buf) - 1); + if (linklen == -1) { /* No configuration specified. */ - buf[0] = '\0'; - opts = buf; + linklen = 0; + /* restore errno */ + set_errno(saved_errno); } +#endif + buf[linklen] = '\0'; + opts = buf; break; } case 2: { const char *envname = @@ -1407,7 +1407,7 @@ je_mallctlbymib(const size_t *mib, size_ */ #ifdef JEMALLOC_EXPERIMENTAL -static JEMALLOC_ATTR(always_inline) void * +JEMALLOC_ALWAYS_INLINE_C void * iallocm(size_t usize, size_t alignment, bool zero, bool try_tcache, arena_t *arena) { Modified: projects/camlock/etc/defaults/rc.conf ============================================================================== --- projects/camlock/etc/defaults/rc.conf Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/etc/defaults/rc.conf Mon Oct 21 09:03:30 2013 (r256837) @@ -573,6 +573,8 @@ sendmail_enable="NO" # Run the sendmail sendmail_pidfile="/var/run/sendmail.pid" # sendmail pid file sendmail_procname="/usr/sbin/sendmail" # sendmail process name sendmail_flags="-L sm-mta -bd -q30m" # Flags to sendmail (as a server) +sendmail_cert_create="YES" # Create a server certificate if none (YES/NO) +#sendmail_cert_cn="CN" # CN of the generate certificate sendmail_submit_enable="YES" # Start a localhost-only MTA for mail submission sendmail_submit_flags="-L sm-mta -bd -q30m -ODaemonPortOptions=Addr=localhost" # Flags for localhost-only MTA @@ -619,6 +621,9 @@ quotacheck_flags="-a" # Check all file s accounting_enable="NO" # Turn on process accounting (or NO). ibcs2_enable="NO" # Ibcs2 (SCO) emulation loaded at startup (or NO). ibcs2_loaders="coff" # List of additional Ibcs2 loaders (or NO). +firstboot_sentinel="/firstboot" # Scripts with "firstboot" keyword are run if + # this file exists. Should be on a R/W filesystem so + # the file can be deleted after the boot completes. # Emulation/compatibility services provided by /etc/rc.d/abi sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO). Modified: projects/camlock/etc/mtree/BSD.usr.dist ============================================================================== --- projects/camlock/etc/mtree/BSD.usr.dist Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/etc/mtree/BSD.usr.dist Mon Oct 21 09:03:30 2013 (r256837) @@ -169,12 +169,6 @@ .. atm .. - bind9 - arm - .. - misc - .. - .. legal intel_ipw .. Modified: projects/camlock/etc/rc ============================================================================== --- projects/camlock/etc/rc Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/etc/rc Mon Oct 21 09:03:30 2013 (r256837) @@ -82,10 +82,15 @@ if [ `/sbin/sysctl -n security.jail.jail fi fi +# If the firstboot sentinel doesn't exist, we want to skip firstboot scripts. +if ! [ -e ${firstboot_sentinel} ]; then + skip_firstboot="-s firstboot" +fi + # Do a first pass to get everything up to $early_late_divider so that # we can do a second pass that includes $local_startup directories # -files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null` +files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* 2>/dev/null` _rc_elem_done=' ' for _rc_elem in ${files}; do @@ -107,7 +112,13 @@ case ${local_startup} in *) find_local_scripts_new ;; esac -files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null` +# The firstboot sentinel might be on a newly mounted filesystem; look for it +# again and unset skip_firstboot if we find it. +if [ -e ${firstboot_sentinel} ]; then + skip_firstboot="" +fi + +files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 2>/dev/null` for _rc_elem in ${files}; do case "$_rc_elem_done" in *" $_rc_elem "*) continue ;; @@ -116,6 +127,15 @@ for _rc_elem in ${files}; do run_rc_script ${_rc_elem} ${_boot} done +# Remove the firstboot sentinel, and reboot if it was requested. +if [ -e ${firstboot_sentinel} ]; then + rm ${firstboot_sentinel} + if [ -e ${firstboot_sentinel}-reboot ]; then + rm ${firstboot_sentinel}-reboot + kill -INT 1 + fi +fi + echo '' date exit 0 Modified: projects/camlock/etc/rc.d/jail ============================================================================== --- projects/camlock/etc/rc.d/jail Mon Oct 21 08:57:27 2013 (r256836) +++ projects/camlock/etc/rc.d/jail Mon Oct 21 09:03:30 2013 (r256837) @@ -132,7 +132,9 @@ parse_options() # _confwarn=1 if [ -r "$jail_conf" -o -r "$_jconf" ]; then - warn "$_conf is created and used for jail $_j." + if ! checkyesno jail_parallel_start; then + warn "$_conf is created and used for jail $_j." + fi fi /usr/bin/install -m 0644 -o root -g wheel /dev/null $_conf || return 1 @@ -367,10 +369,10 @@ jail_handle_ips_option() # Append address to list of addresses for the jail command. case $_type in inet) - echo " ip4.addr += \"${_iface}|${_addr}${_mask}\";" + echo " ip4.addr += \"${_iface:+${_iface}|}${_addr}${_mask}\";" ;; inet6) - echo " ip6.addr += \"${_iface}|${_addr}${_mask}\";" + echo " ip6.addr += \"${_iface:+${_iface}|}${_addr}${_mask}\";" need_dad_wait=1 ;; esac @@ -418,7 +420,7 @@ jail_status() jail_start() { - local _j _jid _jn + local _j _jid _jn _jl if [ $# = 0 ]; then return @@ -426,47 +428,82 @@ jail_start() echo -n 'Starting jails:' case $1 in _ALL) - echo -n ' ' command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -c" - $jail_jls -nq | while read IN; do - _jn=$(echo $IN | tr " " "\n" | grep name=) - _jid=$(echo $IN | tr " " "\n" | grep jid=) - if $command $rc_flags $command_args ${_jn#name=}; then + _tmp=`mktemp -t jail` || exit 3 + if $command $rc_flags $command_args >> $_tmp 2>&1; then + $jail_jls -nq | while read IN; do + _jn=$(echo $IN | tr " " "\n" | grep ^name=) + _jid=$(echo $IN | tr " " "\n" | grep ^jid=) echo -n " ${_jn#name=}" echo "${_jid#jid=}" \ > /var/run/jail_${_jn#name=}.id - fi - done + done + else + tail -1 $_tmp + fi + rm -f $_tmp echo '.' return ;; esac - _tmp=`mktemp -t jail` || exit 3 - for _j in $@; do - _j=$(echo $_j | tr /. _) - parse_options $_j || continue - - eval rc_flags=\${jail_${_j}_flags:-$jail_flags} - eval command=\${jail_${_j}_program:-$jail_program} - if checkyesno jail_parallel_start; then - command_args="-i -f $_conf -c $_j &" - else + if checkyesno jail_parallel_start; then + # + # Start jails in parallel and then check jail id when + # jail_parallel_start is YES. + # + _jl= + for _j in $@; do + _j=$(echo $_j | tr /. _) + parse_options $_j || continue + + _jl="$_jl $_j" + eval rc_flags=\${jail_${_j}_flags:-$jail_flags} + eval command=\${jail_${_j}_program:-$jail_program} command_args="-i -f $_conf -c $_j" - fi - if $command $rc_flags $command_args \ - >> $_tmp 2>&1 </dev/null; then + $command $rc_flags $command_args \ + >/dev/null 2>&1 </dev/null & + done + sleep 1 + for _j in $_jl; do echo -n " ${_hostname:-${_j}}" - _jid=$($jail_jls -n -j $_j | tr " " "\n" | grep jid=) - echo "${_jid#jid=}" > /var/run/jail_${_j}.id - else - rm -f /var/run/jail_${_j}.id - echo " cannot start jail \"${_hostname:-${_j}}\": " - cat $_tmp - fi - rm -f $_tmp - done + if _jid=$($jail_jls -n -j $_j | tr " " "\n" | \ + grep ^jid=); then + echo "${_jid#jid=}" > /var/run/jail_${_j}.id + else + rm -f /var/run/jail_${_j}.id + echo " cannot start jail " \ + "\"${_hostname:-${_j}}\": " + fi + done + else + # + # Start jails one-by-one when jail_parallel_start is NO. + # + for _j in $@; do + _j=$(echo $_j | tr /. _) + parse_options $_j || continue + + eval rc_flags=\${jail_${_j}_flags:-$jail_flags} + eval command=\${jail_${_j}_program:-$jail_program} + command_args="-i -f $_conf -c $_j" + _tmp=`mktemp -t jail` || exit 3 + if $command $rc_flags $command_args \ + >> $_tmp 2>&1 </dev/null; then + echo -n " ${_hostname:-${_j}}" + _jid=$($jail_jls -n -j $_j | \ + tr " " "\n" | grep ^jid=) + echo "${_jid#jid=}" > /var/run/jail_${_j}.id + else + rm -f /var/run/jail_${_j}.id + echo " cannot start jail " \ + "\"${_hostname:-${_j}}\": " + cat $_tmp + fi + rm -f $_tmp + done + fi echo '.' } @@ -480,17 +517,21 @@ jail_stop() echo -n 'Stopping jails:' case $1 in _ALL) - echo -n ' ' command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -r" $jail_jls -nq | while read IN; do - _jn=$(echo $IN | tr " " "\n" | grep name=) + _jn=$(echo $IN | tr " " "\n" | grep ^name=) echo -n " ${_jn#name=}" - $command $rc_flags $command_args ${_jn#name=} - if ! $jail_jls -j ${_jn#name=} > /dev/null 2>&1; then + _tmp=`mktemp -t jail` || exit 3 + $command $rc_flags $command_args ${_jn#name=} \ + >> $_tmp 2>&1 + if $jail_jls -j ${_jn#name=} > /dev/null 2>&1; then + tail -1 $_tmp + else rm -f /var/run/jail_${_jn#name=}.id fi + rm -f $_tmp done echo '.' return @@ -504,10 +545,14 @@ jail_stop() fi eval command=\${jail_${_j}_program:-$jail_program} echo -n " ${_hostname:-${_j}}" - $command -q -f $_conf -r $_j - if ! $jail_jls -j $_j > /dev/null 2>&1; then + _tmp=`mktemp -t jail` || exit 3 + $command -q -f $_conf -r $_j >> $_tmp 2>&1 + if $jail_jls -j $_j > /dev/null 2>&1; then *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310210903.r9L93VVa061530>
