CVS commit: src/sys/dev/acpi

2011-12-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Dec  9 08:56:55 UTC 2011

Modified Files:
src/sys/dev/acpi: mpu_acpi.c

Log Message:
provide a lock for mpu_attach.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/mpu_acpi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/mpu_acpi.c
diff -u src/sys/dev/acpi/mpu_acpi.c:1.12 src/sys/dev/acpi/mpu_acpi.c:1.13
--- src/sys/dev/acpi/mpu_acpi.c:1.12	Thu Nov 24 03:35:57 2011
+++ src/sys/dev/acpi/mpu_acpi.c	Fri Dec  9 08:56:54 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mpu_acpi.c,v 1.12 2011/11/24 03:35:57 mrg Exp $ */
+/* $NetBSD: mpu_acpi.c,v 1.13 2011/12/09 08:56:54 mrg Exp $ */
 
 /*
  * Copyright (c) 2002 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mpu_acpi.c,v 1.12 2011/11/24 03:35:57 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: mpu_acpi.c,v 1.13 2011/12/09 08:56:54 mrg Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -47,6 +47,7 @@ static void	mpu_acpi_attach(device_t, de
 
 struct mpu_acpi_softc {
 	struct mpu_softc sc_mpu;
+	kmutex_t sc_lock;
 };
 
 CFATTACH_DECL_NEW(mpu_acpi, sizeof(struct mpu_acpi_softc), mpu_acpi_match,
@@ -118,6 +119,8 @@ mpu_acpi_attach(device_t parent, device_
 
 	sc-model = Roland MPU-401 MIDI UART;
 	sc-sc_dev = self;
+	sc-lock = asc-sc_lock;
+	mutex_init(asc-sc_lock, MUTEX_DEFAULT, IPL_AUDIO);
 	mpu_attach(sc);
 
 	sc-arg = isa_intr_establish(aa-aa_ic, irq-ar_irq,



CVS commit: src/sys/arch/usermode/dev

2011-12-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec  9 09:27:14 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: ttycons.c

Log Message:
Remove empty lines in ttycons_consinit


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/dev/ttycons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/dev/ttycons.c
diff -u src/sys/arch/usermode/dev/ttycons.c:1.5 src/sys/arch/usermode/dev/ttycons.c:1.6
--- src/sys/arch/usermode/dev/ttycons.c:1.5	Sun Aug 28 21:21:05 2011
+++ src/sys/arch/usermode/dev/ttycons.c	Fri Dec  9 09:27:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ttycons.c,v 1.5 2011/08/28 21:21:05 jmcneill Exp $ */
+/* $NetBSD: ttycons.c,v 1.6 2011/12/09 09:27:13 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.5 2011/08/28 21:21:05 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.6 2011/12/09 09:27:13 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -99,8 +99,6 @@ ttycons_consinit(void)
 	cn_tab = ttycons_consdev;
 	cn_init_magic(ttycons_cnm_state);
 	cn_set_magic(\047\001);
-
-
 }
 
 int



CVS commit: src/sys/dev

2011-12-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Dec  9 09:47:39 UTC 2011

Modified Files:
src/sys/dev: TODO.audiomp

Log Message:
auvia reported to work


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/TODO.audiomp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/TODO.audiomp
diff -u src/sys/dev/TODO.audiomp:1.15 src/sys/dev/TODO.audiomp:1.16
--- src/sys/dev/TODO.audiomp:1.15	Fri Dec  9 05:06:57 2011
+++ src/sys/dev/TODO.audiomp	Fri Dec  9 09:47:39 2011
@@ -36,7 +36,7 @@ dev/pci/auacer.c		done
 dev/pci/auich.c			done		port-amd64, port-i386
 dev/pci/auixp.c			done		port-i386
 dev/pci/autri.c			done		port-sparc64
-dev/pci/auvia.c			done
+dev/pci/auvia.c			done		port-i386
 dev/pci/azalia.c		done		port-i386
 dev/pci/cmpci.c			done
 dev/pci/cs4280.c		done		port-i386



CVS commit: src/sys/arch/x86/include

2011-12-09 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Fri Dec  9 10:08:47 UTC 2011

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
add AMD ucode MSRs


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/x86/include/specialreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.53 src/sys/arch/x86/include/specialreg.h:1.54
--- src/sys/arch/x86/include/specialreg.h:1.53	Mon Oct  3 17:31:35 2011
+++ src/sys/arch/x86/include/specialreg.h	Fri Dec  9 10:08:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.53 2011/10/03 17:31:35 njoly Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.54 2011/12/09 10:08:47 cegger Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -503,6 +503,8 @@
 /* AMD Family10h MSRs */
 #define	MSR_OSVW_ID_LENGTH		0xc0010140
 #define	MSR_OSVW_STATUS			0xc0010141
+#define	MSR_UCODE_AMD_PATCHLEVEL	0x008b
+#define	MSR_UCODE_AMD_PATCHLOADER	0xc0010020
 
 /* X86 MSRs */
 #define	MSR_RDTSCP_AUX			0xc103



CVS commit: src/sys/arch/xen/include/xen-public/arch-x86

2011-12-09 Thread Christoph Egger
Module Name:src
Committed By:   cegger
Date:   Fri Dec  9 10:14:20 UTC 2011

Modified Files:
src/sys/arch/xen/include/xen-public/arch-x86: xen.h

Log Message:
re-apply merge loss


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 \
src/sys/arch/xen/include/xen-public/arch-x86/xen.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/include/xen-public/arch-x86/xen.h
diff -u src/sys/arch/xen/include/xen-public/arch-x86/xen.h:1.1.1.2 src/sys/arch/xen/include/xen-public/arch-x86/xen.h:1.2
--- src/sys/arch/xen/include/xen-public/arch-x86/xen.h:1.1.1.2	Wed Dec  7 14:41:17 2011
+++ src/sys/arch/xen/include/xen-public/arch-x86/xen.h	Fri Dec  9 10:14:20 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: xen.h,v 1.1.1.2 2011/12/07 14:41:17 cegger Exp $ */
+/* $NetBSD: xen.h,v 1.2 2011/12/09 10:14:20 cegger Exp $ */
 /**
  * arch-x86/xen.h
  * 
@@ -46,10 +46,14 @@
 #define __XEN_GUEST_HANDLE(name)__guest_handle_ ## name
 #define XEN_GUEST_HANDLE(name)  __XEN_GUEST_HANDLE(name)
 #define set_xen_guest_handle_raw(hnd, val)  do { (hnd).p = val; } while (0)
-#ifdef __XEN_TOOLS__
+
+#if __XEN_INTERFACE_VERSION__ = 0x00030201
+#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
+#else
+#define set_xen_guest_handle(hnd, val)  (hnd) = val
+#define get_xen_guest_handle(val, hnd)  val = (hnd)
 #endif
-#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
 
 #if defined(__i386__)
 #include xen-x86_32.h



CVS commit: src/share/man/man9

2011-12-09 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Fri Dec  9 10:58:51 UTC 2011

Modified Files:
src/share/man/man9: secmodel_extensions.9

Log Message:
Kill extra El macro.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man9/secmodel_extensions.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/secmodel_extensions.9
diff -u src/share/man/man9/secmodel_extensions.9:1.1 src/share/man/man9/secmodel_extensions.9:1.2
--- src/share/man/man9/secmodel_extensions.9:1.1	Sun Dec  4 21:08:45 2011
+++ src/share/man/man9/secmodel_extensions.9	Fri Dec  9 10:58:51 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: secmodel_extensions.9,v 1.1 2011/12/04 21:08:45 jym Exp $
+.\ $NetBSD: secmodel_extensions.9,v 1.2 2011/12/09 10:58:51 njoly Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -106,7 +106,6 @@ It can be disabled at any time, but cann
 anymore when the
 .Em securelevel
 of the system is above 0.
-.El
 .Sh SEE ALSO
 .Xr affinity 3 ,
 .Xr sched 3 ,



CVS commit: src/sys/arch/xen/xen

2011-12-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Fri Dec  9 11:47:49 UTC 2011

Modified Files:
src/sys/arch/xen/xen: hypervisor.c

Log Message:
Move events/interrupt subsystem initialisation to before when ipis are used


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/xen/xen/hypervisor.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.59 src/sys/arch/xen/xen/hypervisor.c:1.60
--- src/sys/arch/xen/xen/hypervisor.c:1.59	Wed Dec  7 15:47:43 2011
+++ src/sys/arch/xen/xen/hypervisor.c	Fri Dec  9 11:47:49 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.59 2011/12/07 15:47:43 cegger Exp $ */
+/* $NetBSD: hypervisor.c,v 1.60 2011/12/09 11:47:49 cherry Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.59 2011/12/07 15:47:43 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: hypervisor.c,v 1.60 2011/12/09 11:47:49 cherry Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -217,6 +217,7 @@ hypervisor_attach(device_t parent, devic
 	   xen_version  0x);
 
 	xengnt_init();
+	events_init();
 
 	memset(hac, 0, sizeof(hac));
 	hac.hac_vcaa.vcaa_name = vcpu;
@@ -248,7 +249,6 @@ hypervisor_attach(device_t parent, devic
 	}
 
 #endif /* MULTIPROCESSOR */
-	events_init();
 
 #if NXENBUS  0
 	memset(hac, 0, sizeof(hac));



CVS commit: src/usr.bin/fincore

2011-12-09 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Dec  9 15:17:34 UTC 2011

Added Files:
src/usr.bin/fincore: Makefile fincore.1 fincore.c

Log Message:
a utility to show in-core status of file pages


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/fincore/Makefile \
src/usr.bin/fincore/fincore.1 src/usr.bin/fincore/fincore.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/usr.bin/fincore/Makefile
diff -u /dev/null src/usr.bin/fincore/Makefile:1.1
--- /dev/null	Fri Dec  9 15:17:35 2011
+++ src/usr.bin/fincore/Makefile	Fri Dec  9 15:17:34 2011
@@ -0,0 +1,5 @@
+#	$NetBSD: Makefile,v 1.1 2011/12/09 15:17:34 yamt Exp $
+
+PROG=	fincore
+
+.include bsd.prog.mk
Index: src/usr.bin/fincore/fincore.1
diff -u /dev/null src/usr.bin/fincore/fincore.1:1.1
--- /dev/null	Fri Dec  9 15:17:35 2011
+++ src/usr.bin/fincore/fincore.1	Fri Dec  9 15:17:34 2011
@@ -0,0 +1,103 @@
+.\	$NetBSD: fincore.1,v 1.1 2011/12/09 15:17:34 yamt Exp $
+.\
+.\ Copyright (c)2011 YAMAMOTO Takashi,
+.\ 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.
+.\
+.\ 
+.Dd December 9, 2011
+.Dt FINCORE 1
+.Os
+.\ 
+.Sh NAME
+.Nm fincore
+.Nd query in-core status of file pages
+.\ 
+.Sh SYNOPSIS
+.Nm
+.Op Fl qs
+.Ar file ...
+.\ 
+.Sh DESCRIPTION
+The
+.Nm
+utility queries and displays in-core status of specified files.
+.Pp
+Note that the result can already be stale when being output due to other
+activities in the system.
+Thus it should be used only for advisary purposes.
+.Pp
+The
+.Nm
+utility accepts the following options.
+.Bl -tag -width hogehoge
+.It Fl q
+The quiet mode.
+Outputs nothing unless the file has in-core pages.
+.It Fl s
+The summary mode.
+Only shows number of pages.
+.El
+.\ 
+.Sh EXAMPLES
+The following example shows that /bin/cat and /bin/cp are fully cached in-core
+while the other executables are not in-core.
+numbers shown in the default output are page indexes in the file of
+each in-core pages.
+.Bd -literal
+% fincore /bin/c*
+/bin/cat: 0 1 2 3
+/bin/chio:
+/bin/chmod:
+/bin/cp: 0 1 2 3 4 5
+/bin/cpio:
+/bin/csh:
+% fincore -s /bin/c*
+/bin/cat: 4 / 4 in-core pages (100.00%)
+/bin/chio: 0 / 5 in-core pages (0.00%)
+/bin/chmod: 0 / 3 in-core pages (0.00%)
+/bin/cp: 6 / 6 in-core pages (100.00%)
+/bin/cpio: 0 / 36 in-core pages (0.00%)
+/bin/csh: 0 / 41 in-core pages (0.00%)
+.Ed
+.\ 
+.\.Sh HISTORY
+.\The
+.\.Nm
+.\utility first appeared in
+.\.Nx XXX .
+.\ 
+.\.Sh SEE ALSO
+.\.Xr XXX
+.\ 
+.Sh AUTHORS
+The
+.Nm
+utility is written by
+.An YAMAMOTO Takashi .
+.\ 
+.Sh BUGS
+The amount of CPU time the current implementation of
+.Nm
+utility would take is roughly proportional to the file sizes.
+Ideally it should be proportional to the number of in-core pages.
Index: src/usr.bin/fincore/fincore.c
diff -u /dev/null src/usr.bin/fincore/fincore.c:1.1
--- /dev/null	Fri Dec  9 15:17:35 2011
+++ src/usr.bin/fincore/fincore.c	Fri Dec  9 15:17:34 2011
@@ -0,0 +1,211 @@
+/*	$NetBSD: fincore.c,v 1.1 2011/12/09 15:17:34 yamt Exp $	*/
+
+/*-
+ * Copyright (c) 2011 YAMAMOTO Takashi,
+ * All rights reserved.
+ *
+ * 

CVS commit: src/usr.bin/tpfmt

2011-12-09 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Dec  9 15:24:39 UTC 2011

Modified Files:
src/usr.bin/tpfmt: tpfmt.1

Log Message:
- fix the section
- fix a warning


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/tpfmt/tpfmt.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/tpfmt/tpfmt.1
diff -u src/usr.bin/tpfmt/tpfmt.1:1.2 src/usr.bin/tpfmt/tpfmt.1:1.3
--- src/usr.bin/tpfmt/tpfmt.1:1.2	Sat Nov 26 22:47:39 2011
+++ src/usr.bin/tpfmt/tpfmt.1	Fri Dec  9 15:24:39 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: tpfmt.1,v 1.2 2011/11/26 22:47:39 wiz Exp $
+.\	$NetBSD: tpfmt.1,v 1.3 2011/12/09 15:24:39 yamt Exp $
 .\
 .\ Copyright (c)2011 YAMAMOTO Takashi,
 .\ All rights reserved.
@@ -26,7 +26,7 @@
 .\
 .\ 
 .Dd November 27, 2011
-.Dt TPFMT 8
+.Dt TPFMT 1
 .Os
 .\ 
 .Sh NAME
@@ -77,11 +77,11 @@ See
 .Xr tprof 8
 for an example.
 .\ 
-.\.Sh HISTORY
-.\The
-.\.Nm
-.\utility first appeared in
-.\.Nx XXX .
+.\.Sh HISTORY
+.\The
+.\.Nm
+.\utility first appeared in
+.\.Nx XXX .
 .\ 
 .Sh SEE ALSO
 .Xr tprof 4 ,



CVS commit: src/usr.sbin/tprof

2011-12-09 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Dec  9 15:26:48 UTC 2011

Modified Files:
src/usr.sbin/tprof: tprof.8

Log Message:
- add a CAVEATS
- fix a warning


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/tprof.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/tprof/tprof.8
diff -u src/usr.sbin/tprof/tprof.8:1.2 src/usr.sbin/tprof/tprof.8:1.3
--- src/usr.sbin/tprof/tprof.8:1.2	Sat Nov 26 22:49:37 2011
+++ src/usr.sbin/tprof/tprof.8	Fri Dec  9 15:26:48 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: tprof.8,v 1.2 2011/11/26 22:49:37 wiz Exp $
+.\	$NetBSD: tprof.8,v 1.3 2011/12/09 15:26:48 yamt Exp $
 .\
 .\ Copyright (c)2011 YAMAMOTO Takashi,
 .\ All rights reserved.
@@ -98,11 +98,11 @@ The number of samples dropped because th
 were dropped.
 .El
 .\ 
-.\.Sh HISTORY
-.\The
-.\.Nm
-.\utility first appeared in
-.\.Nx XXX .
+.\.Sh HISTORY
+.\The
+.\.Nm
+.\utility first appeared in
+.\.Nx XXX .
 .\ 
 .Sh SEE ALSO
 .Xr tpfmt 1 ,
@@ -113,3 +113,9 @@ The
 .Nm
 utility is written by
 .An YAMAMOTO Takashi .
+.\ 
+.Sh CAVEATS
+The contents and representation of recorded samples are undocumented and
+will likely be changed for future releases of
+.Nx
+in an incompatible way.



CVS commit: src/sys/arch/usermode/usermode

2011-12-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec  9 17:20:21 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: syscall.c

Log Message:
Enhance printing of system callss


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/usermode/syscall.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/usermode/syscall.c
diff -u src/sys/arch/usermode/usermode/syscall.c:1.11 src/sys/arch/usermode/usermode/syscall.c:1.12
--- src/sys/arch/usermode/usermode/syscall.c:1.11	Sun Nov 27 21:38:17 2011
+++ src/sys/arch/usermode/usermode/syscall.c	Fri Dec  9 17:20:21 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.11 2011/11/27 21:38:17 reinoud Exp $ */
+/* $NetBSD: syscall.c,v 1.12 2011/12/09 17:20:21 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.11 2011/11/27 21:38:17 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.12 2011/12/09 17:20:21 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -106,10 +106,24 @@ syscall(void)
 	if (code != 4) {
 		printf(code %3d, nargs %d, argsize %3d\t%s(, 
 			code, nargs, argsize, syscallnames[code]);
-		for (int i = 0; i  nargs; i++)
-			printf(%PRIx32, , (uint) args[i]);
-		if (nargs)
-			printf(\b\b);
+		switch (code) {
+		case 5:
+			printf(\%s\, %PRIx32, %PRIx32, (char *) (args[0]), (uint) args[1], (uint) args[2]);
+			break;
+		case 33:
+			printf(\%s\, %PRIx32, (char *) (args[0]), (uint) args[1]);
+			break;
+		case 50:
+			printf(\%s\, (char *) (args[0]));
+			break;
+		case 58:
+			printf(\%s\, %PRIx32, %PRIx32, (char *) (args[0]), (uint) (args[1]), (uint) args[2]);
+		default:
+			for (int i = 0; i  nargs; i++)
+printf(%PRIx32, , (uint) args[i]);
+			if (nargs)
+printf(\b\b);
+		}
 		printf() );
 	}
 #if 0
@@ -118,10 +132,10 @@ syscall(void)
 	dprintf_debug(syscall no. %d, , code);
 	dprintf_debug(nargs %d, argsize %d =  , nargs, argsize);
 #endif
-#if 0
+#if 1
 	if ((code == 4)) {
 		dprintf_debug([us] %s, (char *) args[1]);
-		printf([us] %s, (char *) args[1]);
+//		printf([us] %s, (char *) args[1]);
 	}
 #endif
 	if (code == 440)



CVS commit: src/sys/arch/usermode/dev

2011-12-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec  9 17:21:45 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: ld_thunkbus.c

Log Message:
Disable aio usage in thunkbus_ld since mixing ucontext_t and threads is a NONO
according to the manpage.

Why is AIO using a pthread?


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/usermode/dev/ld_thunkbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/dev/ld_thunkbus.c
diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.19 src/sys/arch/usermode/dev/ld_thunkbus.c:1.20
--- src/sys/arch/usermode/dev/ld_thunkbus.c:1.19	Sun Nov 27 21:22:28 2011
+++ src/sys/arch/usermode/dev/ld_thunkbus.c	Fri Dec  9 17:21:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.19 2011/11/27 21:22:28 reinoud Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.20 2011/12/09 17:21:45 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.19 2011/11/27 21:22:28 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.20 2011/12/09 17:21:45 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -50,7 +50,7 @@ static int	ld_thunkbus_ldstart(struct ld
 static int	ld_thunkbus_lddump(struct ld_softc *, void *, int, int);
 static int	ld_thunkbus_ldflush(struct ld_softc *, int);
 
-#define LD_USE_AIO
+//#define LD_USE_AIO
 
 #ifdef LD_USE_AIO
 static void	ld_thunkbus_sig(int, siginfo_t *, void *);



CVS commit: src/sys/arch/usermode/dev

2011-12-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec  9 17:23:33 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: clock.c

Log Message:
Restructure dev/clock to run from the signal stack since its safe to do now.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/usermode/dev/clock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/dev/clock.c
diff -u src/sys/arch/usermode/dev/clock.c:1.20 src/sys/arch/usermode/dev/clock.c:1.21
--- src/sys/arch/usermode/dev/clock.c:1.20	Sat Sep 17 21:38:15 2011
+++ src/sys/arch/usermode/dev/clock.c	Fri Dec  9 17:23:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.20 2011/09/17 21:38:15 reinoud Exp $ */
+/* $NetBSD: clock.c,v 1.21 2011/12/09 17:23:33 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,15 +27,19 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.20 2011/09/17 21:38:15 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.21 2011/12/09 17:23:33 reinoud Exp $);
 
 #include sys/param.h
 #include sys/proc.h
 #include sys/systm.h
 #include sys/device.h
+#include sys/lwp.h
+#include sys/cpu.h
+#include sys/malloc.h
 #include sys/timetc.h
 #include sys/time.h
 
+#include machine/pcb.h
 #include machine/mainbus.h
 #include machine/thunk.h
 
@@ -44,6 +48,7 @@ __KERNEL_RCSID(0, $NetBSD: clock.c,v 1.
 static int	clock_match(device_t, cfdata_t, void *);
 static void	clock_attach(device_t, device_t, void *);
 
+static void	clock(void);
 static void	clock_signal(int sig, siginfo_t *info, void *ctx);
 static unsigned int clock_getcounter(struct timecounter *);
 
@@ -67,6 +72,8 @@ static struct timecounter clock_timecoun
 
 static struct clock_softc *clock_sc;
 
+
+
 CFATTACH_DECL_NEW(clock, sizeof(clock_softc_t),
 clock_match, clock_attach, NULL, NULL);
 
@@ -102,7 +109,7 @@ clock_attach(device_t parent, device_t s
 	memset(sa, 0, sizeof(sa));
 	thunk_sigemptyset(sa.sa_mask);
 	sa.sa_sigaction = clock_signal;
-	sa.sa_flags = SA_SIGINFO;
+	sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
 	if (thunk_sigaction(SIGALRM, sa, NULL) == -1)
 		panic(couldn't register SIGALRM handler : %d,
 		thunk_geterrno());
@@ -116,18 +123,33 @@ clock_attach(device_t parent, device_t s
 }
 
 static void
-clock_signal(int sig, siginfo_t *info, void *ctx)
+clock(void)
 {
 	struct clockframe cf;
 
 	curcpu()-ci_idepth++;
-
 	spl_intr(IPL_SOFTCLOCK, (void (*)(void *)) hardclock, cf);
-	// hardclock(cf);
-
 	curcpu()-ci_idepth--;
 }
 
+static void
+clock_signal(int sig, siginfo_t *info, void *ctx)
+{
+#if 0
+	ucontext_t *uct = ctx;
+	struct lwp *l;
+	struct pcb *pcb;
+
+	l = curlwp;
+	pcb = lwp_getpcb(l);
+
+	/* copy this state as where the lwp was XXX NEEDED? */
+	memcpy(pcb-pcb_ucp, uct, sizeof(ucontext_t));
+#endif
+
+	clock();
+}
+
 static unsigned int
 clock_getcounter(struct timecounter *tc)
 {



CVS commit: src/sys/arch/usermode/usermode

2011-12-09 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Dec  9 17:24:25 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: copy.c

Log Message:
Disabled copyin/copyout debugging messages since its swamping the output on
debug output.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/usermode/copy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/usermode/copy.c
diff -u src/sys/arch/usermode/usermode/copy.c:1.5 src/sys/arch/usermode/usermode/copy.c:1.6
--- src/sys/arch/usermode/usermode/copy.c:1.5	Sat Aug 27 17:57:14 2011
+++ src/sys/arch/usermode/usermode/copy.c	Fri Dec  9 17:24:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: copy.c,v 1.5 2011/08/27 17:57:14 reinoud Exp $ */
+/* $NetBSD: copy.c,v 1.6 2011/12/09 17:24:25 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: copy.c,v 1.5 2011/08/27 17:57:14 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: copy.c,v 1.6 2011/12/09 17:24:25 reinoud Exp $);
 
 #include sys/types.h
 #include sys/systm.h
@@ -38,7 +38,7 @@ __KERNEL_RCSID(0, $NetBSD: copy.c,v 1.5
 int
 copyin(const void *uaddr, void *kaddr, size_t len)
 {
-	aprint_debug(copyin uaddr %p, kaddr %p, len %d\n, uaddr, kaddr, (int) len);
+//	aprint_debug(copyin uaddr %p, kaddr %p, len %d\n, uaddr, kaddr, (int) len);
 	memcpy(kaddr, uaddr, len);
 	return 0;
 }
@@ -46,7 +46,7 @@ copyin(const void *uaddr, void *kaddr, s
 int
 copyout(const void *kaddr, void *uaddr, size_t len)
 {
-	aprint_debug(copyout kaddr %p, uaddr %p, len %d\n, kaddr, uaddr, (int) len);
+//	aprint_debug(copyout kaddr %p, uaddr %p, len %d\n, kaddr, uaddr, (int) len);
 	memcpy(uaddr, kaddr, len);
 	return 0;
 }



CVS commit: src/sys/arch/x86/x86

2011-12-09 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Dec  9 17:32:51 UTC 2011

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
only use PG_G on leaf PTEs.
go back to tlbflush(), all the global entries
that we create in pmap_bootstrap() are permanent.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/arch/x86/x86/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.146 src/sys/arch/x86/x86/pmap.c:1.147
--- src/sys/arch/x86/x86/pmap.c:1.146	Thu Dec  8 22:36:42 2011
+++ src/sys/arch/x86/x86/pmap.c	Fri Dec  9 17:32:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.146 2011/12/08 22:36:42 rmind Exp $	*/
+/*	$NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.146 2011/12/08 22:36:42 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.147 2011/12/09 17:32:51 chs Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1365,13 +1365,13 @@ pmap_bootstrap(vaddr_t kva_start)
 
 			pde = (pd_entry_t *)(tmpva + (pdp  ~PG_FRAME));
 			*pde = (dmpd + (i  PAGE_SHIFT)) |
-PG_RW | PG_V | PG_U | PG_G;
+PG_RW | PG_V | PG_U;
 		}
 	}
 
 	kpm-pm_pdir[PDIR_SLOT_DIRECT] = dmpdp | PG_KW | PG_V | PG_U;
 
-	tlbflushg();
+	tlbflush();
 
 #else
 	if (VM_MIN_KERNEL_ADDRESS != KERNBASE) {



CVS commit: src/usr.bin/fincore

2011-12-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Dec  9 19:15:12 UTC 2011

Modified Files:
src/usr.bin/fincore: fincore.1

Log Message:
Fix typo. Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/fincore/fincore.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/fincore/fincore.1
diff -u src/usr.bin/fincore/fincore.1:1.1 src/usr.bin/fincore/fincore.1:1.2
--- src/usr.bin/fincore/fincore.1:1.1	Fri Dec  9 15:17:34 2011
+++ src/usr.bin/fincore/fincore.1	Fri Dec  9 19:15:11 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: fincore.1,v 1.1 2011/12/09 15:17:34 yamt Exp $
+.\	$NetBSD: fincore.1,v 1.2 2011/12/09 19:15:11 wiz Exp $
 .\
 .\ Copyright (c)2011 YAMAMOTO Takashi,
 .\ All rights reserved.
@@ -45,7 +45,7 @@ utility queries and displays in-core sta
 .Pp
 Note that the result can already be stale when being output due to other
 activities in the system.
-Thus it should be used only for advisary purposes.
+Thus it should be used only for advisory purposes.
 .Pp
 The
 .Nm
@@ -60,7 +60,11 @@ Only shows number of pages.
 .El
 .\ 
 .Sh EXAMPLES
-The following example shows that /bin/cat and /bin/cp are fully cached in-core
+The following example shows that
+.Pa /bin/cat
+and
+.Pa /bin/cp
+are fully cached in-core
 while the other executables are not in-core.
 numbers shown in the default output are page indexes in the file of
 each in-core pages.



CVS commit: src/sys/dev/mii

2011-12-09 Thread Brian Buhrow
Module Name:src
Committed By:   buhrow
Date:   Sat Dec 10 02:46:07 UTC 2011

Modified Files:
src/sys/dev/mii: mii_physubr.c

Log Message:
Fixes PR kern/20700 reported by Darcy Cain

Make 1000baset connections work even when the user specifies media 1000baset
connections with ifconfig(8) rather then only when media auto is specified.

For a further discussion of this fix, see:
http://mail-index.NetBSD.org/current-users/2011/12/07/msg018561.html


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/mii/mii_physubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.72 src/sys/dev/mii/mii_physubr.c:1.73
--- src/sys/dev/mii/mii_physubr.c:1.72	Sat Aug 21 13:18:35 2010
+++ src/sys/dev/mii/mii_physubr.c	Sat Dec 10 02:46:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.72 2010/08/21 13:18:35 pgoyette Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.73 2011/12/10 02:46:07 buhrow Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mii_physubr.c,v 1.72 2010/08/21 13:18:35 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: mii_physubr.c,v 1.73 2011/12/10 02:46:07 buhrow Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -186,15 +186,21 @@ mii_phy_setmedia(struct mii_softc *sc)
 		bmcr |= BMCR_LOOP;
 
 	PHY_WRITE(sc, MII_ANAR, anar);
-	PHY_WRITE(sc, MII_BMCR, bmcr);
 	if (sc-mii_flags  MIIF_HAVE_GTCR)
 		PHY_WRITE(sc, MII_100T2CR, gtcr);
+	if (IFM_SUBTYPE(ife-ifm_media) == IFM_1000_T) {
+		mii_phy_auto(sc, 0);
+	} else {
+		PHY_WRITE(sc, MII_BMCR, bmcr);
+	}
 }
 
 int
 mii_phy_auto(struct mii_softc *sc, int waitfor)
 {
 	int i;
+	struct mii_data *mii = sc-mii_pdata;
+	struct ifmedia_entry *ife = mii-mii_media.ifm_cur;
 
 	if ((sc-mii_flags  MIIF_DOINGAUTO) == 0) {
 		/*
@@ -228,6 +234,16 @@ mii_phy_auto(struct mii_softc *sc, int w
  (EXTSR_1000THDX|EXTSR_1000TFDX)))
 	anar |= ANAR_X_PAUSE_ASYM;
 			}
+
+			/*
+			 *for 1000-base-T, autonegotiation mus be enabled, but 
+			 *if we're not set to auto, only advertise
+			 *1000-base-T with the link partner.
+			 */
+			if (IFM_SUBTYPE(ife-ifm_media) == IFM_1000_T) {
+anar = ~(ANAR_T4|ANAR_TX_FD|ANAR_TX|ANAR_10_FD|ANAR_10);
+			}
+
 			PHY_WRITE(sc, MII_ANAR, anar);
 			if (sc-mii_flags  MIIF_HAVE_GTCR) {
 uint16_t gtcr = 0;
@@ -310,7 +326,8 @@ mii_phy_tick(struct mii_softc *sc)
 	 * status so we can generate an announcement if the status
 	 * changes.
 	 */
-	if (IFM_SUBTYPE(ife-ifm_media) != IFM_AUTO)
+	if ((IFM_SUBTYPE(ife-ifm_media) != IFM_AUTO) 
+	(IFM_SUBTYPE(ife-ifm_media) != IFM_1000_T))
 		return (0);
 
 	/* Read the status register twice; BMSR_LINK is latch-low. */



CVS commit: src/usr.bin/ftp

2011-12-09 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Sat Dec 10 05:53:59 UTC 2011

Modified Files:
src/usr.bin/ftp: fetch.c ftp.c main.c util.c

Log Message:
Move determination of socket buffer sizes from startup to the first
time a socket is used, as the previous logic assumed AF_INET sockets
were available (which they may not be in an IPv6-only system).
Per discussion with Maxim Konovalov and the FreeBSD problem 162661.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 src/usr.bin/ftp/fetch.c
cvs rdiff -u -r1.162 -r1.163 src/usr.bin/ftp/ftp.c
cvs rdiff -u -r1.119 -r1.120 src/usr.bin/ftp/main.c
cvs rdiff -u -r1.155 -r1.156 src/usr.bin/ftp/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.194 src/usr.bin/ftp/fetch.c:1.195
--- src/usr.bin/ftp/fetch.c:1.194	Fri Sep 16 15:39:26 2011
+++ src/usr.bin/ftp/fetch.c	Sat Dec 10 05:53:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fetch.c,v 1.194 2011/09/16 15:39:26 joerg Exp $	*/
+/*	$NetBSD: fetch.c,v 1.195 2011/12/10 05:53:58 lukem Exp $	*/
 
 /*-
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: fetch.c,v 1.194 2011/09/16 15:39:26 joerg Exp $);
+__RCSID($NetBSD: fetch.c,v 1.195 2011/12/10 05:53:58 lukem Exp $);
 #endif /* not lint */
 
 /*
@@ -52,6 +52,7 @@ __RCSID($NetBSD: fetch.c,v 1.194 2011/0
 #include arpa/ftp.h
 #include arpa/inet.h
 
+#include assert.h
 #include ctype.h
 #include err.h
 #include errno.h
@@ -1125,6 +1126,7 @@ fetch_url(const char *url, const char *p
 	(void)xsignal(SIGQUIT, psummary);
 	oldintr = xsignal(SIGINT, aborthttp);
 
+	assert(rcvbuf_size  0);
 	if ((size_t)rcvbuf_size  bufsize) {
 		if (xferbuf)
 			(void)free(xferbuf);

Index: src/usr.bin/ftp/ftp.c
diff -u src/usr.bin/ftp/ftp.c:1.162 src/usr.bin/ftp/ftp.c:1.163
--- src/usr.bin/ftp/ftp.c:1.162	Fri Sep 16 15:39:26 2011
+++ src/usr.bin/ftp/ftp.c	Sat Dec 10 05:53:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ftp.c,v 1.162 2011/09/16 15:39:26 joerg Exp $	*/
+/*	$NetBSD: ftp.c,v 1.163 2011/12/10 05:53:58 lukem Exp $	*/
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
 #if 0
 static char sccsid[] = @(#)ftp.c	8.6 (Berkeley) 10/27/94;
 #else
-__RCSID($NetBSD: ftp.c,v 1.162 2011/09/16 15:39:26 joerg Exp $);
+__RCSID($NetBSD: ftp.c,v 1.163 2011/12/10 05:53:58 lukem Exp $);
 #endif
 #endif /* not lint */
 
@@ -108,6 +108,7 @@ __RCSID($NetBSD: ftp.c,v 1.162 2011/09/
 #include arpa/ftp.h
 #include arpa/telnet.h
 
+#include assert.h
 #include ctype.h
 #include err.h
 #include errno.h
@@ -765,6 +766,7 @@ sendrequest(const char *cmd, const char 
 	if (dout == NULL)
 		goto abort;
 
+	assert(sndbuf_size  0);
 	if ((size_t)sndbuf_size  bufsize) {
 		if (buf)
 			(void)free(buf);
@@ -1026,6 +1028,7 @@ recvrequest(const char *cmd, const char 
 		progress = 0;
 		preserve = 0;
 	}
+	assert(rcvbuf_size  0);
 	if ((size_t)rcvbuf_size  bufsize) {
 		if (buf)
 			(void)free(buf);

Index: src/usr.bin/ftp/main.c
diff -u src/usr.bin/ftp/main.c:1.119 src/usr.bin/ftp/main.c:1.120
--- src/usr.bin/ftp/main.c:1.119	Fri Sep 16 15:39:26 2011
+++ src/usr.bin/ftp/main.c	Sat Dec 10 05:53:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.119 2011/09/16 15:39:26 joerg Exp $	*/
+/*	$NetBSD: main.c,v 1.120 2011/12/10 05:53:58 lukem Exp $	*/
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@ __COPYRIGHT(@(#) Copyright (c) 1985, 19
 #if 0
 static char sccsid[] = @(#)main.c	8.6 (Berkeley) 10/9/94;
 #else
-__RCSID($NetBSD: main.c,v 1.119 2011/09/16 15:39:26 joerg Exp $);
+__RCSID($NetBSD: main.c,v 1.120 2011/12/10 05:53:58 lukem Exp $);
 #endif
 #endif /* not lint */
 
@@ -139,9 +139,8 @@ main(int volatile argc, char **volatile 
 	struct passwd *pw;
 	char *cp, *ep, *anonpass, *upload_path, *src_addr;
 	const char *anonuser;
-	int dumbterm, s, isupload;
+	int dumbterm, isupload;
 	size_t len;
-	socklen_t slen;
 
 	tzset();
 	setlocale(LC_ALL, );
@@ -204,35 +203,6 @@ main(int volatile argc, char **volatile 
 	if (cp != NULL  strlcpy(netrc, cp, sizeof(netrc)) = sizeof(netrc))
 		errx(1, $NETRC `%s': %s, cp, strerror(ENAMETOOLONG));
 
-	/*
-	 * Get the default socket buffer sizes if we don't already have them.
-	 * It doesn't matter which socket we do this to, because on the first
-	 * call no socket buffer sizes will have been modified, so we are
-	 * guaranteed to get the system defaults.
-	 */
-	s = socket(AF_INET, SOCK_STREAM, 0);
-	if (s == -1)
-		err(1, Can't create socket to determine default socket sizes);
-	slen = sizeof(rcvbuf_size);
-	if (getsockopt(s, SOL_SOCKET, SO_RCVBUF,
-	(void *)rcvbuf_size, slen) == -1)
-		err(1, Unable to get default rcvbuf size);
-	slen = sizeof(sndbuf_size);
-	if (getsockopt(s, SOL_SOCKET, SO_SNDBUF,
-	(void *)sndbuf_size, slen) == -1)
-		err(1, Unable to get default sndbuf size);
-