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

2011-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct 21 10:10:28 UTC 2011

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

Log Message:
synchronize the guest clock with the host on attach and resume


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/x86/vmt.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/vmt.c
diff -u src/sys/arch/x86/x86/vmt.c:1.6 src/sys/arch/x86/x86/vmt.c:1.7
--- src/sys/arch/x86/x86/vmt.c:1.6	Thu Oct 20 20:13:55 2011
+++ src/sys/arch/x86/x86/vmt.c	Fri Oct 21 10:10:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vmt.c,v 1.6 2011/10/20 20:13:55 jmcneill Exp $ */
+/* $NetBSD: vmt.c,v 1.7 2011/10/21 10:10:28 jmcneill Exp $ */
 /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */
 
 /*
@@ -34,6 +34,7 @@
 #include sys/syslog.h
 #include sys/proc.h
 #include sys/socket.h
+#include sys/timetc.h
 #include sys/module.h
 
 #include net/if.h
@@ -191,10 +192,6 @@ struct vmt_softc {
 
 	struct callout		sc_tick;
 	struct callout		sc_tclo_tick;
-#if notyet
-	struct ksensordev	sc_sensordev;
-	struct ksensor		sc_sensor;
-#endif
 
 	struct vmt_event	sc_ev_power;
 	struct vmt_event	sc_ev_reset;
@@ -229,6 +226,7 @@ static void vmt_do_shutdown(struct vmt_s
 
 static void vmt_update_guest_info(struct vmt_softc *);
 static void vmt_update_guest_uptime(struct vmt_softc *);
+static void vmt_sync_guest_clock(struct vmt_softc *);
 
 static void vmt_tick(void *);
 static void vmt_tclo_tick(void *);
@@ -325,17 +323,6 @@ vmt_attach(device_t parent, device_t sel
 
 	pmf_device_register1(self, NULL, NULL, vmt_shutdown);
 
-#if notyet
-	strlcpy(sc-sc_sensordev.xname, sc-sc_dev.dv_xname,
-	sizeof(sc-sc_sensordev.xname));
-
-	sc-sc_sensor.type = SENSOR_TIMEDELTA;
-	sc-sc_sensor.status = SENSOR_S_UNKNOWN;
-
-	sensor_attach(sc-sc_sensordev, sc-sc_sensor);
-	sensordev_install(sc-sc_sensordev);
-#endif
-
 	sysmon_task_queue_init();
 
 	sc-sc_ev_power.ev_smpsw.smpsw_type = PSWITCH_TYPE_POWER;
@@ -359,6 +346,8 @@ vmt_attach(device_t parent, device_t sel
 	callout_schedule(sc-sc_tclo_tick, hz);
 	sc-sc_tclo_ping = 1;
 
+	vmt_sync_guest_clock(sc);
+
 	return;
 
 free:
@@ -444,16 +433,10 @@ vmt_update_guest_info(struct vmt_softc *
 }
 
 static void
-vmt_tick(void *xarg)
+vmt_sync_guest_clock(struct vmt_softc *sc)
 {
-	struct vmt_softc *sc = xarg;
 	struct vm_backdoor frame;
-#if notyet
-	struct timeval *guest = sc-sc_sensor.tv;
-	struct timeval host, diff;
-
-	microtime(guest);
-#endif
+	struct timespec ts;
 
 	memset(frame, 0, sizeof(frame));
 	frame.eax.word = VM_MAGIC;
@@ -462,21 +445,16 @@ vmt_tick(void *xarg)
 	vm_cmd(frame);
 
 	if (frame.eax.word != 0x) {
-#if notyet
-		host.tv_sec = ((uint64_t)frame.esi.word  32) | frame.edx.word;
-		host.tv_usec = frame.ebx.word;
-
-		timersub(guest, host, diff);
-
-		sc-sc_sensor.value = (u_int64_t)diff.tv_sec * 10LL +
-		(u_int64_t)diff.tv_usec * 1000LL;
-		sc-sc_sensor.status = SENSOR_S_OK;
-#endif
-	} else {
-#if notyet
-		sc-sc_sensor.status = SENSOR_S_UNKNOWN;
-#endif
+		ts.tv_sec = ((uint64_t)frame.esi.word  32) | frame.edx.word;
+		ts.tv_nsec = frame.ebx.word * 1000;
+		tc_setclock(ts);
 	}
+}
+
+static void
+vmt_tick(void *xarg)
+{
+	struct vmt_softc *sc = xarg;
 
 	vmt_update_guest_info(sc);
 	vmt_update_guest_uptime(sc);
@@ -519,6 +497,8 @@ vmt_do_resume(struct vmt_softc *sc)
 {
 	device_printf(sc-sc_dev, guest resuming from suspended state\n);
 
+	vmt_sync_guest_clock(sc);
+
 	/* force guest info update */
 	sc-sc_hostname[0] = '\0';
 	sc-sc_set_guest_os = 0;



CVS commit: src/lib/libutil

2011-10-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 21 12:10:32 UTC 2011

Added Files:
src/lib/libutil: proc_compare.3

Log Message:
Forgot to commit this.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libutil/proc_compare.3

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

Added files:

Index: src/lib/libutil/proc_compare.3
diff -u /dev/null src/lib/libutil/proc_compare.3:1.1
--- /dev/null	Fri Oct 21 08:10:32 2011
+++ src/lib/libutil/proc_compare.3	Fri Oct 21 08:10:31 2011
@@ -0,0 +1,104 @@
+.\ $NetBSD: proc_compare.3,v 1.1 2011/10/21 12:10:31 christos Exp $
+.\
+.\ Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Christos Zoulas.
+.\
+.\ 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.
+.\ 3. All advertising materials mentioning features or use of this software
+.\must display the following acknowledgement:
+.\This product includes software developed by the NetBSD
+.\Foundation, Inc. and its contributors.
+.\ 4. Neither the name of The NetBSD Foundation nor the names of its
+.\contributors may be used to endorse or promote products derived
+.\from this software without specific prior written permission.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 October 20, 2011
+.Dt PROC_COMPARE 3
+.Os
+.Sh NAME
+.Nm proc_compare
+.Nd compare two processes interactivity
+.Sh LIBRARY
+.Lb libutil
+.Sh SYNOPSIS
+.In sys/sysctl.h
+.Ft int
+.Fn proc_compare const struct kinfo_proc2 *p1 const struct kinfo_lwp *l1 \
+const struct kinfo_proc2 *p2 const struct kinfo_lwp *l2
+.Sh DESCRIPTION
+The
+.Fn proc_compare
+function compares two processes that are on the same terminal for their
+interactivity.
+This means that the process returned is the one that has a better chance
+being the active foreground process on that tty.
+This algorithm is used in the kernel for
+.Dv SIGINFO
+reporting and in userland by
+.Xr w 1 .
+.Pp
+The algorithm used is as follows:
+.Bl -bullet -compact -offset indent
+.It
+If one of them is runnable, it is preferred.
+.It
+If both are runnable, the one with the largest cpu percent is preferred.
+.It
+In a cpu percent tie, the one started more recently wins.
+.It 
+If none are runnable, and one of them is a zombie, the non zombie is preferred
+.It
+If both are zombies, the one started more recently wins.
+.It
+If neither is a zombie, the one with the smaller sleep time wins.
+.It
+In a tie, and one is sleeping in non interruptible sleep, we prefer that one.
+.It
+If both are in the same state, the one started more recently is preferred.
+.El
+In all cases where the most recently started wins, if there was no winner,
+the one with the largest pid wins.
+.Sh RETURN VALUES
+The
+.Fn proc_compare
+function returns
+.Dv 0
+if
+.Fa p1
+is to be preferred
+and
+.Dv 1
+if
+.Fa p2
+is to be preferred.
+.Sh SEE ALSO
+.Xr w 1
+.Sh HISTORY
+The
+.Fn proc_compare
+was extracted from src/sys/kern/tty.c and src/usr.bin/w/proc_compare.c
+and merged in
+.Nx 6.



CVS commit: src/lib/libutil

2011-10-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Oct 21 12:58:53 UTC 2011

Modified Files:
src/lib/libutil: proc_compare.3

Log Message:
Minor improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libutil/proc_compare.3

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

Modified files:

Index: src/lib/libutil/proc_compare.3
diff -u src/lib/libutil/proc_compare.3:1.1 src/lib/libutil/proc_compare.3:1.2
--- src/lib/libutil/proc_compare.3:1.1	Fri Oct 21 12:10:31 2011
+++ src/lib/libutil/proc_compare.3	Fri Oct 21 12:58:53 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: proc_compare.3,v 1.1 2011/10/21 12:10:31 christos Exp $
+.\ $NetBSD: proc_compare.3,v 1.2 2011/10/21 12:58:53 wiz Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -40,7 +40,7 @@
 .Os
 .Sh NAME
 .Nm proc_compare
-.Nd compare two processes interactivity
+.Nd compare two processes' interactivity
 .Sh LIBRARY
 .Lb libutil
 .Sh SYNOPSIS
@@ -65,22 +65,22 @@ The algorithm used is as follows:
 .It
 If one of them is runnable, it is preferred.
 .It
-If both are runnable, the one with the largest cpu percent is preferred.
+If both are runnable, the one with the largest CPU percent is preferred.
 .It
-In a cpu percent tie, the one started more recently wins.
-.It 
-If none are runnable, and one of them is a zombie, the non zombie is preferred
+In a CPU percent tie, the one started more recently wins.
+.It
+If none are runnable, and one of them is a zombie, the non-zombie is preferred
 .It
 If both are zombies, the one started more recently wins.
 .It
 If neither is a zombie, the one with the smaller sleep time wins.
 .It
-In a tie, and one is sleeping in non interruptible sleep, we prefer that one.
+In a tie, and one is sleeping in non-interruptible sleep, prefer that one.
 .It
 If both are in the same state, the one started more recently is preferred.
 .El
 In all cases where the most recently started wins, if there was no winner,
-the one with the largest pid wins.
+the one with the largest PID wins.
 .Sh RETURN VALUES
 The
 .Fn proc_compare
@@ -99,6 +99,9 @@ is to be preferred.
 .Sh HISTORY
 The
 .Fn proc_compare
-was extracted from src/sys/kern/tty.c and src/usr.bin/w/proc_compare.c
+was extracted from
+.Pa src/sys/kern/tty.c
+and
+.Pa src/usr.bin/w/proc_compare.c
 and merged in
-.Nx 6.
+.Nx 6.0 .



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386

2011-10-21 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Fri Oct 21 15:08:41 UTC 2011

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386: x86cpuid.S

Log Message:
add PIC support.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.1 src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.2
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.1	Tue Jul  5 16:53:58 2011
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S	Fri Oct 21 15:08:41 2011
@@ -1,3 +1,5 @@
+#include machine/asm.h
+
 .file	x86cpuid.s
 .text
 .globl	OPENSSL_ia32_cpuid
@@ -285,7 +287,9 @@ OPENSSL_cleanse:
 .size	OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
 .comm	OPENSSL_ia32cap_P,4,4
 .section	.init
-	call	OPENSSL_cpuid_setup
+	PIC_PROLOGUE
+	call	PIC_PLT(_C_LABEL(OPENSSL_cpuid_setup))
+	PIC_EPILOGUE
 	jmp	.Linitalign
 .align	16
 .Linitalign:



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386

2011-10-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct 21 17:57:45 UTC 2011

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386: x86cpuid.S

Log Message:
Put back support for non PIC.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S:1.2	Fri Oct 21 11:08:41 2011
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/i386/x86cpuid.S	Fri Oct 21 13:57:45 2011
@@ -287,9 +287,13 @@ OPENSSL_cleanse:
 .size	OPENSSL_cleanse,.-.L_OPENSSL_cleanse_begin
 .comm	OPENSSL_ia32cap_P,4,4
 .section	.init
+#ifdef PIC
 	PIC_PROLOGUE
 	call	PIC_PLT(_C_LABEL(OPENSSL_cpuid_setup))
 	PIC_EPILOGUE
+#else
+	call	_C_LABEL(OPENSSL_cpuid_setup)
+#endif
 	jmp	.Linitalign
 .align	16
 .Linitalign:



CVS commit: [cherry-xenmp] src/sys/arch

2011-10-21 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Oct 21 18:08:44 UTC 2011

Modified Files:
src/sys/arch/amd64/amd64 [cherry-xenmp]: fpu.c
src/sys/arch/x86/x86 [cherry-xenmp]: x86_machdep.c
src/sys/arch/xen/x86 [cherry-xenmp]: x86_xpmap.c

Log Message:
Make this build without 'options MULTIPROCESSOR'


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.1 -r1.34.2.2 src/sys/arch/amd64/amd64/fpu.c
cvs rdiff -u -r1.50.2.2 -r1.50.2.3 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.26.2.11 -r1.26.2.12 src/sys/arch/xen/x86/x86_xpmap.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/amd64/amd64/fpu.c
diff -u src/sys/arch/amd64/amd64/fpu.c:1.34.2.1 src/sys/arch/amd64/amd64/fpu.c:1.34.2.2
--- src/sys/arch/amd64/amd64/fpu.c:1.34.2.1	Fri Jun  3 13:27:37 2011
+++ src/sys/arch/amd64/amd64/fpu.c	Fri Oct 21 18:08:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.34.2.1 2011/06/03 13:27:37 cherry Exp $	*/
+/*	$NetBSD: fpu.c,v 1.34.2.2 2011/10/21 18:08:44 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -100,7 +100,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fpu.c,v 1.34.2.1 2011/06/03 13:27:37 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: fpu.c,v 1.34.2.2 2011/10/21 18:08:44 bouyer Exp $);
 
 #include opt_multiprocessor.h
 
@@ -407,7 +407,7 @@ fpusave_lwp(struct lwp *l, bool save)
 		}
 		splx(s);
 #ifdef XEN
-		xen_send_ipi(oci, XEN_IPI_SYNCH_FPU);
+		(void)xen_send_ipi(oci, XEN_IPI_SYNCH_FPU);
 #else /* XEN */
 		x86_send_ipi(oci, X86_IPI_SYNCH_FPU);
 #endif

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.50.2.2 src/sys/arch/x86/x86/x86_machdep.c:1.50.2.3
--- src/sys/arch/x86/x86/x86_machdep.c:1.50.2.2	Thu Jun 23 14:19:49 2011
+++ src/sys/arch/x86/x86/x86_machdep.c	Fri Oct 21 18:08:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.50.2.2 2011/06/23 14:19:49 cherry Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.50.2.3 2011/10/21 18:08:44 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_machdep.c,v 1.50.2.2 2011/06/23 14:19:49 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_machdep.c,v 1.50.2.3 2011/10/21 18:08:44 bouyer Exp $);
 
 #include opt_modular.h
 #include opt_physmem.h
@@ -201,7 +201,7 @@ cpu_need_resched(struct cpu_info *ci, in
 			return;
 		if (x86_cpu_idle_ipi != false) {
 #ifdef XEN
-			xen_send_ipi(ci, XEN_IPI_KICK);
+			(void)xen_send_ipi(ci, XEN_IPI_KICK);
 #else /* XEN */
 			x86_send_ipi(ci, 0);
 #endif /* XEN */
@@ -227,7 +227,7 @@ cpu_need_resched(struct cpu_info *ci, in
 	}
 	if ((flags  RESCHED_IMMED) != 0) {
 #ifdef XEN
-		xen_send_ipi(ci, XEN_IPI_KICK);
+		(void)xen_send_ipi(ci, XEN_IPI_KICK);
 #else /* XEN */
 		x86_send_ipi(ci, 0);
 #endif /* XEN */
@@ -242,7 +242,7 @@ cpu_signotify(struct lwp *l)
 	aston(l, X86_AST_GENERIC);
 	if (l-l_cpu != curcpu())
 #ifdef XEN
-		xen_send_ipi(l-l_cpu, XEN_IPI_KICK);
+		(void)xen_send_ipi(l-l_cpu, XEN_IPI_KICK);
 #else /* XEN */
 		x86_send_ipi(l-l_cpu, 0);
 #endif /* XEN */

Index: src/sys/arch/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.26.2.11 src/sys/arch/xen/x86/x86_xpmap.c:1.26.2.12
--- src/sys/arch/xen/x86/x86_xpmap.c:1.26.2.11	Tue Sep 20 18:57:53 2011
+++ src/sys/arch/xen/x86/x86_xpmap.c	Fri Oct 21 18:08:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.26.2.11 2011/09/20 18:57:53 cherry Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.26.2.12 2011/10/21 18:08:44 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert m...@adviseo.fr
@@ -69,7 +69,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.26.2.11 2011/09/20 18:57:53 cherry Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_xpmap.c,v 1.26.2.12 2011/10/21 18:08:44 bouyer Exp $);
 
 #include opt_xen.h
 #include opt_ddb.h
@@ -165,9 +165,7 @@ void xpq_debug_dump(void);
 static mmu_update_t xpq_queue_array[MAXCPUS][XPQUEUE_SIZE];
 static int xpq_idx_array[MAXCPUS];
 
-#ifdef MULTIPROCESSOR
 extern struct cpu_info * (*xpq_cpu)(void);
-#endif /* MULTIPROCESSOR */
 
 void
 xpq_flush_queue(void)



CVS commit: src/sys

2011-10-21 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 21 21:35:29 UTC 2011

Modified Files:
src/sys/arch/i386/i386: mainbus.c
src/sys/dev/pci: pcivar.h ppb.c

Log Message:
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus  pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/i386/i386/mainbus.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/pcivar.h
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/ppb.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/i386/i386/mainbus.c
diff -u src/sys/arch/i386/i386/mainbus.c:1.91 src/sys/arch/i386/i386/mainbus.c:1.92
--- src/sys/arch/i386/i386/mainbus.c:1.91	Tue May 17 17:34:50 2011
+++ src/sys/arch/i386/i386/mainbus.c	Fri Oct 21 21:35:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.91 2011/05/17 17:34:50 dyoung Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.92 2011/10/21 21:35:28 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.91 2011/05/17 17:34:50 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.92 2011/10/21 21:35:28 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -406,6 +406,7 @@ mainbus_rescan(device_t self, const char
 		mba.mba_pba.pba_pc = NULL;
 		mba.mba_pba.pba_flags = pci_bus_flags();
 		mba.mba_pba.pba_bus = 0;
+		mba.mba_pba.pba_sub = 255;
 		mba.mba_pba.pba_bridgetag = NULL;
 #if NACPICA  0  defined(ACPI_SCANPCI)
 		if (npcibus == 0  sc-sc_mpacpi_active)

Index: src/sys/dev/pci/pcivar.h
diff -u src/sys/dev/pci/pcivar.h:1.95 src/sys/dev/pci/pcivar.h:1.96
--- src/sys/dev/pci/pcivar.h:1.95	Wed Aug 24 20:27:36 2011
+++ src/sys/dev/pci/pcivar.h	Fri Oct 21 21:35:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcivar.h,v 1.95 2011/08/24 20:27:36 dyoung Exp $	*/
+/*	$NetBSD: pcivar.h,v 1.96 2011/10/21 21:35:28 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -104,6 +104,14 @@ struct pcibus_attach_args {
 	int		pba_flags;	/* flags; see below */
 
 	int		pba_bus;	/* PCI bus number */
+	int		pba_sub;	/* pba_bus = pba_sub: no
+	 * buses are subordinate to
+	 * pba_bus.
+	 *
+	 * pba_bus  pba_sub: buses
+	 * [pba_bus + 1, pba_sub] are
+	 * subordinate to pba_bus.
+	 */
 
 	/*
 	 * Pointer to the pcitag of our parent bridge.  If there is no

Index: src/sys/dev/pci/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.46 src/sys/dev/pci/ppb.c:1.47
--- src/sys/dev/pci/ppb.c:1.46	Wed Aug 17 00:59:47 2011
+++ src/sys/dev/pci/ppb.c	Fri Oct 21 21:35:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.46 2011/08/17 00:59:47 dyoung Exp $	*/
+/*	$NetBSD: ppb.c,v 1.47 2011/10/21 21:35:28 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ppb.c,v 1.46 2011/08/17 00:59:47 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ppb.c,v 1.47 2011/10/21 21:35:28 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -206,6 +206,7 @@ ppbattach(device_t parent, device_t self
 	pba.pba_pc = pc;
 	pba.pba_flags = pa-pa_flags  ~PCI_FLAGS_MRM_OKAY;
 	pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
+	pba.pba_sub = PPB_BUSINFO_SUBORDINATE(busdata);
 	pba.pba_bridgetag = sc-sc_tag;
 	pba.pba_intrswiz = pa-pa_intrswiz;
 	pba.pba_intrtag = pa-pa_intrtag;



CVS commit: src/lib/libc/stdlib

2011-10-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Oct 21 23:45:57 UTC 2011

Modified Files:
src/lib/libc/stdlib: mi_vector_hash.c

Log Message:
sys/endian.h might not exist in the src/tools case


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/stdlib/mi_vector_hash.c

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

Modified files:

Index: src/lib/libc/stdlib/mi_vector_hash.c
diff -u src/lib/libc/stdlib/mi_vector_hash.c:1.3 src/lib/libc/stdlib/mi_vector_hash.c:1.4
--- src/lib/libc/stdlib/mi_vector_hash.c:1.3	Fri Mar 19 18:11:30 2010
+++ src/lib/libc/stdlib/mi_vector_hash.c	Fri Oct 21 23:45:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mi_vector_hash.c,v 1.3 2010/03/19 18:11:30 joerg Exp $	*/
+/*	$NetBSD: mi_vector_hash.c,v 1.4 2011/10/21 23:45:56 joerg Exp $	*/
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -43,11 +43,13 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: mi_vector_hash.c,v 1.3 2010/03/19 18:11:30 joerg Exp $);
+__RCSID($NetBSD: mi_vector_hash.c,v 1.4 2011/10/21 23:45:56 joerg Exp $);
 
 #include namespace.h
 
+#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H
 #include sys/endian.h
+#endif
 #include stdint.h
 #include stdlib.h
 



CVS commit: src/usr.bin/nbperf

2011-10-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Oct 21 23:47:12 UTC 2011

Modified Files:
src/usr.bin/nbperf: graph2.c graph3.c nbperf-bdz.c nbperf-chm.c
nbperf.1 nbperf.c

Log Message:
Add support for build as part of the toolchain. Add option for
deterministic output (-p), which replaces the random seed with a
incremental counter.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/nbperf/graph2.c \
src/usr.bin/nbperf/graph3.c src/usr.bin/nbperf/nbperf-bdz.c \
src/usr.bin/nbperf/nbperf.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/nbperf/nbperf-chm.c \
src/usr.bin/nbperf/nbperf.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/nbperf/graph2.c
diff -u src/usr.bin/nbperf/graph2.c:1.3 src/usr.bin/nbperf/graph2.c:1.4
--- src/usr.bin/nbperf/graph2.c:1.3	Wed Mar  3 01:55:04 2010
+++ src/usr.bin/nbperf/graph2.c	Fri Oct 21 23:47:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: graph2.c,v 1.3 2010/03/03 01:55:04 joerg Exp $	*/
+/*	$NetBSD: graph2.c,v 1.4 2011/10/21 23:47:11 joerg Exp $	*/
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,8 +31,12 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include nbtool_config.h
+#endif
+
 #include sys/cdefs.h
-__RCSID($NetBSD: graph2.c,v 1.3 2010/03/03 01:55:04 joerg Exp $);
+__RCSID($NetBSD: graph2.c,v 1.4 2011/10/21 23:47:11 joerg Exp $);
 
 #include err.h
 #include inttypes.h
Index: src/usr.bin/nbperf/graph3.c
diff -u src/usr.bin/nbperf/graph3.c:1.3 src/usr.bin/nbperf/graph3.c:1.4
--- src/usr.bin/nbperf/graph3.c:1.3	Wed Mar  3 01:55:04 2010
+++ src/usr.bin/nbperf/graph3.c	Fri Oct 21 23:47:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: graph3.c,v 1.3 2010/03/03 01:55:04 joerg Exp $	*/
+/*	$NetBSD: graph3.c,v 1.4 2011/10/21 23:47:11 joerg Exp $	*/
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,8 +31,12 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include nbtool_config.h
+#endif
+
 #include sys/cdefs.h
-__RCSID($NetBSD: graph3.c,v 1.3 2010/03/03 01:55:04 joerg Exp $);
+__RCSID($NetBSD: graph3.c,v 1.4 2011/10/21 23:47:11 joerg Exp $);
 
 #include err.h
 #include inttypes.h
Index: src/usr.bin/nbperf/nbperf-bdz.c
diff -u src/usr.bin/nbperf/nbperf-bdz.c:1.3 src/usr.bin/nbperf/nbperf-bdz.c:1.4
--- src/usr.bin/nbperf/nbperf-bdz.c:1.3	Mon Mar  1 21:46:58 2010
+++ src/usr.bin/nbperf/nbperf-bdz.c	Fri Oct 21 23:47:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: nbperf-bdz.c,v 1.3 2010/03/01 21:46:58 joerg Exp $	*/
+/*	$NetBSD: nbperf-bdz.c,v 1.4 2011/10/21 23:47:11 joerg Exp $	*/
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,8 +31,12 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include nbtool_config.h
+#endif
+
 #include sys/cdefs.h
-__RCSID($NetBSD: nbperf-bdz.c,v 1.3 2010/03/01 21:46:58 joerg Exp $);
+__RCSID($NetBSD: nbperf-bdz.c,v 1.4 2011/10/21 23:47:11 joerg Exp $);
 
 #include err.h
 #include inttypes.h
Index: src/usr.bin/nbperf/nbperf.c
diff -u src/usr.bin/nbperf/nbperf.c:1.3 src/usr.bin/nbperf/nbperf.c:1.4
--- src/usr.bin/nbperf/nbperf.c:1.3	Wed Mar  3 01:55:04 2010
+++ src/usr.bin/nbperf/nbperf.c	Fri Oct 21 23:47:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: nbperf.c,v 1.3 2010/03/03 01:55:04 joerg Exp $	*/
+/*	$NetBSD: nbperf.c,v 1.4 2011/10/21 23:47:11 joerg Exp $	*/
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,8 +31,12 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include nbtool_config.h
+#endif
+
 #include sys/cdefs.h
-__RCSID($NetBSD: nbperf.c,v 1.3 2010/03/03 01:55:04 joerg Exp $);
+__RCSID($NetBSD: nbperf.c,v 1.4 2011/10/21 23:47:11 joerg Exp $);
 
 #include sys/endian.h
 #include err.h
@@ -45,20 +49,30 @@ __RCSID($NetBSD: nbperf.c,v 1.3 2010/03
 
 #include nbperf.h
 
+static int predictable;
+
 static __dead
 void usage(void)
 {
 	fprintf(stderr,
-	%s [-s] [-c utilisation] [-i iterations] [-n name] 
+	%s [-ps] [-c utilisation] [-i iterations] [-n name] 
 	[-o output] input\n,
 	getprogname());
 	exit(1);
 }
 
+#if HAVE_NBTOOL_CONFIG_H  !defined(__NetBSD__)
+#define	arc4random() rand()
+#endif
+
 static void
 mi_vector_hash_seed_hash(struct nbperf *nbperf)
 {
-	nbperf-seed[0] = arc4random();
+	static uint32_t predictable_counter;
+	if (predictable)
+		nbperf-seed[0] = predictable_counter++;
+	else
+		nbperf-seed[0] = arc4random();
 }
 
 static void
@@ -107,7 +121,8 @@ main(int argc, char **argv)
 	FILE *input;
 	size_t curlen = 0, curalloc = 0;
 	char *line, *eos;
-	size_t line_len;
+	ssize_t line_len;
+	size_t line_allocated;
 	const void **keys = NULL;
 	size_t *keylens = NULL;
 	uint32_t max_iterations = 0xffU;
@@ -117,7 +132,7 @@ main(int argc, char **argv)
 
 	set_hash(nbperf, mi_vector_hash);
 
-	while ((ch = getopt(argc, argv, a:c:h:i:m:n:o:s)) != -1) {
+	while ((ch = getopt(argc, argv, a:c:h:i:m:n:o:ps)) != -1) {
 		switch 

CVS commit: src/distrib/sets

2011-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 22 00:05:17 UTC 2011

Modified Files:
src/distrib/sets: sets.subr

Log Message:
try to match sys/kern/kern_module.c module path logic: for release branches,
use X.Y version (instead of eg. X.Y.0_PATCH or X.Y_STABLE) and for -current use 
X.Y.Z.
ok zafer@


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/distrib/sets/sets.subr

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

Modified files:

Index: src/distrib/sets/sets.subr
diff -u src/distrib/sets/sets.subr:1.132 src/distrib/sets/sets.subr:1.133
--- src/distrib/sets/sets.subr:1.132	Fri May 20 16:02:22 2011
+++ src/distrib/sets/sets.subr	Sat Oct 22 00:05:17 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.132 2011/05/20 16:02:22 plunky Exp $
+#	$NetBSD: sets.subr,v 1.133 2011/10/22 00:05:17 jmcneill Exp $
 #
 
 #
@@ -159,7 +159,11 @@ nlists=base comp etc games man misc $mo
 xlists=xbase xcomp xetc xfont xserver
 extlists=extbase extcomp extetc
 
-OSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh`
+OSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh -n`
+# for release branches, use X.Y version, for -current use X.Y.Z
+if [ ! ${OSRELEASE%.99} = ${OSRELEASE} ]; then
+	OSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh`
+fi
 MODULEDIR=stand/${MACHINE}/${OSRELEASE}/modules
 SUBST=s#@MODULEDIR@#${MODULEDIR}#g
 SUBST=${SUBST};s#@OSRELEASE@#${OSRELEASE}#g
@@ -172,7 +176,7 @@ SUBST=${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.132 2011/05/20 16:02:22 plunky Exp $
+# 	# $NetBSD: sets.subr,v 1.133 2011/10/22 00:05:17 jmcneill Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root



CVS commit: othersrc/external/bsd/iscsi/sbin/iscsid

2011-10-21 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Oct 22 05:52:44 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sbin/iscsid: iscsid.h

Log Message:
provide C++ header support


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/iscsi/sbin/iscsid/iscsid.h

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

Modified files:

Index: othersrc/external/bsd/iscsi/sbin/iscsid/iscsid.h
diff -u othersrc/external/bsd/iscsi/sbin/iscsid/iscsid.h:1.1.1.1 othersrc/external/bsd/iscsi/sbin/iscsid/iscsid.h:1.2
--- othersrc/external/bsd/iscsi/sbin/iscsid/iscsid.h:1.1.1.1	Mon May  2 07:01:06 2011
+++ othersrc/external/bsd/iscsi/sbin/iscsid/iscsid.h	Sat Oct 22 05:52:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid.h,v 1.1.1.1 2011/05/02 07:01:06 agc Exp $	*/
+/*	$NetBSD: iscsid.h,v 1.2 2011/10/22 05:52:44 agc Exp $	*/
 
 /*-
  * Copyright (c) 2004,2006,2011 The NetBSD Foundation, Inc.
@@ -33,6 +33,18 @@
 
 #include dev/iscsi/iscsi.h
 
+#ifndef __BEGIN_DECLS
+#  if defined(__cplusplus)
+#  define __BEGIN_DECLS   extern C {
+#  define __END_DECLS }
+#  else
+#  define __BEGIN_DECLS
+#  define __END_DECLS
+#  endif
+#endif
+
+__BEGIN_DECLS
+
 /* The socket name */
 
 #define ISCSID_SOCK_NAME   /tmp/iscsid_socket
@@ -896,5 +908,6 @@ typedef struct {
   Corresponding version information for driver.
 */
 
+__END_DECLS
 
 #endif /* !_ISCSID_H_ */



CVS commit: othersrc/external/bsd/iscsi/sbin/iscsid

2011-10-21 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Sat Oct 22 05:53:03 UTC 2011

Modified Files:
othersrc/external/bsd/iscsi/sbin/iscsid: iscsid_lists.c

Log Message:
make this compile with gcc 4.5


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
othersrc/external/bsd/iscsi/sbin/iscsid/iscsid_lists.c

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

Modified files:

Index: othersrc/external/bsd/iscsi/sbin/iscsid/iscsid_lists.c
diff -u othersrc/external/bsd/iscsi/sbin/iscsid/iscsid_lists.c:1.2 othersrc/external/bsd/iscsi/sbin/iscsid/iscsid_lists.c:1.3
--- othersrc/external/bsd/iscsi/sbin/iscsid/iscsid_lists.c:1.2	Tue Jul 26 05:51:58 2011
+++ othersrc/external/bsd/iscsi/sbin/iscsid/iscsid_lists.c	Sat Oct 22 05:53:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_lists.c,v 1.2 2011/07/26 05:51:58 agc Exp $	*/
+/*	$NetBSD: iscsid_lists.c,v 1.3 2011/10/22 05:53:02 agc Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -474,7 +474,7 @@ search_list(iscsid_search_list_req_t * p
 		return;
 	}
 
-	*((iscsid_sym_id_t *) rsp-parameter) = elem-sid;
+	(void) memcpy(rsp-parameter, elem-sid, sizeof(elem-sid));
 	if (par-list_kind == SESSION_LIST)
 		UNLOCK_SESSIONS;
 }