From owner-svn-src-projects@FreeBSD.ORG Fri Mar 1 00:16:02 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5DD296E4; Fri, 1 Mar 2013 00:16:02 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 31760A81; Fri, 1 Mar 2013 00:16:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r210G2Vm007646; Fri, 1 Mar 2013 00:16:02 GMT (envelope-from benno@svn.freebsd.org) Received: (from benno@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r210Fwc4007612; Fri, 1 Mar 2013 00:15:58 GMT (envelope-from benno@svn.freebsd.org) Message-Id: <201303010015.r210Fwc4007612@svn.freebsd.org> From: Benno Rice Date: Fri, 1 Mar 2013 00:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r247510 - in projects/uefi: . cddl/contrib/opensolaris/cmd/zdb contrib/binutils/gas/config contrib/openbsm/bin/auditdistd include lib/libc/stdio libexec/rtld-elf sbin/tunefs share/man/m... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Mar 2013 00:16:02 -0000 Author: benno Date: Fri Mar 1 00:15:58 2013 New Revision: 247510 URL: http://svnweb.freebsd.org/changeset/base/247510 Log: MFH Added: projects/uefi/lib/libc/stdio/open_memstream.3 - copied unchanged from r247509, head/lib/libc/stdio/open_memstream.3 projects/uefi/lib/libc/stdio/open_memstream.c - copied unchanged from r247509, head/lib/libc/stdio/open_memstream.c projects/uefi/lib/libc/stdio/open_wmemstream.c - copied unchanged from r247509, head/lib/libc/stdio/open_wmemstream.c projects/uefi/sys/arm/broadcom/bcm2835/bcm2835_dma.c - copied unchanged from r247509, head/sys/arm/broadcom/bcm2835/bcm2835_dma.c projects/uefi/sys/arm/broadcom/bcm2835/bcm2835_dma.h - copied unchanged from r247509, head/sys/arm/broadcom/bcm2835/bcm2835_dma.h projects/uefi/tools/regression/lib/libc/stdio/test-open_memstream.c - copied unchanged from r247509, head/tools/regression/lib/libc/stdio/test-open_memstream.c projects/uefi/tools/regression/lib/libc/stdio/test-open_memstream.t - copied unchanged from r247509, head/tools/regression/lib/libc/stdio/test-open_memstream.t projects/uefi/tools/regression/lib/libc/stdio/test-open_wmemstream.c - copied unchanged from r247509, head/tools/regression/lib/libc/stdio/test-open_wmemstream.c projects/uefi/tools/regression/lib/libc/stdio/test-open_wmemstream.t - copied unchanged from r247509, head/tools/regression/lib/libc/stdio/test-open_wmemstream.t Modified: projects/uefi/UPDATING projects/uefi/cddl/contrib/opensolaris/cmd/zdb/zdb.c projects/uefi/contrib/binutils/gas/config/tc-arm.c projects/uefi/contrib/openbsm/bin/auditdistd/sender.c projects/uefi/include/stdio.h projects/uefi/include/wchar.h projects/uefi/lib/libc/stdio/Makefile.inc projects/uefi/lib/libc/stdio/Symbol.map projects/uefi/libexec/rtld-elf/map_object.c projects/uefi/sbin/tunefs/tunefs.c projects/uefi/share/man/man4/arcmsr.4 projects/uefi/share/man/man9/eventtimers.9 projects/uefi/sys/amd64/amd64/machdep.c projects/uefi/sys/amd64/amd64/pmap.c projects/uefi/sys/arm/allwinner/timer.c projects/uefi/sys/arm/arm/mpcore_timer.c projects/uefi/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c projects/uefi/sys/arm/broadcom/bcm2835/bcm2835_systimer.c projects/uefi/sys/arm/broadcom/bcm2835/files.bcm2835 projects/uefi/sys/arm/econa/econa_machdep.c projects/uefi/sys/arm/lpc/lpc_timer.c projects/uefi/sys/arm/mv/timer.c projects/uefi/sys/arm/s3c2xx0/s3c24x0_machdep.c projects/uefi/sys/arm/ti/am335x/am335x_dmtimer.c projects/uefi/sys/arm/ti/ti_gpio.c projects/uefi/sys/arm/versatile/sp804.c projects/uefi/sys/arm/xscale/i80321/ep80219_machdep.c projects/uefi/sys/arm/xscale/i80321/iq31244_machdep.c projects/uefi/sys/arm/xscale/i8134x/crb_machdep.c projects/uefi/sys/arm/xscale/ixp425/avila_machdep.c projects/uefi/sys/arm/xscale/pxa/pxa_machdep.c projects/uefi/sys/boot/common/load_elf.c projects/uefi/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c projects/uefi/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c projects/uefi/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h projects/uefi/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h projects/uefi/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c projects/uefi/sys/dev/acpica/acpi_cpu.c projects/uefi/sys/dev/acpica/acpi_hpet.c projects/uefi/sys/dev/arcmsr/arcmsr.c projects/uefi/sys/dev/arcmsr/arcmsr.h projects/uefi/sys/dev/ath/if_ath_tx_ht.c projects/uefi/sys/dev/ath/if_athrate.h projects/uefi/sys/dev/mfi/mfi.c projects/uefi/sys/dev/pci/pci.c projects/uefi/sys/dev/sdhci/sdhci.c projects/uefi/sys/dev/sdhci/sdhci.h projects/uefi/sys/dev/sdhci/sdhci_if.m projects/uefi/sys/dev/watchdog/watchdog.c projects/uefi/sys/i386/i386/machdep.c projects/uefi/sys/i386/i386/pmap.c projects/uefi/sys/i386/xen/clock.c projects/uefi/sys/i386/xen/pmap.c projects/uefi/sys/ia64/ia64/clock.c projects/uefi/sys/ia64/ia64/machdep.c projects/uefi/sys/kern/kern_clocksource.c projects/uefi/sys/kern/kern_et.c projects/uefi/sys/kern/kern_timeout.c projects/uefi/sys/kern/vfs_bio.c projects/uefi/sys/mips/mips/tick.c projects/uefi/sys/mips/nlm/tick.c projects/uefi/sys/mips/rmi/tick.c projects/uefi/sys/modules/ixgbe/Makefile projects/uefi/sys/netinet/sctputil.c projects/uefi/sys/pc98/pc98/machdep.c projects/uefi/sys/powerpc/aim/clock.c projects/uefi/sys/powerpc/aim/mmu_oea.c projects/uefi/sys/powerpc/aim/mmu_oea64.c projects/uefi/sys/powerpc/booke/clock.c projects/uefi/sys/powerpc/booke/pmap.c projects/uefi/sys/powerpc/powerpc/cpu.c projects/uefi/sys/powerpc/ps3/platform_ps3.c projects/uefi/sys/powerpc/wii/platform_wii.c projects/uefi/sys/sparc64/sparc64/pmap.c projects/uefi/sys/sparc64/sparc64/tick.c projects/uefi/sys/sys/proc.h projects/uefi/sys/sys/systm.h projects/uefi/sys/sys/time.h projects/uefi/sys/sys/timeet.h projects/uefi/sys/sys/types.h projects/uefi/sys/sys/vnode.h projects/uefi/sys/sys/watchdog.h projects/uefi/sys/ufs/ffs/ffs_alloc.c projects/uefi/sys/ufs/ffs/ffs_softdep.c projects/uefi/sys/ufs/ffs/ffs_vfsops.c projects/uefi/sys/ufs/ufs/ufs_quota.c projects/uefi/sys/vm/vm_object.h projects/uefi/sys/x86/isa/atrtc.c projects/uefi/sys/x86/isa/clock.c projects/uefi/sys/x86/x86/local_apic.c projects/uefi/tools/regression/lib/libc/stdio/Makefile projects/uefi/tools/test/iconv/tablegen/cmp.sh projects/uefi/usr.bin/dc/dc.c projects/uefi/usr.sbin/watchdogd/watchdogd.8 projects/uefi/usr.sbin/watchdogd/watchdogd.c Directory Properties: projects/uefi/ (props changed) projects/uefi/cddl/contrib/opensolaris/ (props changed) projects/uefi/contrib/binutils/ (props changed) projects/uefi/contrib/openbsm/ (props changed) projects/uefi/lib/libc/ (props changed) projects/uefi/sbin/ (props changed) projects/uefi/share/man/man4/ (props changed) projects/uefi/sys/ (props changed) projects/uefi/sys/boot/ (props changed) projects/uefi/sys/cddl/contrib/opensolaris/ (props changed) Modified: projects/uefi/UPDATING ============================================================================== --- projects/uefi/UPDATING Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/UPDATING Fri Mar 1 00:15:58 2013 (r247510) @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20130208: + A new compression method (lz4) has been merged to -HEAD. Please + refer to zpool-features(7) for more information. + + Please refer to the "ZFS notes" section of this file for information + on upgrading boot ZFS pools. + 20130129: A BSD-licensed patch(1) variant has been added and is installed as bsdpatch, being the GNU version the default patch. @@ -39,8 +46,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 unlikely event that -M was the last option on the command line and the command line contained at least two files and a target directory the first file will have logs appended to it. The -M - option served little practical purpose in the last decade so it's - used expected to be extremely rare. + option served little practical purpose in the last decade so its + use is expected to be extremely rare. 20121223: After switching to Clang as the default compiler some users of ZFS Modified: projects/uefi/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- projects/uefi/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Mar 1 00:15:58 2013 (r247510) @@ -545,7 +545,7 @@ static void dump_metaslab_stats(metaslab_t *msp) { char maxbuf[32]; - space_map_t *sm = &msp->ms_map; + space_map_t *sm = msp->ms_map; avl_tree_t *t = sm->sm_pp_root; int free_pct = sm->sm_space * 100 / sm->sm_size; @@ -561,7 +561,7 @@ dump_metaslab(metaslab_t *msp) { vdev_t *vd = msp->ms_group->mg_vd; spa_t *spa = vd->vdev_spa; - space_map_t *sm = &msp->ms_map; + space_map_t *sm = msp->ms_map; space_map_obj_t *smo = &msp->ms_smo; char freebuf[32]; @@ -2160,11 +2160,11 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); - space_map_unload(&msp->ms_map); - VERIFY(space_map_load(&msp->ms_map, + space_map_unload(msp->ms_map); + VERIFY(space_map_load(msp->ms_map, &zdb_space_map_ops, SM_ALLOC, &msp->ms_smo, spa->spa_meta_objset) == 0); - msp->ms_map.sm_ppd = vd; + msp->ms_map->sm_ppd = vd; mutex_exit(&msp->ms_lock); } } @@ -2187,7 +2187,7 @@ zdb_leak_fini(spa_t *spa) for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); - space_map_unload(&msp->ms_map); + space_map_unload(msp->ms_map); mutex_exit(&msp->ms_lock); } } Modified: projects/uefi/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- projects/uefi/contrib/binutils/gas/config/tc-arm.c Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/contrib/binutils/gas/config/tc-arm.c Fri Mar 1 00:15:58 2013 (r247510) @@ -3079,6 +3079,7 @@ s_arm_unwind_fnend (int ignored ATTRIBUT record_alignment (now_seg, 2); ptr = frag_more (8); + memset(ptr, 0, 8); where = frag_now_fix () - 8; /* Self relative offset of the function start. */ @@ -17350,6 +17351,7 @@ create_unwind_entry (int have_data) /* Allocate the table entry. */ ptr = frag_more ((size << 2) + 4); + memset(ptr, 0, (size << 2) + 4); where = frag_now_fix () - ((size << 2) + 4); switch (unwind.personality_index) Modified: projects/uefi/contrib/openbsm/bin/auditdistd/sender.c ============================================================================== --- projects/uefi/contrib/openbsm/bin/auditdistd/sender.c Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/contrib/openbsm/bin/auditdistd/sender.c Fri Mar 1 00:15:58 2013 (r247510) @@ -394,6 +394,7 @@ read_thread_wait(void) mtx_lock(&adist_remote_mtx); if (adhost->adh_reset) { +reset: adhost->adh_reset = false; if (trail_filefd(adist_trail) != -1) trail_close(adist_trail); @@ -408,6 +409,14 @@ read_thread_wait(void) while (trail_filefd(adist_trail) == -1) { newfile = true; wait_for_dir(); + /* + * We may have been disconnected and reconnected in the + * meantime, check if reset is set. + */ + mtx_lock(&adist_remote_mtx); + if (adhost->adh_reset) + goto reset; + mtx_unlock(&adist_remote_mtx); if (trail_filefd(adist_trail) == -1) trail_next(adist_trail); } Modified: projects/uefi/include/stdio.h ============================================================================== --- projects/uefi/include/stdio.h Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/include/stdio.h Fri Mar 1 00:15:58 2013 (r247510) @@ -346,6 +346,7 @@ char *tempnam(const char *, const char * FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); +FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list); Modified: projects/uefi/include/wchar.h ============================================================================== --- projects/uefi/include/wchar.h Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/include/wchar.h Fri Mar 1 00:15:58 2013 (r247510) @@ -207,6 +207,7 @@ int wcwidth(wchar_t); #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); +FILE *open_wmemstream(wchar_t **, size_t *); wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict); wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); wchar_t *wcsdup(const wchar_t *) __malloc_like; Modified: projects/uefi/lib/libc/stdio/Makefile.inc ============================================================================== --- projects/uefi/lib/libc/stdio/Makefile.inc Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/lib/libc/stdio/Makefile.inc Fri Mar 1 00:15:58 2013 (r247510) @@ -14,6 +14,7 @@ SRCS+= _flock_stub.c asprintf.c clrerr.c ftell.c funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwscanf.c \ fwrite.c getc.c getchar.c getdelim.c getline.c \ gets.c getw.c getwc.c getwchar.c makebuf.c mktemp.c \ + open_memstream.c open_wmemstream.c \ perror.c printf.c printf-pos.c putc.c putchar.c \ puts.c putw.c putwc.c putwchar.c \ refill.c remove.c rewind.c rget.c scanf.c setbuf.c setbuffer.c \ @@ -36,7 +37,7 @@ MAN+= fclose.3 ferror.3 fflush.3 fgetln. flockfile.3 \ fopen.3 fputs.3 \ fputws.3 fread.3 fseek.3 funopen.3 fwide.3 getc.3 \ - getline.3 getwc.3 mktemp.3 \ + getline.3 getwc.3 mktemp.3 open_memstream.3 \ printf.3 printf_l.3 putc.3 putwc.3 remove.3 scanf.3 scanf_l.3 setbuf.3 \ stdio.3 tmpnam.3 \ ungetc.3 ungetwc.3 wprintf.3 wscanf.3 @@ -60,6 +61,7 @@ MLINKS+=getc.3 fgetc.3 getc.3 getc_unloc MLINKS+=getline.3 getdelim.3 MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3 MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3 mktemp.3 mkstemps.3 +MLINKS+=open_memstream.3 open_wmemstream.3 MLINKS+=printf.3 asprintf.3 printf.3 dprintf.3 printf.3 fprintf.3 \ printf.3 snprintf.3 printf.3 sprintf.3 \ printf.3 vasprintf.3 printf.3 vdprintf.3 \ Modified: projects/uefi/lib/libc/stdio/Symbol.map ============================================================================== --- projects/uefi/lib/libc/stdio/Symbol.map Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/lib/libc/stdio/Symbol.map Fri Mar 1 00:15:58 2013 (r247510) @@ -156,6 +156,8 @@ FBSD_1.3 { putwc_l; putwchar_l; fmemopen; + open_memstream; + open_wmemstream; }; FBSDprivate_1.0 { Copied: projects/uefi/lib/libc/stdio/open_memstream.3 (from r247509, head/lib/libc/stdio/open_memstream.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/uefi/lib/libc/stdio/open_memstream.3 Fri Mar 1 00:15:58 2013 (r247510, copy of r247509, head/lib/libc/stdio/open_memstream.3) @@ -0,0 +1,155 @@ +.\" Copyright (c) 2013 Advanced Computing Technologies LLC +.\" Written by: John H. Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd February 27, 2013 +.Dt OPEN_MEMSTREAM 3 +.Os +.Sh NAME +.Nm open_memstream , +.Nm open_wmemstream +.Nd dynamic memory buffer stream open functions +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdio.h +.Ft FILE * +.Fn open_memstream "char **bufp" "size_t **sizep" +.In wchar.h +.Ft FILE * +.Fn open_wmemstream "wchar_t **bufp" "size_t **sizep" +.Sh DESCRIPTION +The +.Fn open_memstream +and +.Fn open_wmemstream +functions create a write-only, seekable stream backed by a dynamically +allocated memory buffer. +The +.Fn open_memstream +function creates a byte-oriented stream, +while the +.Fn open_wmemstream +function creates a wide-oriented stream. +.Pp +Each stream maintains a current position and size. +Initially, +the position and size are set to zero. +Each write begins at the current position and advances it the number of +successfully written bytes for +.Fn open_memstream +or wide characters for +.Fn open_wmemstream . +If a write moves the current position beyond the length of the buffer, +the length of the buffer is extended and a null character is appended to the +buffer. +.Pp +A stream's buffer always contains a null character at the end of the buffer +that is not included in the current length. +.Pp +If a stream's current position is moved beyond the current length via a +seek operation and a write is performed, +the characters between the current length and the current position are filled +with null characters before the write is performed. +.Pp +After a successful call to +.Xr fclose 3 +or +.Xr fflush 3 , +the pointer referenced by +.Fa bufp +will contain the start of the memory buffer and the variable referenced by +.Fa sizep +will contain the smaller of the current position and the current buffer length. +.Pp +After a successful call to +.Xr fflush 3, +the pointer referenced by +.Fa bufp +and the variable referenced by +.Fa sizep +are only valid until the next write operation or a call to +.Xr fclose 3. +.Pp +Once a stream is closed, +the allocated buffer referenced by +.Fa bufp +should be released via a call to +.Xr free 3 +when it is no longer needed. +.Sh IMPLEMENTATION NOTES +Internally all I/O streams are effectively byte-oriented, +so using wide-oriented operations to write to a stream opened via +.Fn open_wmemstream +results in wide characters being expanded to a stream of multibyte characters +in stdio's internal buffers. +These multibyte characters are then converted back to wide characters when +written into the stream. +As a result, +the wide-oriented streams maintain an internal multibyte character conversion +state that is cleared on any seek opertion that changes the current position. +This should have no effect as long as wide-oriented output operations are used +on a wide-oriented stream. +.Sh RETURN VALUES +Upon successful completion, +.Fn open_memstream +and +.Fn open_wmemstream +return a +.Tn FILE +pointer. +Otherwise, +.Dv NULL +is returned and the global variable +.Va errno +is set to indicate the error. +.Sh ERRORS +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa bufp +or +.Fa sizep +argument was +.Dv NULL . +.It Bq Er ENOMEM +Memory for the stream or buffer could not be allocated. +.El +.Sh SEE ALSO +.Xr fclose 3 , +.Xr fflush 3 , +.Xr fopen 3 , +.Xr free 3 , +.Xr fseek 3 , +.Xr sbuf 3 , +.Xr stdio 3 +.Sh STANDARDS +The +.Fn open_memstream +and +.Fn open_wmemstream +functions conform to +.St -p1003.1-2008 . Copied: projects/uefi/lib/libc/stdio/open_memstream.c (from r247509, head/lib/libc/stdio/open_memstream.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/uefi/lib/libc/stdio/open_memstream.c Fri Mar 1 00:15:58 2013 (r247510, copy of r247509, head/lib/libc/stdio/open_memstream.c) @@ -0,0 +1,209 @@ +/*- + * Copyright (c) 2013 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +/* XXX: There is no FPOS_MAX. This assumes fpos_t is an off_t. */ +#define FPOS_MAX OFF_MAX + +struct memstream { + char **bufp; + size_t *sizep; + ssize_t len; + fpos_t offset; +}; + +static int +memstream_grow(struct memstream *ms, fpos_t newoff) +{ + char *buf; + ssize_t newsize; + + if (newoff < 0 || newoff >= SSIZE_MAX) + newsize = SSIZE_MAX - 1; + else + newsize = newoff; + if (newsize > ms->len) { + buf = realloc(*ms->bufp, newsize + 1); + if (buf != NULL) { +#ifdef DEBUG + fprintf(stderr, "MS: %p growing from %zd to %zd\n", + ms, ms->len, newsize); +#endif + memset(buf + ms->len + 1, 0, newsize - ms->len); + *ms->bufp = buf; + ms->len = newsize; + return (1); + } + return (0); + } + return (1); +} + +static void +memstream_update(struct memstream *ms) +{ + + assert(ms->len >= 0 && ms->offset >= 0); + *ms->sizep = ms->len < ms->offset ? ms->len : ms->offset; +} + +static int +memstream_write(void *cookie, const char *buf, int len) +{ + struct memstream *ms; + ssize_t tocopy; + + ms = cookie; + if (!memstream_grow(ms, ms->offset + len)) + return (-1); + tocopy = ms->len - ms->offset; + if (len < tocopy) + tocopy = len; + memcpy(*ms->bufp + ms->offset, buf, tocopy); + ms->offset += tocopy; + memstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "MS: write(%p, %d) = %zd\n", ms, len, tocopy); +#endif + return (tocopy); +} + +static fpos_t +memstream_seek(void *cookie, fpos_t pos, int whence) +{ + struct memstream *ms; +#ifdef DEBUG + fpos_t old; +#endif + + ms = cookie; +#ifdef DEBUG + old = ms->offset; +#endif + switch (whence) { + case SEEK_SET: + /* _fseeko() checks for negative offsets. */ + assert(pos >= 0); + ms->offset = pos; + break; + case SEEK_CUR: + /* This is only called by _ftello(). */ + assert(pos == 0); + break; + case SEEK_END: + if (pos < 0) { + if (pos + ms->len < 0) { +#ifdef DEBUG + fprintf(stderr, + "MS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EINVAL; + return (-1); + } + } else { + if (FPOS_MAX - ms->len < pos) { +#ifdef DEBUG + fprintf(stderr, + "MS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EOVERFLOW; + return (-1); + } + } + ms->offset = ms->len + pos; + break; + } + memstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "MS: seek(%p, %jd, %d) %jd -> %jd\n", ms, (intmax_t)pos, + whence, (intmax_t)old, (intmax_t)ms->offset); +#endif + return (ms->offset); +} + +static int +memstream_close(void *cookie) +{ + + free(cookie); + return (0); +} + +FILE * +open_memstream(char **bufp, size_t *sizep) +{ + struct memstream *ms; + int save_errno; + FILE *fp; + + if (bufp == NULL || sizep == NULL) { + errno = EINVAL; + return (NULL); + } + *bufp = calloc(1, 1); + if (*bufp == NULL) + return (NULL); + ms = malloc(sizeof(*ms)); + if (ms == NULL) { + save_errno = errno; + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + ms->bufp = bufp; + ms->sizep = sizep; + ms->len = 0; + ms->offset = 0; + memstream_update(ms); + fp = funopen(ms, NULL, memstream_write, memstream_seek, + memstream_close); + if (fp == NULL) { + save_errno = errno; + free(ms); + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + fwide(fp, -1); + return (fp); +} Copied: projects/uefi/lib/libc/stdio/open_wmemstream.c (from r247509, head/lib/libc/stdio/open_wmemstream.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/uefi/lib/libc/stdio/open_wmemstream.c Fri Mar 1 00:15:58 2013 (r247510, copy of r247509, head/lib/libc/stdio/open_wmemstream.c) @@ -0,0 +1,271 @@ +/*- + * Copyright (c) 2013 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +/* XXX: There is no FPOS_MAX. This assumes fpos_t is an off_t. */ +#define FPOS_MAX OFF_MAX + +struct wmemstream { + wchar_t **bufp; + size_t *sizep; + ssize_t len; + fpos_t offset; + mbstate_t mbstate; +}; + +static int +wmemstream_grow(struct wmemstream *ms, fpos_t newoff) +{ + wchar_t *buf; + ssize_t newsize; + + if (newoff < 0 || newoff >= SSIZE_MAX / sizeof(wchar_t)) + newsize = SSIZE_MAX / sizeof(wchar_t) - 1; + else + newsize = newoff; + if (newsize > ms->len) { + buf = realloc(*ms->bufp, (newsize + 1) * sizeof(wchar_t)); + if (buf != NULL) { +#ifdef DEBUG + fprintf(stderr, "WMS: %p growing from %zd to %zd\n", + ms, ms->len, newsize); +#endif + wmemset(buf + ms->len + 1, 0, newsize - ms->len); + *ms->bufp = buf; + ms->len = newsize; + return (1); + } + return (0); + } + return (1); +} + +static void +wmemstream_update(struct wmemstream *ms) +{ + + assert(ms->len >= 0 && ms->offset >= 0); + *ms->sizep = ms->len < ms->offset ? ms->len : ms->offset; +} + +/* + * Based on a starting multibyte state and an input buffer, determine + * how many wchar_t's would be output. This doesn't use mbsnrtowcs() + * so that it can handle embedded null characters. + */ +static size_t +wbuflen(const mbstate_t *state, const char *buf, int len) +{ + mbstate_t lenstate; + size_t charlen, count; + + count = 0; + lenstate = *state; + while (len > 0) { + charlen = mbrlen(buf, len, &lenstate); + if (charlen == (size_t)-1) + return (-1); + if (charlen == (size_t)-2) + break; + if (charlen == 0) + /* XXX: Not sure how else to handle this. */ + charlen = 1; + len -= charlen; + buf += charlen; + count++; + } + return (count); +} + +static int +wmemstream_write(void *cookie, const char *buf, int len) +{ + struct wmemstream *ms; + ssize_t consumed, wlen; + size_t charlen; + + ms = cookie; + wlen = wbuflen(&ms->mbstate, buf, len); + if (wlen < 0) { + errno = EILSEQ; + return (-1); + } + if (!wmemstream_grow(ms, ms->offset + wlen)) + return (-1); + + /* + * This copies characters one at a time rather than using + * mbsnrtowcs() so it can properly handle embedded null + * characters. + */ + consumed = 0; + while (len > 0 && ms->offset < ms->len) { + charlen = mbrtowc(*ms->bufp + ms->offset, buf, len, + &ms->mbstate); + if (charlen == (size_t)-1) { + if (consumed == 0) { + errno = EILSEQ; + return (-1); + } + /* Treat it as a successful short write. */ + break; + } + if (charlen == 0) + /* XXX: Not sure how else to handle this. */ + charlen = 1; + if (charlen == (size_t)-2) { + consumed += len; + len = 0; + } else { + consumed += charlen; + buf += charlen; + len -= charlen; + ms->offset++; + } + } + wmemstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "WMS: write(%p, %d) = %zd\n", ms, len, consumed); +#endif + return (consumed); +} + +static fpos_t +wmemstream_seek(void *cookie, fpos_t pos, int whence) +{ + struct wmemstream *ms; + fpos_t old; + + ms = cookie; + old = ms->offset; + switch (whence) { + case SEEK_SET: + /* _fseeko() checks for negative offsets. */ + assert(pos >= 0); + ms->offset = pos; + break; + case SEEK_CUR: + /* This is only called by _ftello(). */ + assert(pos == 0); + break; + case SEEK_END: + if (pos < 0) { + if (pos + ms->len < 0) { +#ifdef DEBUG + fprintf(stderr, + "WMS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EINVAL; + return (-1); + } + } else { + if (FPOS_MAX - ms->len < pos) { +#ifdef DEBUG + fprintf(stderr, + "WMS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EOVERFLOW; + return (-1); + } + } + ms->offset = ms->len + pos; + break; + } + /* Reset the multibyte state if a seek changes the position. */ + if (ms->offset != old) + memset(&ms->mbstate, 0, sizeof(ms->mbstate)); + wmemstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "WMS: seek(%p, %jd, %d) %jd -> %jd\n", ms, + (intmax_t)pos, whence, (intmax_t)old, (intmax_t)ms->offset); +#endif + return (ms->offset); +} + +static int +wmemstream_close(void *cookie) +{ + + free(cookie); + return (0); +} + +FILE * +open_wmemstream(wchar_t **bufp, size_t *sizep) +{ + struct wmemstream *ms; + int save_errno; + FILE *fp; + + if (bufp == NULL || sizep == NULL) { + errno = EINVAL; + return (NULL); + } + *bufp = calloc(1, sizeof(wchar_t)); + if (*bufp == NULL) + return (NULL); + ms = malloc(sizeof(*ms)); + if (ms == NULL) { + save_errno = errno; + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + ms->bufp = bufp; + ms->sizep = sizep; + ms->len = 0; + ms->offset = 0; + memset(&ms->mbstate, 0, sizeof(mbstate_t)); + wmemstream_update(ms); + fp = funopen(ms, NULL, wmemstream_write, wmemstream_seek, + wmemstream_close); + if (fp == NULL) { + save_errno = errno; + free(ms); + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + fwide(fp, 1); + return (fp); +} Modified: projects/uefi/libexec/rtld-elf/map_object.c ============================================================================== --- projects/uefi/libexec/rtld-elf/map_object.c Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/libexec/rtld-elf/map_object.c Fri Mar 1 00:15:58 2013 (r247510) @@ -175,7 +175,7 @@ map_object(int fd, const char *path, con base_vaddr = trunc_page(segs[0]->p_vaddr); base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz); mapsize = base_vlimit - base_vaddr; - base_addr = hdr->e_type == ET_EXEC ? (caddr_t) base_vaddr : NULL; + base_addr = (caddr_t) base_vaddr; mapbase = mmap(base_addr, mapsize, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_NOCORE, -1, 0); Modified: projects/uefi/sbin/tunefs/tunefs.c ============================================================================== --- projects/uefi/sbin/tunefs/tunefs.c Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/sbin/tunefs/tunefs.c Fri Mar 1 00:15:58 2013 (r247510) @@ -671,7 +671,7 @@ journal_findfile(void) return (ino); } } else { - if ((off_t)dp1->di_size >= lblktosize(&sblock, NDADDR)) { + if ((off_t)dp2->di_size >= lblktosize(&sblock, NDADDR)) { warnx("ROOTINO extends beyond direct blocks."); return (-1); } Modified: projects/uefi/share/man/man4/arcmsr.4 ============================================================================== --- projects/uefi/share/man/man4/arcmsr.4 Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/share/man/man4/arcmsr.4 Fri Mar 1 00:15:58 2013 (r247510) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2012 +.Dd February 27, 2013 .Dt ARCMSR 4 .Os .Sh NAME @@ -108,6 +108,8 @@ ARC-1222 .It ARC-1223 .It +ARC-1224 +.It ARC-1230 .It ARC-1231 Modified: projects/uefi/share/man/man9/eventtimers.9 ============================================================================== --- projects/uefi/share/man/man9/eventtimers.9 Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/share/man/man9/eventtimers.9 Fri Mar 1 00:15:58 2013 (r247510) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2011 Alexander Motin +.\" Copyright (c) 2011-2013 Alexander Motin .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 2011 +.Dd February 25, 2013 .Dt EVENTTIMERS 9 .Os .Sh NAME @@ -36,7 +36,7 @@ struct eventtimer; typedef int et_start_t(struct eventtimer *et, - struct bintime *first, struct bintime *period); + sbintime_t first, sbintime_t period); typedef int et_stop_t(struct eventtimer *et); typedef void et_event_cb_t(struct eventtimer *et, void *arg); typedef int et_deregister_cb_t(struct eventtimer *et, void *arg); @@ -53,8 +53,8 @@ struct eventtimer { int et_quality; int et_active; uint64_t et_frequency; - struct bintime et_min_period; - struct bintime et_max_period; + sbintime_t et_min_period; + sbintime_t et_max_period; et_start_t *et_start; et_stop_t *et_stop; et_event_cb_t *et_event_cb; @@ -75,7 +75,7 @@ struct eventtimer { .Ft int .Fn et_init "struct eventtimer *et" "et_event_cb_t *event" "et_deregister_cb_t *deregister" "void *arg" .Ft int -.Fn et_start "struct eventtimer *et" "struct bintime *first" "struct bintime *period" +.Fn et_start "struct eventtimer *et" "sbintime_t first" "sbintime_t period" .Ft int .Fn et_stop "struct eventtimer *et" .Ft int Modified: projects/uefi/sys/amd64/amd64/machdep.c ============================================================================== --- projects/uefi/sys/amd64/amd64/machdep.c Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/sys/amd64/amd64/machdep.c Fri Mar 1 00:15:58 2013 (r247510) @@ -692,7 +692,7 @@ cpu_halt(void) halt(); } -void (*cpu_idle_hook)(void) = NULL; /* ACPI idle hook. */ +void (*cpu_idle_hook)(sbintime_t) = NULL; /* ACPI idle hook. */ static int cpu_ident_amdc1e = 0; /* AMD C1E supported. */ static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ TUNABLE_INT("machdep.idle_mwait", &idle_mwait); @@ -704,7 +704,7 @@ SYSCTL_INT(_machdep, OID_AUTO, idle_mwai #define STATE_SLEEPING 0x2 static void -cpu_idle_acpi(int busy) +cpu_idle_acpi(sbintime_t sbt) { int *state; @@ -716,14 +716,14 @@ cpu_idle_acpi(int busy) if (sched_runnable()) enable_intr(); else if (cpu_idle_hook) - cpu_idle_hook(); + cpu_idle_hook(sbt); else __asm __volatile("sti; hlt"); *state = STATE_RUNNING; } static void -cpu_idle_hlt(int busy) +cpu_idle_hlt(sbintime_t sbt) { int *state; @@ -764,7 +764,7 @@ cpu_idle_hlt(int busy) #define MWAIT_C4 0x30 static void -cpu_idle_mwait(int busy) +cpu_idle_mwait(sbintime_t sbt) { int *state; @@ -787,7 +787,7 @@ cpu_idle_mwait(int busy) } static void -cpu_idle_spin(int busy) +cpu_idle_spin(sbintime_t sbt) { int *state; int i; @@ -836,12 +836,13 @@ cpu_probe_amdc1e(void) } } -void (*cpu_idle_fn)(int) = cpu_idle_acpi; +void (*cpu_idle_fn)(sbintime_t) = cpu_idle_acpi; void cpu_idle(int busy) { uint64_t msr; + sbintime_t sbt = -1; CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu); @@ -859,7 +860,7 @@ cpu_idle(int busy) /* If we have time - switch timers into idle mode. */ if (!busy) { critical_enter(); - cpu_idleclock(); + sbt = cpu_idleclock(); } /* Apply AMD APIC timer C1E workaround. */ @@ -870,7 +871,7 @@ cpu_idle(int busy) } /* Call main idle method. */ - cpu_idle_fn(busy); + cpu_idle_fn(sbt); /* Switch timers mack into active mode. */ if (!busy) { Modified: projects/uefi/sys/amd64/amd64/pmap.c ============================================================================== --- projects/uefi/sys/amd64/amd64/pmap.c Thu Feb 28 23:45:41 2013 (r247509) +++ projects/uefi/sys/amd64/amd64/pmap.c Fri Mar 1 00:15:58 2013 (r247510) @@ -3487,9 +3487,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - KASSERT((m->oflags & (VPO_UNMANAGED | VPO_BUSY)) != 0 || *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***