From owner-p4-projects@FreeBSD.ORG Wed Jan 30 17:46:14 2013 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0241EA85; Wed, 30 Jan 2013 17:46:14 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B9070A83 for ; Wed, 30 Jan 2013 17:46:13 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8CFD4B11 for ; Wed, 30 Jan 2013 17:46:13 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.6/8.14.6) with ESMTP id r0UHkD8A085922 for ; Wed, 30 Jan 2013 17:46:13 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.6/8.14.6/Submit) id r0UHkDpW085919 for perforce@freebsd.org; Wed, 30 Jan 2013 17:46:13 GMT (envelope-from brooks@freebsd.org) Date: Wed, 30 Jan 2013 17:46:13 GMT Message-Id: <201301301746.r0UHkDpW085919@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis Subject: PERFORCE change 221619 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.14 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2013 17:46:14 -0000 http://p4web.freebsd.org/@@221619?ac=10 Change 221619 by brooks@brooks_zenith on 2013/01/30 17:45:19 IFC @221618 Affected files ... .. //depot/projects/ctsrd/beribsd/src/UPDATING#7 integrate .. //depot/projects/ctsrd/beribsd/src/etc/Makefile#6 integrate .. //depot/projects/ctsrd/beribsd/src/include/stdio.h#4 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/amd64/sys/__vdso_gettc.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/arm/sys/Makefile.inc#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/arm/sys/__vdso_gettc.c#1 branch .. //depot/projects/ctsrd/beribsd/src/lib/libc/i386/sys/__vdso_gettc.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/ia64/sys/Makefile.inc#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/ia64/sys/__vdso_gettc.c#1 branch .. //depot/projects/ctsrd/beribsd/src/lib/libc/mips/sys/Makefile.inc#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/mips/sys/__vdso_gettc.c#1 branch .. //depot/projects/ctsrd/beribsd/src/lib/libc/powerpc/Makefile.inc#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/powerpc/sys/__vdso_gettc.c#1 branch .. //depot/projects/ctsrd/beribsd/src/lib/libc/powerpc64/Makefile.inc#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/powerpc64/sys/__vdso_gettc.c#1 branch .. //depot/projects/ctsrd/beribsd/src/lib/libc/sparc64/Makefile.inc#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/sparc64/sys/__vdso_gettc.c#1 branch .. //depot/projects/ctsrd/beribsd/src/lib/libc/stdio/Makefile.inc#4 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/stdio/Symbol.map#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/stdio/fmemopen.c#1 branch .. //depot/projects/ctsrd/beribsd/src/lib/libc/stdio/fopen.3#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/sys/__vdso_gettimeofday.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/lib/libc/sys/gettimeofday.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/libexec/tftpd/tftp-io.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sbin/devd/devd.8#3 integrate .. //depot/projects/ctsrd/beribsd/src/sbin/devd/devd.cc#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/amd64/include/vmm_instruction_emul.h#2 integrate .. //depot/projects/ctsrd/beribsd/src/sys/amd64/vmm/vmm_instruction_emul.c#2 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/at91dci.c#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/atmegadci.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/avr32dci.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/dwc_otg.c#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/ehci.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/musb_otg.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/ohci.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/uhci.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/usb_controller.c#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/uss820dci.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/xhci.c#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/storage/ustorage_fs.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template_audio.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template_cdce.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template_kbd.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template_modem.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template_mouse.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template_msc.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/template/usb_template_mtp.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/ufm_ioctl.h#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb.h#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_busdma.c#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_busdma.h#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_compat_linux.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_core.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_core.h#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_debug.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_dev.c#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_dev.h#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_device.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_dynamic.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_endian.h#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_error.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_freebsd.h#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_freebsd_loader.h#1 branch .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_generic.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_handle_request.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_hid.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_hub.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_ioctl.h#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_lookup.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_mbuf.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_msctest.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_parse.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_pci.h#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_pf.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_process.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_process.h#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_request.c#5 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_transfer.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usb_util.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usbdi.h#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/dev/usb/usbhid.h#4 integrate .. //depot/projects/ctsrd/beribsd/src/sys/kern/kern_exit.c#6 integrate .. //depot/projects/ctsrd/beribsd/src/sys/sys/vdso.h#3 integrate .. //depot/projects/ctsrd/beribsd/src/sys/x86/x86/tsc.c#4 integrate .. //depot/projects/ctsrd/beribsd/src/tools/regression/lib/libc/stdio/test-fmemopen.c#1 branch .. //depot/projects/ctsrd/beribsd/src/tools/regression/lib/libc/stdio/test-fmemopen.t#1 branch .. //depot/projects/ctsrd/beribsd/src/tools/test/pthread_vfork/pthread_vfork_test.c#3 integrate .. //depot/projects/ctsrd/beribsd/src/usr.sbin/bhyve/pci_emul.c#2 integrate .. //depot/projects/ctsrd/beribsd/src/usr.sbin/bhyve/pci_emul.h#2 integrate .. //depot/projects/ctsrd/beribsd/src/usr.sbin/bhyve/pci_virtio_net.c#2 integrate .. //depot/projects/ctsrd/beribsd/src/usr.sbin/bhyve/virtio.h#2 integrate Differences ... ==== //depot/projects/ctsrd/beribsd/src/UPDATING#7 (text+ko) ==== @@ -31,7 +31,7 @@ as bsdpatch, being the GNU version the default patch. To inverse the logic and use the BSD-licensed one as default, while having the GNU version installed as gnupatch, rebuild - ans install world with the WITH_BSD_PATCH knob set. + and install world with the WITH_BSD_PATCH knob set. 20130118: The install(1) option -M has changed meaning and now takes an @@ -1758,4 +1758,4 @@ Contact Warner Losh if you have any questions about your use of this document. -$FreeBSD: head/UPDATING 246074 2013-01-29 17:03:18Z gabor $ +$FreeBSD: head/UPDATING 246114 2013-01-30 10:23:38Z gabor $ ==== //depot/projects/ctsrd/beribsd/src/etc/Makefile#6 (text+ko) ==== @@ -1,5 +1,5 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 -# $FreeBSD: head/etc/Makefile 246097 2013-01-29 22:17:58Z brooks $ +# $FreeBSD: head/etc/Makefile 246127 2013-01-30 17:39:43Z brooks $ .include @@ -348,9 +348,10 @@ test "$$d" == "/" && d=""; \ d=${DISTBASE}$$d; \ shift; \ - ${ECHO} "${MTREE_CMD} -C -f $$m | sed s#^\.#.$$d# |" \ - "${METALOG.add}" ; \ - ${MTREE_CMD} -C -f $$m | sed s#^\.#.$$d# | ${METALOG.add} ; \ + ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \ + "sed s#^\.#.$$d# | ${METALOG.add}" ; \ + ${MTREE_CMD:N-W} -C -f $$m -K uname,gname | sed s#^\.#.$$d# | \ + ${METALOG.add} ; \ done; true .endif ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys ==== //depot/projects/ctsrd/beribsd/src/include/stdio.h#4 (text+ko) ==== @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)stdio.h 8.5 (Berkeley) 4/29/95 - * $FreeBSD: head/include/stdio.h 233600 2012-03-28 12:11:54Z theraven $ + * $FreeBSD: head/include/stdio.h 246120 2013-01-30 14:59:26Z gahr $ */ #ifndef _STDIO_H_ @@ -343,6 +343,7 @@ #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); int renameat(int, const char *, int, const char *); ==== //depot/projects/ctsrd/beribsd/src/lib/libc/amd64/sys/__vdso_gettc.c#3 (text+ko) ==== @@ -24,12 +24,14 @@ */ #include -__FBSDID("$FreeBSD: head/lib/libc/amd64/sys/__vdso_gettc.c 237434 2012-06-22 07:13:30Z kib $"); +__FBSDID("$FreeBSD: head/lib/libc/amd64/sys/__vdso_gettc.c 246117 2013-01-30 12:48:16Z kib $"); #include +#include #include #include #include +#include "libc_private.h" static u_int __vdso_gettc_low(const struct vdso_timehands *th) @@ -41,9 +43,18 @@ return (rv); } +#pragma weak __vdso_gettc u_int __vdso_gettc(const struct vdso_timehands *th) { return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); } + +#pragma weak __vdso_gettimekeep +int +__vdso_gettimekeep(struct vdso_timekeep **tk) +{ + + return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk))); +} ==== //depot/projects/ctsrd/beribsd/src/lib/libc/arm/sys/Makefile.inc#3 (text+ko) ==== @@ -1,4 +1,6 @@ -# $FreeBSD: head/lib/libc/arm/sys/Makefile.inc 184789 2008-11-09 10:45:13Z ed $ +# $FreeBSD: head/lib/libc/arm/sys/Makefile.inc 246117 2013-01-30 12:48:16Z kib $ + +SRCS+= __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S pipe.S ptrace.S sbrk.S shmat.S sigreturn.S syscall.S ==== //depot/projects/ctsrd/beribsd/src/lib/libc/i386/sys/__vdso_gettc.c#3 (text+ko) ==== @@ -24,12 +24,14 @@ */ #include -__FBSDID("$FreeBSD: head/lib/libc/i386/sys/__vdso_gettc.c 237434 2012-06-22 07:13:30Z kib $"); +__FBSDID("$FreeBSD: head/lib/libc/i386/sys/__vdso_gettc.c 246117 2013-01-30 12:48:16Z kib $"); #include +#include #include #include #include +#include "libc_private.h" static u_int __vdso_gettc_low(const struct vdso_timehands *th) @@ -48,3 +50,11 @@ return (th->th_x86_shift > 0 ? __vdso_gettc_low(th) : rdtsc32()); } + +#pragma weak __vdso_gettimekeep +int +__vdso_gettimekeep(struct vdso_timekeep **tk) +{ + + return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk))); +} ==== //depot/projects/ctsrd/beribsd/src/lib/libc/ia64/sys/Makefile.inc#3 (text+ko) ==== @@ -1,4 +1,6 @@ -# $FreeBSD: head/lib/libc/ia64/sys/Makefile.inc 184789 2008-11-09 10:45:13Z ed $ +# $FreeBSD: head/lib/libc/ia64/sys/Makefile.inc 246117 2013-01-30 12:48:16Z kib $ + +SRCS+= __vdso_gettc.c MDASM+= Ovfork.S brk.S cerror.S exect.S fork.S getcontext.S pipe.S ptrace.S \ sbrk.S setlogin.S sigreturn.S swapcontext.S ==== //depot/projects/ctsrd/beribsd/src/lib/libc/mips/sys/Makefile.inc#3 (text+ko) ==== @@ -1,4 +1,6 @@ -# $FreeBSD: head/lib/libc/mips/sys/Makefile.inc 209233 2010-06-16 14:13:36Z jchandra $ +# $FreeBSD: head/lib/libc/mips/sys/Makefile.inc 246117 2013-01-30 12:48:16Z kib $ + +SRCS+= __vdso_gettc.c MDASM= Ovfork.S brk.S cerror.S exect.S \ fork.S pipe.S ptrace.S sbrk.S syscall.S ==== //depot/projects/ctsrd/beribsd/src/lib/libc/powerpc/Makefile.inc#3 (text+ko) ==== @@ -1,4 +1,6 @@ -# $FreeBSD: head/lib/libc/powerpc/Makefile.inc 156613 2006-03-13 01:15:01Z deischen $ +# $FreeBSD: head/lib/libc/powerpc/Makefile.inc 246117 2013-01-30 12:48:16Z kib $ + +SRCS+= __vdso_gettc.c # Long double is 64-bits MDSRCS+=machdep_ldisd.c ==== //depot/projects/ctsrd/beribsd/src/lib/libc/powerpc64/Makefile.inc#3 (text+ko) ==== @@ -1,4 +1,6 @@ -# $FreeBSD: head/lib/libc/powerpc64/Makefile.inc 209878 2010-07-10 14:45:03Z nwhitehorn $ +# $FreeBSD: head/lib/libc/powerpc64/Makefile.inc 246117 2013-01-30 12:48:16Z kib $ + +SRCS+= __vdso_gettc.c # Long double is 64-bits MDSRCS+=machdep_ldisd.c ==== //depot/projects/ctsrd/beribsd/src/lib/libc/sparc64/Makefile.inc#3 (text+ko) ==== @@ -1,10 +1,12 @@ -# $FreeBSD: head/lib/libc/sparc64/Makefile.inc 174204 2007-12-03 07:17:33Z das $ +# $FreeBSD: head/lib/libc/sparc64/Makefile.inc 246117 2013-01-30 12:48:16Z kib $ # # Machine dependent definitions for the ultra sparc architecture. # .include "fpu/Makefile.inc" +SRCS+= __vdso_gettc.c + # Long double is quad precision GDTOASRCS+=strtorQ.c MDSRCS+=machdep_ldisQ.c ==== //depot/projects/ctsrd/beribsd/src/lib/libc/stdio/Makefile.inc#4 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile.inc 8.3 (Berkeley) 4/17/94 -# $FreeBSD: head/lib/libc/stdio/Makefile.inc 235848 2012-05-23 17:13:30Z issyl0 $ +# $FreeBSD: head/lib/libc/stdio/Makefile.inc 246120 2013-01-30 14:59:26Z gahr $ # stdio sources .PATH: ${.CURDIR}/stdio @@ -8,7 +8,8 @@ fclose.c fcloseall.c fdopen.c \ feof.c ferror.c fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetwc.c \ fgetwln.c fgetws.c \ - fileno.c findfp.c flags.c fopen.c fprintf.c fpurge.c fputc.c fputs.c \ + fileno.c findfp.c flags.c fmemopen.c fopen.c fprintf.c fpurge.c \ + fputc.c fputs.c \ fputwc.c fputws.c fread.c freopen.c fscanf.c fseek.c fsetpos.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 \ @@ -48,7 +49,7 @@ MLINKS+=fflush.3 fpurge.3 MLINKS+=fgets.3 gets.3 MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3 -MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 +MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3 MLINKS+=fputs.3 puts.3 MLINKS+=fread.3 fwrite.3 MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \ ==== //depot/projects/ctsrd/beribsd/src/lib/libc/stdio/Symbol.map#3 (text) ==== @@ -1,5 +1,5 @@ /* - * $FreeBSD: head/lib/libc/stdio/Symbol.map 227753 2011-11-20 14:45:42Z theraven $ + * $FreeBSD: head/lib/libc/stdio/Symbol.map 246120 2013-01-30 14:59:26Z gahr $ */ FBSD_1.0 { @@ -155,6 +155,7 @@ getwchar_l; putwc_l; putwchar_l; + fmemopen; }; FBSDprivate_1.0 { ==== //depot/projects/ctsrd/beribsd/src/lib/libc/stdio/fopen.3#3 (text+ko) ==== @@ -30,15 +30,16 @@ .\" SUCH DAMAGE. .\" .\" @(#)fopen.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: head/lib/libc/stdio/fopen.3 243731 2012-11-30 23:51:33Z jilles $ +.\" $FreeBSD: head/lib/libc/stdio/fopen.3 246120 2013-01-30 14:59:26Z gahr $ .\" -.Dd November 30, 2012 +.Dd January 30, 2013 .Dt FOPEN 3 .Os .Sh NAME .Nm fopen , .Nm fdopen , -.Nm freopen +.Nm freopen , +.Nm fmemopen .Nd stream open functions .Sh LIBRARY .Lb libc @@ -50,6 +51,8 @@ .Fn fdopen "int fildes" "const char *mode" .Ft FILE * .Fn freopen "const char *path" "const char *mode" "FILE *stream" +.Ft FILE * +.Fn fmemopen "void *restrict *buf" "size_t size" "const char * restrict mode" .Sh DESCRIPTION The .Fn fopen @@ -202,6 +205,29 @@ .Dv ( stderr , stdin , or .Dv stdout ) . +.Pp +The +.Fn fmemopen +function +associates the buffer given by the +.Fa buf +and +.Fa size +arguments with a stream. +The +.Fa buf +argument shall be either a null pointer or point to a buffer that +is at least +.Fa size +bytes long. +If a null pointer is specified as the +.Fa buf +argument, +.Fn fmemopen +shall allocate +.Fa size +bytes of memory. This buffer shall be automatically freed when the +stream is closed. .Sh RETURN VALUES Upon successful completion .Fn fopen , @@ -225,16 +251,18 @@ to .Fn fopen , .Fn fdopen , +.Fn freopen , or -.Fn freopen +.Fn fmemopen was invalid. .El .Pp The .Fn fopen , -.Fn fdopen +.Fn fdopen , +.Fn freopen and -.Fn freopen +.Fn fmemopen functions may also fail and set .Va errno @@ -294,3 +322,8 @@ .Dq Li e mode option does not conform to any standard but is also supported by glibc. +The +.Fn fmemopen +function +conforms to +.St -p1003.1-2008 . ==== //depot/projects/ctsrd/beribsd/src/lib/libc/sys/__vdso_gettimeofday.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: head/lib/libc/sys/__vdso_gettimeofday.c 237434 2012-06-22 07:13:30Z kib $"); +__FBSDID("$FreeBSD: head/lib/libc/sys/__vdso_gettimeofday.c 246117 2013-01-30 12:48:16Z kib $"); #include #include @@ -79,6 +79,7 @@ static struct vdso_timekeep *tk; +#pragma weak __vdso_gettimeofday int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) { @@ -88,7 +89,7 @@ if (tz != NULL) return (ENOSYS); if (tk == NULL) { - error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk)); + error = __vdso_gettimekeep(&tk); if (error != 0 || tk == NULL) return (ENOSYS); } @@ -101,6 +102,7 @@ return (0); } +#pragma weak __vdso_clock_gettime int __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts) { ==== //depot/projects/ctsrd/beribsd/src/lib/libc/sys/gettimeofday.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: head/lib/libc/sys/gettimeofday.c 237434 2012-06-22 07:13:30Z kib $"); +__FBSDID("$FreeBSD: head/lib/libc/sys/gettimeofday.c 246117 2013-01-30 12:48:16Z kib $"); #include #include @@ -41,10 +41,7 @@ { int error; - if (__vdso_gettimeofday != NULL && __vdso_gettc != NULL) - error = __vdso_gettimeofday(tv, tz); - else - error = ENOSYS; + error = __vdso_gettimeofday(tv, tz); if (error == ENOSYS) error = __sys_gettimeofday(tv, tz); return (error); ==== //depot/projects/ctsrd/beribsd/src/libexec/tftpd/tftp-io.c#4 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-io.c 244686 2012-12-25 17:06:05Z antoine $"); +__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-io.c 246106 2013-01-30 01:36:04Z sbruno $"); #include #include @@ -142,7 +142,7 @@ char buf[MAXPKTSIZE]; if (debug&DEBUG_PACKETS) - tftp_log(LOG_DEBUG, "Sending ERROR %d: %s", error); + tftp_log(LOG_DEBUG, "Sending ERROR %d", error); DROPPACKET("send_error"); ==== //depot/projects/ctsrd/beribsd/src/sbin/devd/devd.8#3 (text+ko) ==== @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: head/sbin/devd/devd.8 228566 2011-12-16 10:21:01Z glebius $ +.\" $FreeBSD: head/sbin/devd/devd.8 246121 2013-01-30 15:21:18Z ian $ .\" .Dd November 24, 2005 .Dt DEVD 8 @@ -35,6 +35,7 @@ .Nm .Op Fl Ddn .Op Fl f Ar file +.Op Fl l Ar num .Sh DESCRIPTION The .Nm @@ -55,6 +56,12 @@ If option .Fl f is specified more than once, the last file specified is used. +.It Fl l Ar num +Limit concurrent +.Pa /var/run/devd.pipe +connections to +.Ar num . +The default connection limit is 10. .It Fl n Do not process all pending events before becoming a daemon. Instead, call daemon right away. ==== //depot/projects/ctsrd/beribsd/src/sbin/devd/devd.cc#5 (text+ko) ==== @@ -63,7 +63,7 @@ // - devd.conf needs more details on the supported statements. #include -__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 243932 2012-12-06 01:25:21Z eadler $"); +__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 246121 2013-01-30 15:21:18Z ian $"); #include #include @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -814,23 +815,58 @@ return (fd); } +unsigned int max_clients = 10; /* Default, can be overriden on cmdline. */ +unsigned int num_clients; list clients; void notify_clients(const char *data, int len) { - list bad; - list::const_iterator i; + list::iterator i; - for (i = clients.begin(); i != clients.end(); ++i) { - if (write(*i, data, len) <= 0) { - bad.push_back(*i); + /* + * Deliver the data to all clients. Throw clients overboard at the + * first sign of trouble. This reaps clients who've died or closed + * their sockets, and also clients who are alive but failing to keep up + * (or who are maliciously not reading, to consume buffer space in + * kernel memory or tie up the limited number of available connections). + */ + for (i = clients.begin(); i != clients.end(); ) { + if (write(*i, data, len) != len) { + --num_clients; close(*i); - } + i = clients.erase(i); + } else + ++i; } +} - for (i = bad.begin(); i != bad.end(); ++i) - clients.erase(find(clients.begin(), clients.end(), *i)); +void +check_clients(void) +{ + int s; + struct pollfd pfd; + list::iterator i; + + /* + * Check all existing clients to see if any of them have disappeared. + * Normally we reap clients when we get an error trying to send them an + * event. This check eliminates the problem of an ever-growing list of + * zombie clients because we're never writing to them on a system + * without frequent device-change activity. + */ + pfd.events = 0; + for (i = clients.begin(); i != clients.end(); ) { + pfd.fd = *i; + s = poll(&pfd, 1, 0); + if ((s < 0 && s != EINTR ) || + (s > 0 && (pfd.revents & POLLHUP))) { + --num_clients; + close(*i); + i = clients.erase(i); + } else + ++i; + } } void @@ -838,9 +874,18 @@ { int s; + /* + * First go reap any zombie clients, then accept the connection, and + * shut down the read side to stop clients from consuming kernel memory + * by sending large buffers full of data we'll never read. + */ + check_clients(); s = accept(fd, NULL, NULL); - if (s != -1) + if (s != -1) { + shutdown(s, SHUT_RD); clients.push_back(s); + ++num_clients; + } } static void @@ -851,6 +896,7 @@ char buffer[DEVCTL_MAXBUF]; int once = 0; int server_fd, max_fd; + int accepting; timeval tv; fd_set fds; @@ -858,6 +904,7 @@ if (fd == -1) err(1, "Can't open devctl device %s", PATH_DEVCTL); server_fd = create_socket(PIPE); + accepting = 1; max_fd = max(fd, server_fd) + 1; while (1) { if (romeo_must_die) @@ -880,15 +927,38 @@ once++; } } + /* + * When we've already got the max number of clients, stop + * accepting new connections (don't put server_fd in the set), + * shrink the accept() queue to reject connections quickly, and + * poll the existing clients more often, so that we notice more + * quickly when any of them disappear to free up client slots. + */ FD_ZERO(&fds); FD_SET(fd, &fds); - FD_SET(server_fd, &fds); - rv = select(max_fd, &fds, NULL, NULL, NULL); + if (num_clients < max_clients) { + if (!accepting) { + listen(server_fd, max_clients); + accepting = 1; + } + FD_SET(server_fd, &fds); + tv.tv_sec = 60; + tv.tv_usec = 0; + } else { + if (accepting) { + listen(server_fd, 0); + accepting = 0; + } + tv.tv_sec = 2; + tv.tv_usec = 0; + } + rv = select(max_fd, &fds, NULL, NULL, &tv); if (rv == -1) { if (errno == EINTR) continue; err(1, "select"); - } + } else if (rv == 0) + check_clients(); if (FD_ISSET(fd, &fds)) { rv = read(fd, buffer, sizeof(buffer) - 1); if (rv > 0) { @@ -1007,7 +1077,8 @@ static void usage() { - fprintf(stderr, "usage: %s [-Ddn] [-f file]\n", getprogname()); + fprintf(stderr, "usage: %s [-Ddn] [-l connlimit] [-f file]\n", + getprogname()); exit(1); } @@ -1036,7 +1107,7 @@ int ch; check_devd_enabled(); - while ((ch = getopt(argc, argv, "Ddf:n")) != -1) { + while ((ch = getopt(argc, argv, "Ddf:l:n")) != -1) { switch (ch) { case 'D': Dflag++; @@ -1047,6 +1118,9 @@ case 'f': configfile = optarg; break; + case 'l': + max_clients = MAX(1, strtoul(optarg, NULL, 0)); + break; case 'n': nflag++; break; ==== //depot/projects/ctsrd/beribsd/src/sys/amd64/include/vmm_instruction_emul.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/amd64/include/vmm_instruction_emul.h 245652 2013-01-19 04:18:52Z neel $ + * $FreeBSD: head/sys/amd64/include/vmm_instruction_emul.h 246108 2013-01-30 04:09:09Z neel $ */ #ifndef _VMM_INSTRUCTION_EMUL_H_ @@ -49,7 +49,8 @@ uint8_t rex_w:1, /* REX prefix */ rex_r:1, rex_x:1, - rex_b:1; + rex_b:1, + rex_present:1; uint8_t mod:2, /* ModRM byte */ reg:4, ==== //depot/projects/ctsrd/beribsd/src/sys/amd64/vmm/vmm_instruction_emul.c#2 (text+ko) ==== @@ -24,11 +24,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 243703 2012-11-30 05:40:24Z grehan $ + * $FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 246108 2013-01-30 04:09:09Z neel $ */ #include -__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 243703 2012-11-30 05:40:24Z grehan $"); +__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 246108 2013-01-30 04:09:09Z neel $"); #ifdef _KERNEL #include @@ -65,6 +65,10 @@ #define VIE_OP_F_IMM8 (1 << 1) /* 8-bit immediate operand */ static const struct vie_op one_byte_opcodes[256] = { + [0x88] = { + .op_byte = 0x88, + .op_type = VIE_OP_TYPE_MOV, + }, [0x89] = { .op_byte = 0x89, .op_type = VIE_OP_TYPE_MOV, @@ -161,6 +165,46 @@ } static int +vie_read_bytereg(void *vm, int vcpuid, struct vie *vie, uint8_t *rval) +{ + uint64_t val; + int error, rshift; + enum vm_reg_name reg; + + rshift = 0; + reg = gpr_map[vie->reg]; + + /* + * 64-bit mode imposes limitations on accessing legacy byte registers. + * + * The legacy high-byte registers cannot be addressed if the REX + * prefix is present. In this case the values 4, 5, 6 and 7 of the + * 'ModRM:reg' field address %spl, %bpl, %sil and %dil respectively. + * + * If the REX prefix is not present then the values 4, 5, 6 and 7 + * of the 'ModRM:reg' field address the legacy high-byte registers, + * %ah, %ch, %dh and %bh respectively. + */ + if (!vie->rex_present) { + if (vie->reg & 0x4) { + /* + * Obtain the value of %ah by reading %rax and shifting + * right by 8 bits (same for %bh, %ch and %dh). + */ + rshift = 8; + reg = gpr_map[vie->reg & 0x3]; + } + } + + if (!vie_valid_register(reg)) + return (EINVAL); + + error = vm_get_register(vm, vcpuid, reg, &val); + *rval = val >> rshift; + return (error); +} + +static int vie_update_register(void *vm, int vcpuid, enum vm_reg_name reg, uint64_t val, int size) { @@ -209,12 +253,24 @@ { int error, size; enum vm_reg_name reg; + uint8_t byte; uint64_t val; size = 4; error = EINVAL; switch (vie->op.op_byte) { + case 0x88: + /* + * MOV byte from reg (ModRM:reg) to mem (ModRM:r/m) + * 88/r: mov r/m8, r8 + * REX + 88/r: mov r/m8, r8 (%ah, %ch, %dh, %bh not available) + */ + size = 1; + error = vie_read_bytereg(vm, vcpuid, vie, &byte); + if (error == 0) + error = memwrite(vm, vcpuid, gpa, byte, size, arg); + break; case 0x89: /* * MOV from reg (ModRM:reg) to mem (ModRM:r/m) @@ -497,6 +553,8 @@ return (-1); if (x >= 0x40 && x <= 0x4F) { + vie->rex_present = 1; + vie->rex_w = x & 0x8 ? 1 : 0; vie->rex_r = x & 0x4 ? 1 : 0; vie->rex_x = x & 0x2 ? 1 : 0; ==== //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/at91dci.c#5 (text+ko) ==== @@ -1,6 +1,4 @@ -#include -__FBSDID("$FreeBSD: head/sys/dev/usb/controller/at91dci.c 241082 2012-10-01 05:42:43Z hselasky $"); - +/* $FreeBSD: head/sys/dev/usb/controller/at91dci.c 246125 2013-01-30 16:05:54Z hselasky $ */ /*- * Copyright (c) 2007-2008 Hans Petter Selasky. All rights reserved. * @@ -44,6 +42,9 @@ * endpoints, Function-address and more. */ +#ifdef USB_GLOBAL_INCLUDE_FILE +#include USB_GLOBAL_INCLUDE_FILE +#else #include #include #include @@ -79,6 +80,8 @@ #include #include +#endif /* USB_GLOBAL_INCLUDE_FILE */ + #include #define AT9100_DCI_BUS2SC(bus) \ @@ -1737,18 +1740,12 @@ .DeviceRemovable = {0}, /* port is removable */ }; -#define STRING_LANG \ - 0x09, 0x04, /* American English */ - #define STRING_VENDOR \ - 'A', 0, 'T', 0, 'M', 0, 'E', 0, 'L', 0 + "A\0T\0M\0E\0L" #define STRING_PRODUCT \ - 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "D\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B" -USB_MAKE_STRING_DESC(STRING_LANG, at91dci_langtab); USB_MAKE_STRING_DESC(STRING_VENDOR, at91dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, at91dci_product); @@ -1950,8 +1947,8 @@ case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ - len = sizeof(at91dci_langtab); - ptr = (const void *)&at91dci_langtab; + len = sizeof(usb_string_lang_en); + ptr = (const void *)&usb_string_lang_en; goto tr_valid; case 1: /* Vendor */ ==== //depot/projects/ctsrd/beribsd/src/sys/dev/usb/controller/atmegadci.c#4 (text+ko) ==== @@ -1,6 +1,4 @@ -#include -__FBSDID("$FreeBSD: head/sys/dev/usb/controller/atmegadci.c 241082 2012-10-01 05:42:43Z hselasky $"); - +/* $FreeBSD: head/sys/dev/usb/controller/atmegadci.c 246125 2013-01-30 16:05:54Z hselasky $ */ /*- * Copyright (c) 2009 Hans Petter Selasky. All rights reserved. * @@ -36,6 +34,9 @@ * endpoints, Function-address and more. */ +#ifdef USB_GLOBAL_INCLUDE_FILE +#include USB_GLOBAL_INCLUDE_FILE +#else #include #include #include @@ -71,6 +72,8 @@ #include #include +#endif /* USB_GLOBAL_INCLUDE_FILE */ + #include #define ATMEGA_BUS2SC(bus) \ @@ -1562,18 +1565,12 @@ .DeviceRemovable = {0}, /* port is removable */ }; -#define STRING_LANG \ - 0x09, 0x04, /* American English */ - #define STRING_VENDOR \ - 'A', 0, 'T', 0, 'M', 0, 'E', 0, 'G', 0, 'A', 0 + "A\0T\0M\0E\0G\0A" #define STRING_PRODUCT \ - 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "D\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B" -USB_MAKE_STRING_DESC(STRING_LANG, atmegadci_langtab); USB_MAKE_STRING_DESC(STRING_VENDOR, atmegadci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, atmegadci_product); @@ -1776,8 +1773,8 @@ case UDESC_STRING: switch (value & 0xff) { case 0: /* Language table */ >>> TRUNCATED FOR MAIL (1000 lines) <<<