CVS commit: src/sys/arch/hppa/hppa

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:56:16 UTC 2010

Modified Files:
src/sys/arch/hppa/hppa: trap.c

Log Message:
Check cpl level has returned to entry value when leaving trap/syscall.

>From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/hppa/hppa/trap.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/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.68 src/sys/arch/hppa/hppa/trap.c:1.69
--- src/sys/arch/hppa/hppa/trap.c:1.68	Sat Jan 16 07:45:53 2010
+++ src/sys/arch/hppa/hppa/trap.c	Sat Jan 16 07:56:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.68 2010/01/16 07:45:53 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.69 2010/01/16 07:56:16 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.68 2010/01/16 07:45:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.69 2010/01/16 07:56:16 skrll Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -497,6 +497,7 @@
 	int trapnum;
 #ifdef DIAGNOSTIC
 	extern int emergency_stack_start, emergency_stack_end;
+	int oldcpl = cpl;
 #endif
 
 	trapnum = type & ~T_USER;
@@ -948,6 +949,12 @@
 		panic ("trap: unimplemented \'%s\' (%d)", tts, type);
 	}
 
+#ifdef DIAGNOSTIC
+	if (cpl != oldcpl)
+		printf("WARNING: SPL (%d) NOT LOWERED ON TRAP (%d) EXIT\n",
+		cpl, trapnum);
+#endif
+
 	if (type & T_USER)
 		userret(l, l->l_md.md_regs->tf_iioq_head, 0);
 
@@ -1090,6 +1097,9 @@
 	int nsys, code, error;
 	int tmp;
 	int rval[2];
+#ifdef DIAGNOSTIC
+	int oldcpl = cpl;
+#endif
 
 	uvmexp.syscalls++;
 
@@ -1257,6 +1267,16 @@
 		trace_exit(code, rval, error);
 
 	userret(l, frame->tf_iioq_head, 0);
+
+#ifdef DIAGNOSTIC
+	if (cpl != oldcpl) {
+		printf("WARNING: SPL (0x%x) NOT LOWERED ON "
+		"syscall(0x%x, 0x%x, 0x%x, 0x%x...) EXIT, PID %d\n",
+		cpl, code, args[0], args[1], args[2], p->p_pid);
+		cpl = oldcpl;
+	}
+#endif
+
 #ifdef DEBUG
 	frame_sanity_check(0xdead05, 0, frame, l);
 #endif /* DEBUG */



CVS commit: src/sys/arch/hppa/hppa

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:45:53 UTC 2010

Modified Files:
src/sys/arch/hppa/hppa: trap.c

Log Message:
Add a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/hppa/hppa/trap.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/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.67 src/sys/arch/hppa/hppa/trap.c:1.68
--- src/sys/arch/hppa/hppa/trap.c:1.67	Sat Jan 16 07:37:21 2010
+++ src/sys/arch/hppa/hppa/trap.c	Sat Jan 16 07:45:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.67 2010/01/16 07:37:21 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.68 2010/01/16 07:45:53 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.67 2010/01/16 07:37:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.68 2010/01/16 07:45:53 skrll Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -964,6 +964,10 @@
 {
 	struct lwp *l = arg;
 
+	/*
+	 * Return values in the frame set by cpu_lwp_fork().
+	 */
+
 	userret(l, l->l_md.md_regs->tf_iioq_head, 0);
 	ktrsysret(SYS_fork, 0, 0);
 #ifdef DEBUG



CVS commit: src/sys/arch/hp700/hp700

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:38:56 UTC 2010

Modified Files:
src/sys/arch/hp700/hp700: intr.c

Log Message:
Count interrupts in uvmexp.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp700/hp700/intr.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/hp700/hp700/intr.c
diff -u src/sys/arch/hp700/hp700/intr.c:1.19 src/sys/arch/hp700/hp700/intr.c:1.20
--- src/sys/arch/hp700/hp700/intr.c:1.19	Mon Nov 30 16:58:40 2009
+++ src/sys/arch/hp700/hp700/intr.c	Sat Jan 16 07:38:56 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.19 2009/11/30 16:58:40 skrll Exp $	*/
+/*	$NetBSD: intr.c,v 1.20 2010/01/16 07:38:56 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.19 2009/11/30 16:58:40 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.20 2010/01/16 07:38:56 skrll Exp $");
 
 #define __MUTEX_PRIVATE
 
@@ -514,7 +514,8 @@
 		cpl = ncpl | int_bit->int_bit_spl;
 		mtctl(eiem, CR_EIEM);
 
-		/* Dispatch the interrupt. */
+		/* Count and dispatch the interrupt. */
+		uvmexp.intrs++;
 		handled = (*int_bit->int_bit_handler)(arg);
 #if 0
 		if (!handled)



CVS commit: src/sys/arch/hppa/hppa

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:37:21 UTC 2010

Modified Files:
src/sys/arch/hppa/hppa: trap.c

Log Message:
Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/hppa/hppa/trap.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/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.66 src/sys/arch/hppa/hppa/trap.c:1.67
--- src/sys/arch/hppa/hppa/trap.c:1.66	Sat Jan 16 07:17:39 2010
+++ src/sys/arch/hppa/hppa/trap.c	Sat Jan 16 07:37:21 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.66 2010/01/16 07:17:39 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.67 2010/01/16 07:37:21 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.66 2010/01/16 07:17:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.67 2010/01/16 07:37:21 skrll Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -494,15 +494,15 @@
 	u_int opcode, onfault;
 	int ret;
 	const char *tts;
-	int type_raw;
+	int trapnum;
 #ifdef DIAGNOSTIC
 	extern int emergency_stack_start, emergency_stack_end;
 #endif
 
-	type_raw = type & ~T_USER;
+	trapnum = type & ~T_USER;
 	opcode = frame->tf_iir;
-	if (type_raw == T_ITLBMISS || type_raw == T_ITLBMISSNA ||
-	type_raw == T_IBREAK || type_raw == T_TAKENBR) {
+	if (trapnum == T_ITLBMISS || trapnum == T_ITLBMISSNA ||
+	trapnum == T_IBREAK || trapnum == T_TAKENBR) {
 		va = frame->tf_iioq_head;
 		space = frame->tf_iisq_head;
 		vftype = VM_PROT_EXECUTE;
@@ -518,8 +518,7 @@
 	if ((type & T_USER) != 0)
 		LWP_CACHE_CREDS(l, p);
 
-	tts = (type & ~T_USER) > trap_types ? "reserved" :
-		trap_type[type & ~T_USER];
+	tts = (trapnum > trap_types) ? "reserved" : trap_type[trapnum];
 
 #ifdef DIAGNOSTIC
 	/*
@@ -562,11 +561,11 @@
 		l->l_md.md_regs = frame;
 
 #ifdef TRAPDEBUG
-	if (type_raw != T_INTERRUPT && type_raw != T_IBREAK)
+	if (trapnum != T_INTERRUPT && trapnum != T_IBREAK)
 		printf("trap: %d, %s for %x:%x at %x:%x, fp=%p, rp=%x\n",
 		type, tts, space, (u_int)va, frame->tf_iisq_head,
 		frame->tf_iioq_head, frame, frame->tf_rp);
-	else if (type_raw == T_IBREAK)
+	else if (trapnum == T_IBREAK)
 		printf("trap: break instruction %x:%x at %x:%x, fp=%p\n",
 		break5(opcode), break13(opcode),
 		frame->tf_iisq_head, frame->tf_iioq_head, frame);
@@ -582,7 +581,7 @@
 	pcb = lwp_getpcb(l);
 
 	/* If this is a trap, not an interrupt, reenable interrupts. */
-	if (type_raw != T_INTERRUPT) {
+	if (trapnum != T_INTERRUPT) {
 		uvmexp.traps++;
 		mtctl(frame->tf_eiem, CR_EIEM);
 	}
@@ -694,7 +693,7 @@
 		KSI_INIT_TRAP(&ksi);
 		ksi.ksi_signo = SIGTRAP;
 		ksi.ksi_code = TRAP_TRACE;
-		ksi.ksi_trap = type_raw;
+		ksi.ksi_trap = trapnum;
 		ksi.ksi_addr = (void *)frame->tf_iioq_head;
 #ifdef PTRACE
 		ss_clear_breakpoints(l);
@@ -713,7 +712,7 @@
 		KSI_INIT_TRAP(&ksi);
 		ksi.ksi_signo = SIGTRAP;
 		ksi.ksi_code = TRAP_TRACE;
-		ksi.ksi_trap = type_raw;
+		ksi.ksi_trap = trapnum;
 		ksi.ksi_addr = (void *)frame->tf_iioq_head;
 
 /* pass to user debugger */



CVS commit: src/sys/arch/hppa/hppa

2010-01-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 16 07:17:39 UTC 2010

Modified Files:
src/sys/arch/hppa/hppa: trap.c

Log Message:
Count traps in uvmexp. Reduces diff to OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/hppa/hppa/trap.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/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.65 src/sys/arch/hppa/hppa/trap.c:1.66
--- src/sys/arch/hppa/hppa/trap.c:1.65	Wed Jan  6 07:42:58 2010
+++ src/sys/arch/hppa/hppa/trap.c	Sat Jan 16 07:17:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.65 2010/01/06 07:42:58 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.66 2010/01/16 07:17:39 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.65 2010/01/06 07:42:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.66 2010/01/16 07:17:39 skrll Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -558,10 +558,6 @@
 	frame_sanity_check(0xdead01, type, frame, l);
 #endif /* DEBUG */
 
-	/* If this is a trap, not an interrupt, reenable interrupts. */
-	if (type_raw != T_INTERRUPT)
-		mtctl(frame->tf_eiem, CR_EIEM);
-
 	if (frame->tf_flags & TFF_LAST)
 		l->l_md.md_regs = frame;
 
@@ -585,6 +581,12 @@
 #endif
 	pcb = lwp_getpcb(l);
 
+	/* If this is a trap, not an interrupt, reenable interrupts. */
+	if (type_raw != T_INTERRUPT) {
+		uvmexp.traps++;
+		mtctl(frame->tf_eiem, CR_EIEM);
+	}
+
 	switch (type) {
 	case T_NONEXIST:
 	case T_NONEXIST|T_USER:



CVS commit: src/sys/arch/sparc64/sparc64

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 23:57:07 UTC 2010

Modified Files:
src/sys/arch/sparc64/sparc64: ipifuncs.c

Log Message:
UltraSPARC-IIIi CPUs select the BUSY/NACK pair in the interrupt
vector dispatch status register based on the lower two bits of the
ITID.

>From OpenBSD and details are described in the section 10.4.3 of
UltraSPARC IIIi Processor User's Manual.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sparc64/sparc64/ipifuncs.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/sparc64/sparc64/ipifuncs.c
diff -u src/sys/arch/sparc64/sparc64/ipifuncs.c:1.25 src/sys/arch/sparc64/sparc64/ipifuncs.c:1.26
--- src/sys/arch/sparc64/sparc64/ipifuncs.c:1.25	Mon Nov 30 01:45:04 2009
+++ src/sys/arch/sparc64/sparc64/ipifuncs.c	Fri Jan 15 23:57:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipifuncs.c,v 1.25 2009/11/30 01:45:04 mrg Exp $ */
+/*	$NetBSD: ipifuncs.c,v 1.26 2010/01/15 23:57:07 nakayama Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.25 2009/11/30 01:45:04 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.26 2010/01/15 23:57:07 nakayama Exp $");
 
 #include "opt_ddb.h"
 
@@ -188,11 +188,19 @@
 void
 sparc64_send_ipi(int upaid, ipifunc_t func, uint64_t arg1, uint64_t arg2)
 {
-	int i, ik;
+	int i, ik, shift = 0;
 	uint64_t intr_func;
 
 	KASSERT(upaid != curcpu()->ci_cpuid);
-	if (ldxa(0, ASR_IDSR) & IDSR_BUSY)
+
+	/*
+	 * UltraSPARC-IIIi CPUs select the BUSY/NACK pair based on the
+	 * lower two bits of the ITID.
+	 */
+	if (((getver() & VER_IMPL) >> VER_IMPL_SHIFT) == IMPL_JALAPENO)
+		shift = (upaid & 0x3) * 2;
+
+	if (ldxa(0, ASR_IDSR) & (IDSR_BUSY << shift))
 		panic("recursive IPI?");
 
 	intr_func = (uint64_t)(u_long)func;
@@ -211,7 +219,7 @@
 		membar_sync();
 
 		for (ik = 0; ik < 100; ik++) {
-			if (ldxa(0, ASR_IDSR) & IDSR_BUSY)
+			if (ldxa(0, ASR_IDSR) & (IDSR_BUSY << shift))
 continue;
 			else
 break;
@@ -221,7 +229,7 @@
 		if (ik == 100)
 			break;
 
-		if ((ldxa(0, ASR_IDSR) & IDSR_NACK) == 0)
+		if ((ldxa(0, ASR_IDSR) & (IDSR_NACK << shift)) == 0)
 			return;
 		/*
 		 * Wait for a while with enabling interrupts to avoid



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

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 23:55:55 UTC 2010

Modified Files:
src/sys/arch/sparc64/include: psl.h

Log Message:
Add processor implementation codes, from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc64/include/psl.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/sparc64/include/psl.h
diff -u src/sys/arch/sparc64/include/psl.h:1.44 src/sys/arch/sparc64/include/psl.h:1.45
--- src/sys/arch/sparc64/include/psl.h:1.44	Fri Jan 15 15:05:02 2010
+++ src/sys/arch/sparc64/include/psl.h	Fri Jan 15 23:55:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.44 2010/01/15 15:05:02 nakayama Exp $ */
+/*	$NetBSD: psl.h,v 1.45 2010/01/15 23:55:55 nakayama Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -224,6 +224,17 @@
 #define VER_MAXTL_SHIFT	8
 #define VER_MAXWIN	0x001fLL
 
+#define IMPL_SPITFIRE		0x10 /* UltraSPARC-I */
+#define IMPL_BLACKBIRD		0x11 /* UltraSPARC-II */
+#define IMPL_SABRE		0x12 /* UltraSPARC-IIi */
+#define IMPL_HUMMINGBIRD	0x13 /* UltraSPARC-IIe */
+#define IMPL_CHEETAH		0x14 /* UltraSPARC-III */
+#define IMPL_CHEETAH_PLUS	0x15 /* UltraSPARC-III+ */
+#define IMPL_JALAPENO		0x16 /* UltraSPARC-IIIi */
+#define IMPL_JAGUAR		0x18 /* UltraSPARC-IV */
+#define IMPL_PANTHER		0x19 /* UltraSPARC-IV+ */
+#define IMPL_SERRANO		0x22 /* UltraSPARC-IIIi+ */
+
 /*
  * Here are a few things to help us transition between user and kernel mode:
  */



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

2010-01-15 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jan 15 23:49:22 UTC 2010

Modified Files:
src/sys/arch/amiga/dev: fd.c

Log Message:
Use __arraycount().


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/amiga/dev/fd.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/amiga/dev/fd.c
diff -u src/sys/arch/amiga/dev/fd.c:1.83 src/sys/arch/amiga/dev/fd.c:1.84
--- src/sys/arch/amiga/dev/fd.c:1.83	Mon Oct 26 19:16:54 2009
+++ src/sys/arch/amiga/dev/fd.c	Fri Jan 15 23:49:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.83 2009/10/26 19:16:54 cegger Exp $ */
+/*	$NetBSD: fd.c,v 1.84 2010/01/15 23:49:22 dyoung Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.83 2009/10/26 19:16:54 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.84 2010/01/15 23:49:22 dyoung Exp $");
 
 #include 
 #include 
@@ -241,7 +241,7 @@
 	{ 0x, 40, 11, 9, 7358, 6815, 414, { 80, 161 }, "5.25dd" },
 	{ 0x, 80, 22, 18, 14716, 13630, 828, { 80, 161 }, "3.5hd" }
 };
-int nfdtype = sizeof(fdtype) / sizeof(*fdtype);
+int nfdtype = __arraycount(fdtype);
 
 CFATTACH_DECL(fd, sizeof(struct fd_softc),
 fdmatch, fdattach, NULL, NULL);



CVS commit: src/sys/net

2010-01-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan 15 22:16:46 UTC 2010

Modified Files:
src/sys/net: bpf.c

Log Message:
* remove just-for-kicks locking
* KNF
* remove outdated comment (quite a funny one to read in 2010, though)


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/net/bpf.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/net/bpf.c
diff -u src/sys/net/bpf.c:1.150 src/sys/net/bpf.c:1.151
--- src/sys/net/bpf.c:1.150	Sun Dec 20 09:36:06 2009
+++ src/sys/net/bpf.c	Fri Jan 15 22:16:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.150 2009/12/20 09:36:06 dsl Exp $	*/
+/*	$NetBSD: bpf.c,v 1.151 2010/01/15 22:16:46 pooka Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.150 2009/12/20 09:36:06 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.151 2010/01/15 22:16:46 pooka Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -361,23 +361,16 @@
 
 
 /*
- * Mark a descriptor free by making it point to itself.
- * This is probably cheaper than marking with a constant since
- * the address should be in a register anyway.
- */
-
-/*
  * bpfilterattach() is called at boot time.
  */
 /* ARGSUSED */
 void
 bpfilterattach(int n)
 {
+
 	mutex_init(&bpf_mtx, MUTEX_DEFAULT, IPL_NONE);
 
-	mutex_enter(&bpf_mtx);
 	LIST_INIT(&bpf_list);
-	mutex_exit(&bpf_mtx);
 
 	bpf_gstats.bs_recv = 0;
 	bpf_gstats.bs_drop = 0;



CVS commit: src/doc

2010-01-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jan 15 20:59:00 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
Note sparc apc(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1342 -r1.1343 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1342 src/doc/CHANGES:1.1343
--- src/doc/CHANGES:1.1342	Thu Jan 14 07:47:53 2010
+++ src/doc/CHANGES	Fri Jan 15 20:59:00 2010
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1342 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1343 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -518,3 +518,6 @@
 	cobalt: Add LBA48 support to bootloader so that it can safely load
 		a kernel from NetBSD partition beyond >137GB boundary.
 		[tsutsui 20100110]
+	sparc: Add apc(4), a driver for the Aurora Personality Chip (APC)
+		found on SPARCstation-4/5 and qemu. Allows to idle the
+		CPU when in the idle loop.  [bouyer 20100115]



CVS commit: src/sys/arch/ofppc/ofppc

2010-01-15 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Fri Jan 15 20:57:25 UTC 2010

Modified Files:
src/sys/arch/ofppc/ofppc: mainbus.c

Log Message:
Fixed crash, when /rtas was not found: OF_finddevice() returns -1 when
the device is not found.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/ofppc/ofppc/mainbus.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/ofppc/ofppc/mainbus.c
diff -u src/sys/arch/ofppc/ofppc/mainbus.c:1.23 src/sys/arch/ofppc/ofppc/mainbus.c:1.24
--- src/sys/arch/ofppc/ofppc/mainbus.c:1.23	Mon Apr 28 20:23:31 2008
+++ src/sys/arch/ofppc/ofppc/mainbus.c	Fri Jan 15 20:57:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.23 2008/04/28 20:23:31 martin Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.24 2010/01/15 20:57:25 phx Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.23 2008/04/28 20:23:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.24 2010/01/15 20:57:25 phx Exp $");
 
 #include "opt_interrupt.h"
 #include "opt_multiprocessor.h"
@@ -233,7 +233,7 @@
 
 	/* Find rtas first */
 	rtnode = OF_finddevice("/rtas");
-	if (rtnode) {
+	if (rtnode != -1) {
 		memset(name, 0, sizeof(name));
 		if (OF_getprop(rtnode, "name", name, sizeof(name)) != -1) {
 			ca.ca_name = name;



CVS commit: src/sys

2010-01-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jan 15 20:57:13 UTC 2010

Modified Files:
src/sys/arch/sparc/conf: GENERIC files.sparc
src/sys/dev: DEVNAMES
Added Files:
src/sys/arch/sparc/dev: apc.c apcreg.h

Log Message:
Add apc(4), a driver for the Aurora Personality Chip (APC) found
on SPARCstation-4/5, and emulated by qemu to idle the simulator
when the CPU is idle. Infos about the registers from the linux driver.
Not enabled by default because it can cause some Sparc systems to
hang (so says the linux driver).
Only the CPU idle part implemented at this time; fan speed and
Convenience power outlet management to be added.
Tested on qemu.


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/sparc/conf/files.sparc
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/dev/apc.c \
src/sys/arch/sparc/dev/apcreg.h
cvs rdiff -u -r1.254 -r1.255 src/sys/dev/DEVNAMES

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/sparc/conf/GENERIC
diff -u src/sys/arch/sparc/conf/GENERIC:1.218 src/sys/arch/sparc/conf/GENERIC:1.219
--- src/sys/arch/sparc/conf/GENERIC:1.218	Sat Dec  5 20:11:17 2009
+++ src/sys/arch/sparc/conf/GENERIC	Fri Jan 15 20:57:12 2010
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.218 2009/12/05 20:11:17 pooka Exp $
+# $NetBSD: GENERIC,v 1.219 2010/01/15 20:57:12 bouyer Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.218 $"
+#ident 		"GENERIC-$Revision: 1.219 $"
 
 maxusers	32
 
@@ -712,6 +712,10 @@
 # Tadpole microcontroller
 tctrl0 at obio0
 
+# Aurora Personality Chip (APC) on SPARCstation-4/5
+# Not enabled by default as it may hang some systems
+#apc*		at sbus? slot ? offset ?
+
 ## Pseudo ttys, required for network logins and programs like screen.
 
 pseudo-device	pty			# pseudo-terminals

Index: src/sys/arch/sparc/conf/files.sparc
diff -u src/sys/arch/sparc/conf/files.sparc:1.148 src/sys/arch/sparc/conf/files.sparc:1.149
--- src/sys/arch/sparc/conf/files.sparc:1.148	Sun Sep 27 13:27:44 2009
+++ src/sys/arch/sparc/conf/files.sparc	Fri Jan 15 20:57:12 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc,v 1.148 2009/09/27 13:27:44 tsutsui Exp $
+#	$NetBSD: files.sparc,v 1.149 2010/01/15 20:57:12 bouyer Exp $
 
 # @(#)files.sparc	8.1 (Berkeley) 7/19/93
 # sparc-specific configuration info
@@ -224,6 +224,10 @@
 file	arch/sparc/dev/audioamd.c		audioamd
 file	arch/sparc/sparc/amd7930intr.s		audioamd
 
+device	apc
+attach	apc at sbus
+file	arch/sparc/dev/apc.c			apc
+
 attach bwtwo at obio with bwtwo_obio
 file	arch/sparc/dev/bwtwo_obio.c	bwtwo_obio & obio
 

Index: src/sys/dev/DEVNAMES
diff -u src/sys/dev/DEVNAMES:1.254 src/sys/dev/DEVNAMES:1.255
--- src/sys/dev/DEVNAMES:1.254	Thu Jan  7 09:24:45 2010
+++ src/sys/dev/DEVNAMES	Fri Jan 15 20:57:13 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: DEVNAMES,v 1.254 2010/01/07 09:24:45 jdc Exp $
+#	$NetBSD: DEVNAMES,v 1.255 2010/01/15 20:57:13 bouyer Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -81,6 +81,7 @@
 ams			macppc
 an			MI
 ap			newsmips
+apc			sparc
 apecs			alpha
 apm			i386
 aps			MI

Added files:

Index: src/sys/arch/sparc/dev/apc.c
diff -u /dev/null src/sys/arch/sparc/dev/apc.c:1.1
--- /dev/null	Fri Jan 15 20:57:13 2010
+++ src/sys/arch/sparc/dev/apc.c	Fri Jan 15 20:57:12 2010
@@ -0,0 +1,97 @@
+/*	$NetBSD: apc.c,v 1.1 2010/01/15 20:57:12 bouyer Exp $	*/
+
+/*
+ * Copyright (c) 2010 Manuel Bouyer.
+ *
+ * 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 ``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 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 

CVS commit: src/sys/rump/librump/rumpkern

2010-01-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan 15 20:39:46 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: rump.c

Log Message:
Accomplish messy stack with slightly less messy code.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/rump/librump/rumpkern/rump.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/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.150 src/sys/rump/librump/rumpkern/rump.c:1.151
--- src/sys/rump/librump/rumpkern/rump.c:1.150	Fri Jan 15 19:01:04 2010
+++ src/sys/rump/librump/rumpkern/rump.c	Fri Jan 15 20:39:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.150 2010/01/15 19:01:04 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.151 2010/01/15 20:39:46 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.150 2010/01/15 19:01:04 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.151 2010/01/15 20:39:46 pooka Exp $");
 
 #include 
 #include 
@@ -145,18 +145,10 @@
 rump_proc_vfs_init_fn rump_proc_vfs_init;
 rump_proc_vfs_release_fn rump_proc_vfs_release;
 
-/*
- * Stir up the stack a bit.  These are exported functions to help
- * convince the compiler that we don't want these routines completely
- * optimized out or inlined.  Is there an easier way to do this?
- */
-void nullfn(uint32_t *);
-void nullfn(uint32_t *arg){}
-void messthestack(void);
-void
+static void __noinline
 messthestack(void)
 {
-	uint32_t mess[64];
+	volatile uint32_t mess[64];
 	uint64_t d1, d2;
 	int i, error;
 
@@ -164,7 +156,6 @@
 		rumpuser_gettime(&d1, &d2, &error);
 		mess[i] = d2;
 	}
-	nullfn(mess);
 }
 
 int



CVS commit: src/sys/dev/ic

2010-01-15 Thread Matthew Jacob
Module Name:src
Committed By:   mjacob
Date:   Fri Jan 15 20:09:09 UTC 2010

Modified Files:
src/sys/dev/ic: isp.c

Log Message:
Amazingly, we've been freeing a handle and then using that which it referred
to for years. Bad.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/ic/isp.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/ic/isp.c
diff -u src/sys/dev/ic/isp.c:1.119 src/sys/dev/ic/isp.c:1.120
--- src/sys/dev/ic/isp.c:1.119	Tue Jan  5 13:30:10 2010
+++ src/sys/dev/ic/isp.c	Fri Jan 15 20:09:09 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.119 2010/01/05 13:30:10 mbalmer Exp $ */
+/* $NetBSD: isp.c,v 1.120 2010/01/15 20:09:09 mjacob Exp $ */
 /*
  * Machine and OS Independent (well, as best as possible)
  * code for the Qlogic ISP SCSI adapters.
@@ -43,7 +43,7 @@
  */
 #ifdef	__NetBSD__
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.119 2010/01/05 13:30:10 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.120 2010/01/15 20:09:09 mjacob Exp $");
 #include 
 #endif
 #ifdef	__FreeBSD__
@@ -5187,7 +5187,6 @@
 			ISP_WRITE(isp, isp->isp_respoutrp, optr);
 			continue;
 		}
-		isp_destroy_handle(isp, sp->req_handle);
 		if (req_status_flags & RQSTF_BUS_RESET) {
 			XS_SETERR(xs, HBA_BUSRESET);
 			ISP_SET_SENDMARKER(isp, XS_CHANNEL(xs), 1);
@@ -5323,6 +5322,7 @@
 		if (XS_XFRLEN(xs)) {
 			ISP_DMAFREE(isp, xs, sp->req_handle);
 		}
+		isp_destroy_handle(isp, sp->req_handle);
 
 		if (((isp->isp_dblev & (ISP_LOGDEBUG1|ISP_LOGDEBUG2|ISP_LOGDEBUG3))) ||
 		((isp->isp_dblev & ISP_LOGDEBUG0) && ((!XS_NOERR(xs)) ||



CVS commit: src/sys/ufs/ufs

2010-01-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jan 15 19:46:35 UTC 2010

Modified Files:
src/sys/ufs/ufs: ufs_quota.c

Log Message:
vclean() actually sets v_tag to VT_NON but doesn't touch v_type.
getcleanvnode() sets v_type to VNON after releasing v_interlock.
So the thread doing quotaon(), quotaoff() or qsync() could vget()
a vnode which is being recycled in getcleanvnode(), after is has
been cleaned and v_interlock released, but before v_type has been
reset, leading to KASSERT(vp->v_usecount == 1) firing in
getnewvnode(), or qsync() dereferending a NULL pointer as in
PR kern/42205.
Fix by using the same tests as other ffs function traversing the mount
list: also check for VTOI(vp) == NULL, and VI_XLOCK in addition
to VI_CLEAN.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/ufs/ufs/ufs_quota.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/ufs/ufs/ufs_quota.c
diff -u src/sys/ufs/ufs/ufs_quota.c:1.64 src/sys/ufs/ufs/ufs_quota.c:1.65
--- src/sys/ufs/ufs/ufs_quota.c:1.64	Sun Aug  2 20:50:33 2009
+++ src/sys/ufs/ufs/ufs_quota.c	Fri Jan 15 19:46:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_quota.c,v 1.64 2009/08/02 20:50:33 bouyer Exp $	*/
+/*	$NetBSD: ufs_quota.c,v 1.65 2010/01/15 19:46:35 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.64 2009/08/02 20:50:33 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.65 2010/01/15 19:46:35 bouyer Exp $");
 
 #include 
 #include 
@@ -475,9 +475,9 @@
 	for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
 		vmark(mvp, vp);
 		mutex_enter(&vp->v_interlock);
-		if (vp->v_mount != mp || vismarker(vp) ||
+		if (VTOI(vp) == NULL || vp->v_mount != mp || vismarker(vp) ||
 		vp->v_type == VNON || vp->v_writecount == 0 ||
-		(vp->v_iflag & VI_CLEAN) != 0) {
+		(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) {
 			mutex_exit(&vp->v_interlock);
 			continue;
 		}
@@ -545,8 +545,9 @@
 	for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
 		vmark(mvp, vp);
 		mutex_enter(&vp->v_interlock);
-		if (vp->v_mount != mp || vismarker(vp) || vp->v_type == VNON ||
-		(vp->v_iflag & VI_CLEAN) != 0) {
+		if (VTOI(vp) == NULL || vp->v_mount != mp || vismarker(vp) ||
+		vp->v_type == VNON ||
+		(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) {
 			mutex_exit(&vp->v_interlock);
 			continue;
 		}
@@ -730,8 +731,9 @@
 	for (vp = TAILQ_FIRST(&mp->mnt_vnodelist); vp; vp = vunmark(mvp)) {
 		vmark(mvp, vp);
 		mutex_enter(&vp->v_interlock);
-		if (vp->v_mount != mp || vismarker(vp) || vp->v_type == VNON ||
-		(vp->v_iflag & VI_CLEAN) != 0) {
+		if (VTOI(vp) == NULL || vp->v_mount != mp || vismarker(vp) ||
+		vp->v_type == VNON ||
+		(vp->v_iflag & (VI_XLOCK | VI_CLEAN)) != 0) {
 			mutex_exit(&vp->v_interlock);
 			continue;
 		}



CVS commit: src/usr.bin/bdes

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:40:18 UTC 2010

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

Log Message:
Use .%U instead of .%O for URLs.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/bdes/bdes.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/bdes/bdes.1
diff -u src/usr.bin/bdes/bdes.1:1.13 src/usr.bin/bdes/bdes.1:1.14
--- src/usr.bin/bdes/bdes.1:1.13	Fri Jun  4 10:28:37 2004
+++ src/usr.bin/bdes/bdes.1	Fri Jan 15 19:40:17 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bdes.1,v 1.13 2004/06/04 10:28:37 wiz Exp $
+.\"	$NetBSD: bdes.1,v 1.14 2010/01/15 19:40:17 joerg Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -312,7 +312,7 @@
 .%A Wiener
 .%T Minimal Key Lengths for Symmetric Ciphers To Provide Adequate Commercial Security
 .%I Business Software Alliance
-.%O http://www.bsa.org/policy/encryption/cryptographers.html
+.%U http://www.bsa.org/policy/encryption/cryptographers.html
 .%D January 1996
 .Re
 .Sh BUGS



CVS commit: src/games/dab

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:39:10 UTC 2010

Modified Files:
src/games/dab: dab.6

Log Message:
Use .%U instead of .%O for URLs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/games/dab/dab.6

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

Modified files:

Index: src/games/dab/dab.6
diff -u src/games/dab/dab.6:1.4 src/games/dab/dab.6:1.5
--- src/games/dab/dab.6:1.4	Thu May  8 15:31:07 2008
+++ src/games/dab/dab.6	Fri Jan 15 19:39:10 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dab.6,v 1.4 2008/05/08 15:31:07 wiz Exp $
+.\"	$NetBSD: dab.6,v 1.5 2010/01/15 19:39:10 joerg Exp $
 .\"
 .\" Copyright (c) 2003 Thomas Klausner.
 .\"
@@ -101,7 +101,7 @@
 .%T The Dots and Boxes Game: Sophisticated Child's Play
 .%D 2000
 .%I A K Peters
-.%O http://www.akpeters.com/book.asp?bID=111
+.%U http://www.akpeters.com/book.asp?bID=111
 .Re
 .Sh AUTHORS
 .An Christos Zoulas



CVS commit: src/sys/kern

2010-01-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jan 15 19:28:26 UTC 2010

Modified Files:
src/sys/kern: vfs_subr.c

Log Message:
Revert previous. The KASSERT() is right and my analysis is wrong,
as pointed out by po...@.


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 src/sys/kern/vfs_subr.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/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.396 src/sys/kern/vfs_subr.c:1.397
--- src/sys/kern/vfs_subr.c:1.396	Thu Jan 14 22:41:52 2010
+++ src/sys/kern/vfs_subr.c	Fri Jan 15 19:28:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.396 2010/01/14 22:41:52 bouyer Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.397 2010/01/15 19:28:26 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.396 2010/01/14 22:41:52 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.397 2010/01/15 19:28:26 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -641,6 +641,7 @@
 		vp->v_socket = NULL;
 	}
 
+	KASSERT(vp->v_usecount == 1);
 	KASSERT(vp->v_freelisthd == NULL);
 	KASSERT(LIST_EMPTY(&vp->v_nclist));
 	KASSERT(LIST_EMPTY(&vp->v_dnclist));
@@ -681,6 +682,7 @@
 ungetnewvnode(vnode_t *vp)
 {
 
+	KASSERT(vp->v_usecount == 1);
 	KASSERT(vp->v_data == NULL);
 	KASSERT(vp->v_freelisthd == NULL);
 



CVS commit: src/share/man/man4

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:24:49 UTC 2010

Modified Files:
src/share/man/man4: acpi.4 atw.4 aue.4 awi.4 axe.4 cas.4 cdce.4 faith.4
gem.4 hme.4 ipw.4 iwi.4 re.4 rtw.4 sk.4 slhci.4 udav.4 wi.4 wpi.4
src/share/man/man4/man4.i386: ndis.4

Log Message:
Use .%U instead of .%O for URLs.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man4/acpi.4
cvs rdiff -u -r1.11 -r1.12 src/share/man/man4/atw.4
cvs rdiff -u -r1.16 -r1.17 src/share/man/man4/aue.4 src/share/man/man4/iwi.4
cvs rdiff -u -r1.27 -r1.28 src/share/man/man4/awi.4
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/axe.4 src/share/man/man4/cdce.4 \
src/share/man/man4/ipw.4
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/cas.4 src/share/man/man4/udav.4
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/faith.4 src/share/man/man4/sk.4
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/gem.4
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/hme.4
cvs rdiff -u -r1.12 -r1.13 src/share/man/man4/re.4 src/share/man/man4/wpi.4
cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/rtw.4
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/slhci.4
cvs rdiff -u -r1.37 -r1.38 src/share/man/man4/wi.4
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/man4.i386/ndis.4

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/man4/acpi.4
diff -u src/share/man/man4/acpi.4:1.30 src/share/man/man4/acpi.4:1.31
--- src/share/man/man4/acpi.4:1.30	Sun May 17 00:37:53 2009
+++ src/share/man/man4/acpi.4	Fri Jan 15 19:24:49 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpi.4,v 1.30 2009/05/17 00:37:53 fair Exp $
+.\" $NetBSD: acpi.4,v 1.31 2010/01/15 19:24:49 joerg Exp $
 .\"
 .\" Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -257,11 +257,11 @@
 .Xr amldb 8
 .Rs
 .%T ACPI specification
-.%O http://www.acpi.info/
+.%U http://www.acpi.info/
 .Re
 .Rs
 .%T Intel ACPI CA (Component Architecture)
-.%O http://developer.intel.com/technology/iapc/acpi/
+.%U http://developer.intel.com/technology/iapc/acpi/
 .Re
 .Sh HISTORY
 The

Index: src/share/man/man4/atw.4
diff -u src/share/man/man4/atw.4:1.11 src/share/man/man4/atw.4:1.12
--- src/share/man/man4/atw.4:1.11	Mon Oct 19 23:19:38 2009
+++ src/share/man/man4/atw.4	Fri Jan 15 19:24:49 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: atw.4,v 1.11 2009/10/19 23:19:38 rmind Exp $
+.\" $NetBSD: atw.4,v 1.12 2010/01/15 19:24:49 joerg Exp $
 .\"
 .\" Copyright (c) 2003
 .\"	David Young . All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\"	$Id: atw.4,v 1.11 2009/10/19 23:19:38 rmind Exp $
+.\"	$Id: atw.4,v 1.12 2010/01/15 19:24:49 joerg Exp $
 .\"
 .Dd June 5, 2004
 .Dt ATW 4
@@ -131,15 +131,15 @@
 .Xr ifconfig 8
 .Rs
 .%T ADMtek
-.%O http://www.admtek.com.tw
+.%U http://www.admtek.com.tw
 .Re
 .Rs
 .%T Silicon Laboratories
-.%O http://www.silabs.com
+.%U http://www.silabs.com
 .Re
 .Rs
 .%T RF Microdevicdes
-.%O http://www.rfmd.com
+.%U http://www.rfmd.com
 .Re
 .Sh HISTORY
 The

Index: src/share/man/man4/aue.4
diff -u src/share/man/man4/aue.4:1.16 src/share/man/man4/aue.4:1.17
--- src/share/man/man4/aue.4:1.16	Mon Jan  5 05:12:54 2004
+++ src/share/man/man4/aue.4	Fri Jan 15 19:24:49 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: aue.4,v 1.16 2004/01/05 05:12:54 grant Exp $
+.\"	$NetBSD: aue.4,v 1.17 2010/01/15 19:24:49 joerg Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 1999
 .\" Bill Paul . All rights reserved.
@@ -151,7 +151,7 @@
 .Xr ifconfig 8
 .Rs
 .%T ADMtek AN986 data sheet
-.%O http://www.admtek.com.tw
+.%U http://www.admtek.com.tw
 .Re
 .Sh HISTORY
 The
Index: src/share/man/man4/iwi.4
diff -u src/share/man/man4/iwi.4:1.16 src/share/man/man4/iwi.4:1.17
--- src/share/man/man4/iwi.4:1.16	Mon Mar  9 19:24:28 2009
+++ src/share/man/man4/iwi.4	Fri Jan 15 19:24:49 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: iwi.4,v 1.16 2009/03/09 19:24:28 joerg Exp $
+.\" $NetBSD: iwi.4,v 1.17 2010/01/15 19:24:49 joerg Exp $
 .\"
 .\" Copyright (c) 2004, 2005
 .\"	Damien Bergamini . All rights reserved.
@@ -91,7 +91,7 @@
 .Xr firmload 9
 .Rs
 .%T The IWI Web Page
-.%O http://damien.bergamini.free.fr/ipw/
+.%U http://damien.bergamini.free.fr/ipw/
 .Re
 .Sh AUTHORS
 The

Index: src/share/man/man4/awi.4
diff -u src/share/man/man4/awi.4:1.27 src/share/man/man4/awi.4:1.28
--- src/share/man/man4/awi.4:1.27	Wed Apr 30 13:10:53 2008
+++ src/share/man/man4/awi.4	Fri Jan 15 19:24:49 2010
@@ -1,4 +1,4 @@
-.\" $NetBSD: awi.4,v 1.27 2008/04/30 13:10:53 martin Exp $
+.\" $NetBSD: awi.4,v 1.28 2010/01/15 19:24:49 joerg Exp $
 .\"
 .\" Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -167,7 +167,7 @@
 .Xr wiconfig 8
 .Rs
 .%T Am79C930 PCnet Mobile Single-Chip Wireless LAN Media Access Controller
-.%O http://www.amd.com
+.%U http://www.amd.com
 .Re
 .Sh HISTORY
 The

Index: src/sha

CVS commit: src/share/man/man4

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:23:38 UTC 2010

Modified Files:
src/share/man/man4: gif.4

Log Message:
Use .%U. Give full URL for draft-ietf-ipsec-ecn-02.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/share/man/man4/gif.4

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/man4/gif.4
diff -u src/share/man/man4/gif.4:1.29 src/share/man/man4/gif.4:1.30
--- src/share/man/man4/gif.4:1.29	Mon Aug 24 10:15:25 2009
+++ src/share/man/man4/gif.4	Fri Jan 15 19:23:38 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: gif.4,v 1.29 2009/08/24 10:15:25 joerg Exp $
+.\"	$NetBSD: gif.4,v 1.30 2010/01/15 19:23:38 joerg Exp $
 .\"	$KAME: gif.4,v 1.24 2001/02/20 12:54:01 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -28,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 18, 2006
+.Dd January 15, 2009
 .Dt GIF 4
 .Os
 .Sh NAME
@@ -214,7 +214,7 @@
 .%B RFC 2003
 .%T IP Encapsulation within IP
 .%D October 1996
-.%O ftp://ftp.isi.edu/in-notes/rfc2003.txt
+.%U ftp://ftp.isi.edu/in-notes/rfc2003.txt
 .Re
 .Rs
 .%A R. Gilligan
@@ -222,7 +222,7 @@
 .%B RFC 2893
 .%T Transition Mechanisms for IPv6 Hosts and Routers
 .%D August 2000
-.%O ftp://ftp.isi.edu/in-notes/rfc2893.txt
+.%U ftp://ftp.isi.edu/in-notes/rfc2893.txt
 .Re
 .Rs
 .%A Sally Floyd
@@ -230,7 +230,7 @@
 .%A K. K. Ramakrishnan
 .%T "IPsec Interactions with ECN"
 .%D December 1999
-.%O draft-ietf-ipsec-ecn-02.txt
+.%U http://datatracker.ietf.org/internet-drafts/draft-ietf-ipsec-ecn/
 .Re
 .Rs
 .%A F. Baker
@@ -238,7 +238,7 @@
 .%B RFC 3704
 .%T Ingress Filtering for Multihomed Networks
 .%D March 2004
-.%O ftp://ftp.isi.edu/in-notes/rfc3704.txt
+.%U ftp://ftp.isi.edu/in-notes/rfc3704.txt
 .Re
 .\"
 .Sh STANDARDS



CVS commit: src/usr.sbin/faithd

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:19:32 UTC 2010

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

Log Message:
Use .%U for URLs instead of .%O.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/faithd/faithd.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/faithd/faithd.8
diff -u src/usr.sbin/faithd/faithd.8:1.27 src/usr.sbin/faithd/faithd.8:1.28
--- src/usr.sbin/faithd/faithd.8:1.27	Sat Jan  9 10:43:11 2010
+++ src/usr.sbin/faithd/faithd.8	Fri Jan 15 19:19:32 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: faithd.8,v 1.27 2010/01/09 10:43:11 mbalmer Exp $
+.\"	$NetBSD: faithd.8,v 1.28 2010/01/15 19:19:32 joerg Exp $
 .\"	$KAME: faithd.8,v 1.37 2002/05/09 14:21:23 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -369,7 +369,7 @@
 .%A Kazu Yamamoto
 .%T "An IPv6-to-IPv4 transport relay translator"
 .%B RFC 3142
-.%O ftp://ftp.isi.edu/in-notes/rfc3142.txt
+.%U ftp://ftp.isi.edu/in-notes/rfc3142.txt
 .%D June 2001
 .Re
 .\"



CVS commit: src/crypto/dist/ipsec-tools/src/setkey

2010-01-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jan 15 19:18:51 UTC 2010

Modified Files:
src/crypto/dist/ipsec-tools/src/setkey: setkey.8

Log Message:
Use .%U instead of .%O for URLs.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/crypto/dist/ipsec-tools/src/setkey/setkey.8

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/setkey/setkey.8
diff -u src/crypto/dist/ipsec-tools/src/setkey/setkey.8:1.21 src/crypto/dist/ipsec-tools/src/setkey/setkey.8:1.22
--- src/crypto/dist/ipsec-tools/src/setkey/setkey.8:1.21	Wed Oct 14 18:34:14 2009
+++ src/crypto/dist/ipsec-tools/src/setkey/setkey.8	Fri Jan 15 19:18:51 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: setkey.8,v 1.21 2009/10/14 18:34:14 joerg Exp $
+.\"	$NetBSD: setkey.8,v 1.22 2010/01/15 19:18:51 joerg Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
 .\" All rights reserved.
@@ -796,7 +796,7 @@
 .Xr sysctl 8
 .Rs
 .%T "Changed manual key configuration for IPsec"
-.%O "http://www.kame.net/newsletter/19991007/";
+.%U "http://www.kame.net/newsletter/19991007/";
 .%D "October 1999"
 .Re
 .\"



CVS commit: src/sys/rump/librump/rumpkern

2010-01-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan 15 19:01:04 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern emul.c memalloc.c
rump.c
Removed Files:
src/sys/rump/librump/rumpkern: percpu.c

Log Message:
Use subr_percpu.c instead of homegrown implementation.  ...except
when using malloc(3)-relegated allocators (happens in production
e.g. on Linux), since subr_percpu.c uses vmem and i don't want to
reimplement vmem.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.118 -r1.119 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpkern/memalloc.c
cvs rdiff -u -r1.6 -r0 src/sys/rump/librump/rumpkern/percpu.c
cvs rdiff -u -r1.149 -r1.150 src/sys/rump/librump/rumpkern/rump.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/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.70 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.71
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.70	Wed Dec 16 21:25:55 2009
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Fri Jan 15 19:01:04 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.70 2009/12/16 21:25:55 pooka Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.71 2010/01/15 19:01:04 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -16,8 +16,8 @@
 # Source modules, first the ones specifically implemented for librump.
 # 
 SRCS=	rump.c rumpcopy.c emul.c intr.c locks.c ltsleep.c	\
-	memalloc.c percpu.c scheduler.c sleepq.c		\
-	sysproxy_socket.c threads.c vm.c
+	memalloc.c scheduler.c sleepq.c	sysproxy_socket.c	\
+	threads.c vm.c
 
 vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh
 	${_MKMSG_CREATE} vers.c
@@ -69,7 +69,7 @@
 # corner cases as well (not to mention if you want to debug the
 # allocators themselves).
 #CPPFLAGS+=	-DRUMP_USE_UNREAL_ALLOCATORS
-SRCS+=		subr_kmem.c subr_pool.c subr_vmem.c
+SRCS+=		subr_kmem.c subr_percpu.c subr_pool.c subr_vmem.c
 
 # no shlib_version because this is automatically in sync with lib/librump
 SHLIB_MAJOR=0

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.118 src/sys/rump/librump/rumpkern/emul.c:1.119
--- src/sys/rump/librump/rumpkern/emul.c:1.118	Wed Jan 13 01:53:38 2010
+++ src/sys/rump/librump/rumpkern/emul.c	Fri Jan 15 19:01:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.118 2010/01/13 01:53:38 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.119 2010/01/15 19:01:04 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.118 2010/01/13 01:53:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.119 2010/01/15 19:01:04 pooka Exp $");
 
 #include 
 #include 
@@ -384,11 +384,22 @@
 }
 void (*delay_func)(unsigned int) = rump_delay;
 
+bool
+kpreempt(uintptr_t where)
+{
+
+	return false;
+}
+
+/*
+ * There is no kernel thread preemption in rump currently.  But call
+ * the implementing macros anyway in case they grow some side-effects
+ * down the road.
+ */
 void
 kpreempt_disable(void)
 {
 
-	/* XXX: see below */
 	KPREEMPT_DISABLE(curlwp);
 }
 
@@ -396,8 +407,7 @@
 kpreempt_enable(void)
 {
 
-	/* try to make sure kpreempt_disable() is only used from panic() */
-	panic("kpreempt not supported");
+	KPREEMPT_ENABLE(curlwp);
 }
 
 void

Index: src/sys/rump/librump/rumpkern/memalloc.c
diff -u src/sys/rump/librump/rumpkern/memalloc.c:1.4 src/sys/rump/librump/rumpkern/memalloc.c:1.5
--- src/sys/rump/librump/rumpkern/memalloc.c:1.4	Mon Jan 11 19:19:57 2010
+++ src/sys/rump/librump/rumpkern/memalloc.c	Fri Jan 15 19:01:04 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: memalloc.c,v 1.4 2010/01/11 19:19:57 stacktic Exp $	*/
+/*	$NetBSD: memalloc.c,v 1.5 2010/01/15 19:01:04 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,16 +26,19 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.4 2010/01/11 19:19:57 stacktic Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memalloc.c,v 1.5 2010/01/15 19:01:04 pooka Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
 
+#include "rump_private.h"
+
 /*
  * Allocator "implementations" which relegate tasks to the host
  * libc malloc.
@@ -325,4 +328,62 @@
 
 	return;
 }
+
+/*
+ * A simplified percpu is included in here since subr_percpu.c uses
+ * the vmem allocator and I don't want to reimplement vmem.  So use
+ * this simplified percpu for non-vmem systems.
+ */
+
+static kmutex_t pcmtx;
+
+void
+percpu_init(void)
+{
+
+	mutex_init(&pcmtx, MUTEX_DEFAULT, IPL_NONE);
+}
+
+void
+percpu_init_cpu(struct cpu_info *ci)
+{
+
+	/* nada */
+}
+
+void *
+percpu_getref(percpu_t *pc)
+{
+
+	mutex_enter(&pcmtx);
+	return pc;
+}
+
+void
+percpu_putref(percpu_t *pc)
+{
+

CVS commit: src/sys/rump/net/rumptest

2010-01-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Jan 15 18:38:16 UTC 2010

Modified Files:
src/sys/rump/net/rumptest: rumptest_net.c

Log Message:
print mbuf statistics a few times.  incidentally, can be used to
test percpu.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/net/rumptest/rumptest_net.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/rump/net/rumptest/rumptest_net.c
diff -u src/sys/rump/net/rumptest/rumptest_net.c:1.12 src/sys/rump/net/rumptest/rumptest_net.c:1.13
--- src/sys/rump/net/rumptest/rumptest_net.c:1.12	Tue Oct 20 00:25:26 2009
+++ src/sys/rump/net/rumptest/rumptest_net.c	Fri Jan 15 18:38:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumptest_net.c,v 1.12 2009/10/20 00:25:26 pooka Exp $	*/
+/*	$NetBSD: rumptest_net.c,v 1.13 2010/01/15 18:38:16 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -28,9 +28,11 @@
  * SUCH DAMAGE.
  */
 
-#include 
+#include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -44,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define DEST_ADDR "204.152.190.12"	/* www.NetBSD.org */
 #define DEST_PORT 80			/* take a wild guess */
@@ -163,6 +166,30 @@
 }
 #endif /* FULL_NETWORK_STACK */
 
+static void
+printstats(void)
+{
+	struct mbstat mbstat;
+	int ctl[] = { CTL_KERN, KERN_MBUF, MBUF_STATS };
+	int totalmbuf = 0;
+	size_t mbslen = sizeof(struct mbstat);
+	unsigned i;
+
+	if (rump_sys___sysctl(ctl, __arraycount(ctl), &mbstat, &mbslen,
+	NULL, 0) == -1)
+		return;
+
+	printf("  mbuf count:\n");
+	for (i = 0; i < __arraycount(mbstat.m_mtypes); i++) {
+		if (mbstat.m_mtypes[i] == 0)
+			continue;
+		printf("%s (%d) mbuf count %d\n",
+		i == MT_DATA ? "data" : "unknown", i, mbstat.m_mtypes[i]);
+		totalmbuf += mbstat.m_mtypes[i];
+	}
+	printf("total mbufs: %d\n", totalmbuf);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -199,6 +226,8 @@
 		err(1, "connect failed");
 	}
 
+	printstats();
+
 	printf("connected\n");
 
 	strcpy(buf, "GET / HTTP/1.0\n\n");
@@ -206,6 +235,11 @@
 	if (n != (ssize_t)strlen(buf))
 		err(1, "wrote only %zd vs. %zu\n",
 		n, strlen(buf));
+
+	/* wait for mbufs to accumulate.  hacky, but serves purpose.  */
+	sleep(1);
+	printstats();
+	sleep(1);
 	
 	memset(buf, 0, sizeof(buf));
 	for (off = 0; off < sizeof(buf) && n > 0;) {



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

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 15:05:02 UTC 2010

Modified Files:
src/sys/arch/sparc64/include: psl.h

Log Message:
Add function names defined by macro in comment for reference.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sparc64/include/psl.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/sparc64/include/psl.h
diff -u src/sys/arch/sparc64/include/psl.h:1.43 src/sys/arch/sparc64/include/psl.h:1.44
--- src/sys/arch/sparc64/include/psl.h:1.43	Fri Dec  4 17:31:06 2009
+++ src/sys/arch/sparc64/include/psl.h	Fri Jan 15 15:05:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.43 2009/12/04 17:31:06 nakayama Exp $ */
+/*	$NetBSD: psl.h,v 1.44 2010/01/15 15:05:02 nakayama Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -287,22 +287,22 @@
 #endif
 
 /* Tick Register (PR 4) */
-SPARC64_GETPR64_DEF(tick)
-SPARC64_SETPR64_DEF(tick)
+SPARC64_GETPR64_DEF(tick)			/* gettick() */
+SPARC64_SETPR64_DEF(tick)			/* settick() */
 
 /* Processor State Register (PR 6) */
-SPARC64_GETPR_DEF(pstate, int)
-SPARC64_SETPR_DEF(pstate, int)
+SPARC64_GETPR_DEF(pstate, int)			/* getpstate() */
+SPARC64_SETPR_DEF(pstate, int)			/* setpstate() */
 
 /* Trap Level Register (PR 7) */
-SPARC64_GETPR_DEF(tl, int)
+SPARC64_GETPR_DEF(tl, int)			/* gettl() */
 
 /* Current Window Pointer Register (PR 9) */
-SPARC64_GETPR_DEF(cwp, int)
-SPARC64_SETPR_DEF(cwp, int)
+SPARC64_GETPR_DEF(cwp, int)			/* getcwp() */
+SPARC64_SETPR_DEF(cwp, int)			/* setcwp() */
 
 /* Version Register (PR 31) */
-SPARC64_GETPR64_DEF(ver)
+SPARC64_GETPR64_DEF(ver)			/* getver() */
 
 static __inline int
 intr_disable(void)



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

2010-01-15 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jan 15 15:02:48 UTC 2010

Modified Files:
src/sys/arch/sparc64/include: pte.h

Log Message:
Fix typo in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc64/include/pte.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/sparc64/include/pte.h
diff -u src/sys/arch/sparc64/include/pte.h:1.21 src/sys/arch/sparc64/include/pte.h:1.22
--- src/sys/arch/sparc64/include/pte.h:1.21	Sat Dec  5 22:24:11 2009
+++ src/sys/arch/sparc64/include/pte.h	Fri Jan 15 15:02:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte.h,v 1.21 2009/12/05 22:24:11 mrg Exp $ */
+/*	$NetBSD: pte.h,v 1.22 2010/01/15 15:02:48 nakayama Exp $ */
 
 /*
  * Copyright (c) 1996-1999 Eduardo Horvath
@@ -49,7 +49,7 @@
  *			data_size:2,	(page size [8K*8**])
  *			data_nfo:1,	(no-fault only)
  *			data_ie:1,	(invert endianness [inefficient])
- *			data_soft9:9,	(reserved for S/W)
+ *			data_soft2:9,	(reserved for S/W)
  *			data_reserved:7,(reserved for future use)
  *			data_pa:30,	(physical address)
  *			data_soft:6,	(reserved for S/W)



CVS commit: src/tools/compat

2010-01-15 Thread Aleksej Saushev
Module Name:src
Committed By:   asau
Date:   Fri Jan 15 11:27:01 UTC 2010

Modified Files:
src/tools/compat: configure

Log Message:
Regenerate.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/tools/compat/configure

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

Modified files:

Index: src/tools/compat/configure
diff -u src/tools/compat/configure:1.70 src/tools/compat/configure:1.71
--- src/tools/compat/configure:1.70	Tue Jun 16 22:35:34 2009
+++ src/tools/compat/configure	Fri Jan 15 11:27:01 2010
@@ -2600,7 +2600,7 @@
 fi
 done
 
-for ac_header in sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h \
+for ac_header in sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h sys/endian.h \
 	sys/featuretest.h err.h inttypes.h libgen.h paths.h stdint.h util.h \
 	resolv.h arpa/nameser.h
 do



CVS commit: src/tools/compat

2010-01-15 Thread Aleksej Saushev
Module Name:src
Committed By:   asau
Date:   Fri Jan 15 11:26:25 UTC 2010

Modified Files:
src/tools/compat: configure.ac nbtool_config.h.in

Log Message:
Test for  and provide HAVE_SYS_ENDIAN_H.
Fixes FreeBSD hosted builds (PR 42440 and PR 42470).

Approved by .


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/tools/compat/configure.ac
cvs rdiff -u -r1.23 -r1.24 src/tools/compat/nbtool_config.h.in

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

Modified files:

Index: src/tools/compat/configure.ac
diff -u src/tools/compat/configure.ac:1.70 src/tools/compat/configure.ac:1.71
--- src/tools/compat/configure.ac:1.70	Tue Jun 16 22:35:34 2009
+++ src/tools/compat/configure.ac	Fri Jan 15 11:26:25 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: configure.ac,v 1.70 2009/06/16 22:35:34 christos Exp $
+#	$NetBSD: configure.ac,v 1.71 2010/01/15 11:26:25 asau Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -24,7 +24,7 @@
 AC_CONFIG_FILES(defs.mk)
 
 # Autoheader header and footer
-AH_TOP([/*  $NetBSD: configure.ac,v 1.70 2009/06/16 22:35:34 christos Exp $*/
+AH_TOP([/*  $NetBSD: configure.ac,v 1.71 2010/01/15 11:26:25 asau Exp $*/
  
 #ifndef __NETBSD_NBTOOL_CONFIG_H__
 #define __NETBSD_NBTOOL_CONFIG_H__])
@@ -80,7 +80,7 @@
 AC_HEADER_DIRENT
 AC_CHECK_HEADERS(sys/mtio.h sys/sysmacros.h sys/syslimits.h \
 	getopt.h features.h malloc.h sys/poll.h stddef.h)
-AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h \
+AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h sys/endian.h \
 	sys/featuretest.h err.h inttypes.h libgen.h paths.h stdint.h util.h \
 	resolv.h arpa/nameser.h,,
 	[test -f include/$ac_header || touch include/$ac_header])

Index: src/tools/compat/nbtool_config.h.in
diff -u src/tools/compat/nbtool_config.h.in:1.23 src/tools/compat/nbtool_config.h.in:1.24
--- src/tools/compat/nbtool_config.h.in:1.23	Tue Jun 16 22:35:34 2009
+++ src/tools/compat/nbtool_config.h.in	Fri Jan 15 11:26:25 2010
@@ -1,6 +1,6 @@
 /* nbtool_config.h.in.  Generated automatically from configure.ac by autoheader.  */
 
-/*  $NetBSD: nbtool_config.h.in,v 1.23 2009/06/16 22:35:34 christos Exp $*/
+/*  $NetBSD: nbtool_config.h.in,v 1.24 2010/01/15 11:26:25 asau Exp $*/
  
 #ifndef __NETBSD_NBTOOL_CONFIG_H__
 #define __NETBSD_NBTOOL_CONFIG_H__
@@ -336,6 +336,9 @@
 /* Define if you have the  header file. */
 #undef HAVE_MACHINE_ENDIAN_H
 
+/* Define if you have the  header file. */
+#undef HAVE_SYS_ENDIAN_H
+
 /* Define if you have the  header file. */
 #undef HAVE_MALLOC_H