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

2012-06-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jun 16 05:58:03 UTC 2012

Modified Files:
src/sys/arch/hpcarm/dev: nbppcon.c

Log Message:
Add '\n' to revision string.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hpcarm/dev/nbppcon.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/hpcarm/dev/nbppcon.c
diff -u src/sys/arch/hpcarm/dev/nbppcon.c:1.1 src/sys/arch/hpcarm/dev/nbppcon.c:1.2
--- src/sys/arch/hpcarm/dev/nbppcon.c:1.1	Sat Aug  6 03:53:40 2011
+++ src/sys/arch/hpcarm/dev/nbppcon.c	Sat Jun 16 05:58:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: nbppcon.c,v 1.1 2011/08/06 03:53:40 kiyohara Exp $ */
+/*	$NetBSD: nbppcon.c,v 1.2 2012/06/16 05:58:03 kiyohara Exp $ */
 /*
  * Copyright (c) 2011 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nbppcon.c,v 1.1 2011/08/06 03:53:40 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nbppcon.c,v 1.2 2012/06/16 05:58:03 kiyohara Exp $");
 
 #include 
 #include 
@@ -102,7 +102,7 @@ nbppcon_attach(device_t parent, device_t
 	rv = seeprom_bootstrap_read(sc->sc_tag, NVRAM_ADDR, 0x00, 128,
 	buf, sizeof(buf));
 	if (rv == 0)
-		aprint_normal_dev(self, "NETBOOK PRO Rev.%c",
+		aprint_normal_dev(self, "NETBOOK PRO Rev.%c\n",
 		buf[NVRAM_DATA_REV] - '0' + '@');
 	else
 		aprint_error_dev(self, "NVRAM read failed\n");



CVS commit: src/usr.sbin/npf/npfctl

2012-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 16 01:34:10 UTC 2012

Modified Files:
src/usr.sbin/npf/npfctl: npf_build.c

Log Message:
remove error(1) output


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/npf/npfctl/npf_build.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.sbin/npf/npfctl/npf_build.c
diff -u src/usr.sbin/npf/npfctl/npf_build.c:1.8 src/usr.sbin/npf/npfctl/npf_build.c:1.9
--- src/usr.sbin/npf/npfctl/npf_build.c:1.8	Fri Jun 15 21:31:33 2012
+++ src/usr.sbin/npf/npfctl/npf_build.c	Fri Jun 15 21:34:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_build.c,v 1.8 2012/06/16 01:31:33 christos Exp $	*/
+/*	$NetBSD: npf_build.c,v 1.9 2012/06/16 01:34:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_build.c,v 1.8 2012/06/16 01:31:33 christos Exp $");
+__RCSID("$NetBSD: npf_build.c,v 1.9 2012/06/16 01:34:10 christos Exp $");
 
 #include 
 #include 
@@ -438,8 +438,6 @@ npfctl_build_nat(int sd, int type, u_int
 const addr_port_t *ap2, const filt_opts_t *fopts)
 {
 	const opt_proto_t op = { .op_proto = -1, .op_opts = NULL };
-/*###441 [cc] error: 'am1' may be used uninitialized in this function%%%*/
-/*###441 [cc] error: 'am2' may be used uninitialized in this function%%%*/
 	fam_addr_mask_t *am1, *am2;
 	filt_opts_t imfopts;
 	sa_family_t family;



CVS commit: src/usr.sbin/npf/npfctl

2012-06-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 16 01:31:33 UTC 2012

Modified Files:
src/usr.sbin/npf/npfctl: npf_build.c

Log Message:
make this compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/npf/npfctl/npf_build.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.sbin/npf/npfctl/npf_build.c
diff -u src/usr.sbin/npf/npfctl/npf_build.c:1.7 src/usr.sbin/npf/npfctl/npf_build.c:1.8
--- src/usr.sbin/npf/npfctl/npf_build.c:1.7	Fri Jun 15 19:24:08 2012
+++ src/usr.sbin/npf/npfctl/npf_build.c	Fri Jun 15 21:31:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_build.c,v 1.7 2012/06/15 23:24:08 rmind Exp $	*/
+/*	$NetBSD: npf_build.c,v 1.8 2012/06/16 01:31:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_build.c,v 1.7 2012/06/15 23:24:08 rmind Exp $");
+__RCSID("$NetBSD: npf_build.c,v 1.8 2012/06/16 01:31:33 christos Exp $");
 
 #include 
 #include 
@@ -438,6 +438,8 @@ npfctl_build_nat(int sd, int type, u_int
 const addr_port_t *ap2, const filt_opts_t *fopts)
 {
 	const opt_proto_t op = { .op_proto = -1, .op_opts = NULL };
+/*###441 [cc] error: 'am1' may be used uninitialized in this function%%%*/
+/*###441 [cc] error: 'am2' may be used uninitialized in this function%%%*/
 	fam_addr_mask_t *am1, *am2;
 	filt_opts_t imfopts;
 	sa_family_t family;
@@ -460,7 +462,8 @@ npfctl_build_nat(int sd, int type, u_int
 			yyerror("IPv6 NAT is not supported");
 		}
 		assert(am1 != NULL);
-	}
+	} else
+		am1 = NULL;
 
 	if (type & NPF_NATOUT) {
 		if (!ap2->ap_netaddr) {
@@ -471,7 +474,8 @@ npfctl_build_nat(int sd, int type, u_int
 			yyerror("IPv6 NAT is not supported");
 		}
 		assert(am2 != NULL);
-	}
+	} else
+		am2 = NULL;
 
 	/*
 	 * If filter criteria is not specified explicitly, apply implicit
@@ -489,7 +493,8 @@ npfctl_build_nat(int sd, int type, u_int
 	}
 
 	switch (type) {
-	case NPF_NATIN: {
+	case NPF_NATIN:
+		assert(am1 != NULL);
 		/*
 		 * Redirection: an inbound NAT with a specific port.
 		 */
@@ -500,8 +505,9 @@ npfctl_build_nat(int sd, int type, u_int
 		nat = npf_nat_create(NPF_NATIN, NPF_NAT_PORTS,
 		if_idx, &am1->fam_addr, am1->fam_family, port);
 		break;
-	}
-	case (NPF_NATIN | NPF_NATOUT): {
+
+	case (NPF_NATIN | NPF_NATOUT):
+		assert(am1 != NULL);
 		/*
 		 * Bi-directional NAT: a combination of inbound NAT and
 		 * outbound NAT policies.  Note that the translation address
@@ -512,8 +518,9 @@ npfctl_build_nat(int sd, int type, u_int
 		npfctl_build_ncode(nat, family, &op, fopts, true);
 		npf_nat_insert(npf_conf, nat, NPF_PRI_NEXT);
 		/* FALLTHROUGH */
-	}
-	case NPF_NATOUT: {
+
+	case NPF_NATOUT:
+		assert(am2 != NULL);
 		/*
 		 * Traditional NAPT: an outbound NAT policy with port.
 		 * If this is another half for bi-directional NAT, then
@@ -523,7 +530,7 @@ npfctl_build_nat(int sd, int type, u_int
 		(NPF_NAT_PORTS | NPF_NAT_PORTMAP) : 0,
 		if_idx, &am2->fam_addr, am2->fam_family, 0);
 		break;
-	}
+
 	default:
 		assert(false);
 	}



CVS commit: src

2012-06-15 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Jun 15 23:24:08 UTC 2012

Modified Files:
src/sys/net/npf: npf_ncode.h
src/usr.sbin/npf/npfctl: npf.conf.5 npf_build.c npf_data.c
npf_disassemble.c npf_ncgen.c npf_parse.y npf_scan.l npfctl.c
npfctl.h

Log Message:
- Rework NPF NAT syntax to be more structured and support future additions
  of different types and configurations of NAT.
- npfctl: improve disassemble and show-config command functionality.
- Fix custom ICMP code and type filtering.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/net/npf/npf_ncode.h
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/npf/npfctl/npf.conf.5 \
src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/npf/npfctl/npf_data.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/npf/npfctl/npf_disassemble.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/npf/npfctl/npf_ncgen.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/npf/npfctl/npfctl.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/net/npf/npf_ncode.h
diff -u src/sys/net/npf/npf_ncode.h:1.7 src/sys/net/npf/npf_ncode.h:1.8
--- src/sys/net/npf/npf_ncode.h:1.7	Sat Apr 14 19:01:21 2012
+++ src/sys/net/npf/npf_ncode.h	Fri Jun 15 23:24:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ncode.h,v 1.7 2012/04/14 19:01:21 rmind Exp $	*/
+/*	$NetBSD: npf_ncode.h,v 1.8 2012/06/15 23:24:08 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2010 The NetBSD Foundation, Inc.
@@ -143,9 +143,9 @@ int	npf_ncode_validate(const void *, siz
 # define	NPF_OPERAND_PORT_RANGE		14
 
 static const struct npf_instruction {
-	const char *name;
-	uint8_t op[4];
-} npf_instructions[256] = {
+	const char *	name;
+	uint8_t		op[4];
+} npf_instructions[] = {
 	[NPF_OPCODE_RET] = {
 		.name = "ret",
 		.op = {
@@ -247,7 +247,8 @@ static const struct npf_instruction {
 			[1] = NPF_OPERAND_REGISTER,
 		},
 	},
-	[NPF_OPCODE_DIV] = { .name = "div",
+	[NPF_OPCODE_DIV] = {
+		.name = "div",
 		.op = {
 			[0] = NPF_OPERAND_VALUE,
 			[1] = NPF_OPERAND_REGISTER,

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.11 src/usr.sbin/npf/npfctl/npf.conf.5:1.12
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.11	Wed May 30 22:00:44 2012
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Jun 15 23:24:08 2012
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.11 2012/05/30 22:00:44 wiz Exp $
+.\"$NetBSD: npf.conf.5,v 1.12 2012/06/15 23:24:08 rmind Exp $
 .\"
 .\" Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 27, 2012
+.Dd June 14, 2012
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -132,7 +132,7 @@ There are two types of storage: "tree" (
 .\" -
 .Sh GRAMMAR
 .Bd -literal
-line		= ( def | table | nat | group | rproc )
+line		= ( def | table | map | group | rproc )
 
 def		= ( \*[Lt]name\*[Gt] "=" "{ a, b, ... }" | "\*[Lt]text\*[Gt]" | "$\*[Lt]interface\*[Gt]" )
 iface		= ( \*[Lt]interface\*[Gt] | def )
@@ -140,9 +140,9 @@ iface		= ( \*[Lt]interface\*[Gt] | def )
 table		= "table" \*[Lt]tid\*[Gt] "type" ( "hash" | "tree" )
 		  ( "dynamic" | "file" \*[Lt]path\*[Gt] )
 
-nat		= "nat" iface filt-opts "->" \*[Lt]addr\*[Gt]
-binat		= "binat" iface filt-opts "->" \*[Lt]addr\*[Gt]
-rdr		= "rdr" iface filt-opts "->" \*[Lt]addr\*[Gt] port-opts
+map-di		= ( "->" | "<-" | "<->" )
+map-type	= ( "static" | "dynamic" )
+map		= "map" iface maptype \*[Lt]seg1\*[Gt] mapdi \*[Lt]seg2\*[Gt] [ "pass" filt-opts ]
 
 rproc		= "procedure" \*[Lt]name\*[Gt] procs
 procs		= "{" op1 \*[Lt]newline\*[Gt], op2 \*[Lt]newline\*[Gt], ... "}"
@@ -179,13 +179,15 @@ default configuration file
 $ext_if = "wm0"
 $int_if = "wm1"
 
-$services_tcp = { http, https, smtp, domain, 6000 }
-$services_udp = { domain, ntp, 6000 }
-
 table <1> type hash file "/etc/npf_blacklist"
 table <2> type tree dynamic
 
-nat $ext_if from 192.168.0.0/24 to any -> $ext_if
+$services_tcp = { http, https, smtp, domain, 6000, 9022 }
+$services_udp = { domain, ntp, 6000 }
+$localnet = { 10.1.1.0/24 }
+
+map $ext_if dynamic 10.1.1.0/24 -> $ext_if
+map $ext_if dynamic 10.1.1.2 port 22 <- $ext_if 9022
 
 procedure "log" {
 	log: npflog0
@@ -196,9 +198,9 @@ procedure "rid" {
 }
 
 group (name "external", interface $ext_if) {
-	block in final from \*[Lt]1\*[Gt]
 	pass stateful out final from $ext_if apply "rid"
 
+	block in final from \*[Lt]1\*[Gt]
 	pass in final family inet proto tcp to $ext_if port ssh apply "log"
 	pass in final proto tcp to $ext_if port $services_tcp
 	pass in final proto udp to $ext_if port $services_udp
Index: src/usr.sbin/npf/npfctl/npfctl.c
diff -u src/usr.sbi

CVS commit: src/sys/arch/i386/i386

2012-06-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jun 15 23:01:16 UTC 2012

Modified Files:
src/sys/arch/i386/i386: bios32.c

Log Message:
Don't use an empty body on the same line for the for loop.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/i386/bios32.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/bios32.c
diff -u src/sys/arch/i386/i386/bios32.c:1.28 src/sys/arch/i386/i386/bios32.c:1.29
--- src/sys/arch/i386/i386/bios32.c:1.28	Tue Nov 17 23:45:39 2009
+++ src/sys/arch/i386/i386/bios32.c	Fri Jun 15 23:01:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bios32.c,v 1.28 2009/11/17 23:45:39 dyoung Exp $	*/
+/*	$NetBSD: bios32.c,v 1.29 2012/06/15 23:01:16 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.28 2009/11/17 23:45:39 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bios32.c,v 1.29 2012/06/15 23:01:16 joerg Exp $");
 
 #include 
 #include 
@@ -175,8 +175,8 @@ bios32_init(void)
 		if (p[0] != '_' && p[1] != 'D' && p[2] != 'M' &&
 		p[3] != 'I' && p[4] != '_')
 			continue;
-		for (chksum = 0, i = 0xf; i--; chksum += p[i]);
-			;
+		for (chksum = 0, i = 0xf; i--;)
+			chksum += p[i];
 		if (chksum != 0)
 			continue;
 



CVS commit: src/sys/fs/hfs

2012-06-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jun 15 21:59:40 UTC 2012

Modified Files:
src/sys/fs/hfs: libhfs.c

Log Message:
Assert that out_hr is not NULL in hfslib_read_header_node


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/fs/hfs/libhfs.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/fs/hfs/libhfs.c
diff -u src/sys/fs/hfs/libhfs.c:1.10 src/sys/fs/hfs/libhfs.c:1.11
--- src/sys/fs/hfs/libhfs.c:1.10	Thu Feb 24 23:49:26 2011
+++ src/sys/fs/hfs/libhfs.c	Fri Jun 15 21:59:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: libhfs.c,v 1.10 2011/02/24 23:49:26 christos Exp $	*/
+/*	$NetBSD: libhfs.c,v 1.11 2012/06/15 21:59:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.10 2011/02/24 23:49:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.11 2012/06/15 21:59:39 joerg Exp $");
 
 #include "libhfs.h"
 
@@ -1658,34 +1658,32 @@ hfslib_read_header_node(void** in_recs,
 {
 	void*	ptr;
 	int		i;
-	
+
+	KASSERT(out_hr != NULL);
+
 	if(in_recs==NULL || in_rec_sizes==NULL)
 		return 0;
 	
-	if(out_hr!=NULL)
-	{
-		ptr = in_recs[0];
-		
-		out_hr->tree_depth = be16tohp(&ptr);
-		out_hr->root_node = be32tohp(&ptr);
-		out_hr->leaf_recs = be32tohp(&ptr);
-		out_hr->first_leaf = be32tohp(&ptr);
-		out_hr->last_leaf = be32tohp(&ptr);
-		out_hr->node_size = be16tohp(&ptr);
-		out_hr->max_key_len = be16tohp(&ptr);
-		out_hr->total_nodes = be32tohp(&ptr);
-		out_hr->free_nodes = be32tohp(&ptr);
-		out_hr->reserved = be16tohp(&ptr);
-		out_hr->clump_size = be32tohp(&ptr);
-		out_hr->btree_type = *(((uint8_t*)ptr));
-		ptr = (uint8_t*)ptr + 1;
-		out_hr->keycomp_type = *(((uint8_t*)ptr));
-		ptr = (uint8_t*)ptr + 1;
-		out_hr->attributes = be32tohp(&ptr);
-		for(i=0;i<16;i++)
-			out_hr->reserved2[i] = be32tohp(&ptr);
-	}
-	
+	ptr = in_recs[0];
+	out_hr->tree_depth = be16tohp(&ptr);
+	out_hr->root_node = be32tohp(&ptr);
+	out_hr->leaf_recs = be32tohp(&ptr);
+	out_hr->first_leaf = be32tohp(&ptr);
+	out_hr->last_leaf = be32tohp(&ptr);
+	out_hr->node_size = be16tohp(&ptr);
+	out_hr->max_key_len = be16tohp(&ptr);
+	out_hr->total_nodes = be32tohp(&ptr);
+	out_hr->free_nodes = be32tohp(&ptr);
+	out_hr->reserved = be16tohp(&ptr);
+	out_hr->clump_size = be32tohp(&ptr);
+	out_hr->btree_type = *(((uint8_t*)ptr));
+	ptr = (uint8_t*)ptr + 1;
+	out_hr->keycomp_type = *(((uint8_t*)ptr));
+	ptr = (uint8_t*)ptr + 1;
+	out_hr->attributes = be32tohp(&ptr);
+	for(i=0;i<16;i++)
+		out_hr->reserved2[i] = be32tohp(&ptr);
+
 	if(out_userdata!=NULL)
 	{
 		memcpy(out_userdata, in_recs[1], in_rec_sizes[1]);



CVS commit: src/external/bsd/bind/dist/lib/lwres

2012-06-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jun 15 19:54:21 UTC 2012

Modified Files:
src/external/bsd/bind/dist/lib/lwres: getnameinfo.c

Log Message:
Simplify ERR, so that it doesn't mess up Clang's
-Wsometimes-uninitialized scan on the function. This is tracked in LLVM
as http://llvm.org/bugs/show_bug.cgi?id=13093.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/bind/dist/lib/lwres/getnameinfo.c

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

Modified files:

Index: src/external/bsd/bind/dist/lib/lwres/getnameinfo.c
diff -u src/external/bsd/bind/dist/lib/lwres/getnameinfo.c:1.3 src/external/bsd/bind/dist/lib/lwres/getnameinfo.c:1.4
--- src/external/bsd/bind/dist/lib/lwres/getnameinfo.c:1.3	Tue Jun  5 00:43:04 2012
+++ src/external/bsd/bind/dist/lib/lwres/getnameinfo.c	Fri Jun 15 19:54:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getnameinfo.c,v 1.3 2012/06/05 00:43:04 christos Exp $	*/
+/*	$NetBSD: getnameinfo.c,v 1.4 2012/06/15 19:54:21 joerg Exp $	*/
 
 /*
  * Portions Copyright (C) 2004, 2005, 2007, 2011, 2012  Internet Systems Consortium, Inc. ("ISC")
@@ -149,13 +149,9 @@ static struct afd {
 #define ENI_SALEN	6
 #define ENI_NOSOCKET 	7
 
-/*!
- * The test against 0 is there to keep the Solaris compiler
- * from complaining about "end-of-loop code not reached".
- */
 #define ERR(code) \
 	do { result = (code);			\
-		if (result != 0) goto cleanup;	\
+		goto cleanup;			\
 	} while (/*CONSTCOND*/0)
 
 /*% lightweight resolver socket address structure to hostname and service name */



CVS commit: src/lib/libpthread

2012-06-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jun 15 19:20:45 UTC 2012

Modified Files:
src/lib/libpthread: pthread_cond.c

Log Message:
Do not mark pthread_cond_timedwait explicitly as inlineable, since it
calls pthread__self, which is static.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/lib/libpthread/pthread_cond.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/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.56 src/lib/libpthread/pthread_cond.c:1.57
--- src/lib/libpthread/pthread_cond.c:1.56	Tue Nov  2 20:49:47 2010
+++ src/lib/libpthread/pthread_cond.c	Fri Jun 15 19:20:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.56 2010/11/02 20:49:47 skrll Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.57 2012/06/15 19:20:44 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.56 2010/11/02 20:49:47 skrll Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.57 2012/06/15 19:20:44 joerg Exp $");
 
 #include 
 #include 
@@ -103,7 +103,7 @@ pthread_cond_destroy(pthread_cond_t *con
 	return 0;
 }
 
-inline int
+int
 pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
 		   const struct timespec *abstime)
 {



CVS commit: src/sys/arch/i386/i386

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 14:23:46 UTC 2012

Modified Files:
src/sys/arch/i386/i386: vector.S

Log Message:
whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/i386/vector.S

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/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.59 src/sys/arch/i386/i386/vector.S:1.60
--- src/sys/arch/i386/i386/vector.S:1.59	Sun Jun 12 03:35:42 2011
+++ src/sys/arch/i386/i386/vector.S	Fri Jun 15 14:23:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.59 2011/06/12 03:35:42 rmind Exp $	*/
+/*	$NetBSD: vector.S,v 1.60 2012/06/15 14:23:46 yamt Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.59 2011/06/12 03:35:42 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.60 2012/06/15 14:23:46 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -282,7 +282,7 @@ IDTVEC(intr_ ## name ## num)		;\
 	pushl	$T_ASTFLT		/* trap # for doing ASTs */	;\
 	INTRENTRY			;\
 	movl	CPUVAR(ISOURCES) + (num) * 4, %ebp			;\
-	mask(num)		/* mask it in hardware */		;\
+	mask(num)			/* mask it in hardware */	;\
 	early_ack(num)			/* and allow other intrs */	;\
 	testl	%ebp,%ebp		;\
 	jz	9f			/* stray */			;\



CVS commit: src/sys/arch/i386/i386

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 14:09:26 UTC 2012

Modified Files:
src/sys/arch/i386/i386: spl.S

Log Message:
update a comment


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/i386/spl.S

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/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.36 src/sys/arch/i386/i386/spl.S:1.37
--- src/sys/arch/i386/i386/spl.S:1.36	Fri Mar 18 15:18:16 2011
+++ src/sys/arch/i386/i386/spl.S	Fri Jun 15 14:09:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.36 2011/03/18 15:18:16 joerg Exp $	*/
+/*	$NetBSD: spl.S,v 1.37 2012/06/15 14:09:26 yamt Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.36 2011/03/18 15:18:16 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.37 2012/06/15 14:09:26 yamt Exp $");
 
 #include "opt_vm86.h"
 #include "opt_ddb.h"
@@ -73,7 +73,7 @@ END(splraise)
  * void spllower(int s);
  *
  * spllower() for i486 and Pentium.  Must be the same size as
- * i686_spllower().  This must use pushf/cli/popf as it is used
+ * cx8_spllower().  This must use pushf/cli/popf as it is used
  * early in boot where interrupts are disabled via eflags/IE.
  */
 ENTRY(spllower)



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

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 14:07:44 UTC 2012

Modified Files:
src/sys/arch/x86/pci: pci_intr_machdep.c

Log Message:
comment


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/pci/pci_intr_machdep.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/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.24 src/sys/arch/x86/pci/pci_intr_machdep.c:1.25
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.24	Fri Jun 15 14:02:41 2012
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Fri Jun 15 14:07:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.24 2012/06/15 14:02:41 yamt Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.25 2012/06/15 14:07:44 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.24 2012/06/15 14:02:41 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.25 2012/06/15 14:07:44 yamt Exp $");
 
 #include 
 #include 
@@ -144,6 +144,10 @@ pci_intr_map(const struct pci_attach_arg
 	KASSERT(rawpin <= PCI_INTERRUPT_PIN_D);
 	pci_decompose_tag(pc, pa->pa_tag, &bus, &dev, &func);
 	if (mp_busses != NULL) {
+		/*
+		 * Note: PCI_INTERRUPT_PIN_A == 1 where intr_find_mpmapping
+		 * wants pci bus_pin encoding which uses INT_A == 0.
+		 */
 		if (intr_find_mpmapping(bus,
 		(dev << 2) | (rawpin - PCI_INTERRUPT_PIN_A), ihp) == 0) {
 			if (APIC_IRQ_LEGACY_IRQ(*ihp) == 0)



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

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 14:02:41 UTC 2012

Modified Files:
src/sys/arch/x86/pci: pci_intr_machdep.c

Log Message:
assertions.  use a macro.  no functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/x86/pci/pci_intr_machdep.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/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.23 src/sys/arch/x86/pci/pci_intr_machdep.c:1.24
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.23	Mon Aug 29 22:41:52 2011
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Fri Jun 15 14:02:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.23 2011/08/29 22:41:52 dyoung Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.24 2012/06/15 14:02:41 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.23 2011/08/29 22:41:52 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.24 2012/06/15 14:02:41 yamt Exp $");
 
 #include 
 #include 
@@ -140,10 +140,13 @@ pci_intr_map(const struct pci_attach_arg
 	}
 
 #if NIOAPIC > 0 || NACPICA > 0
+	KASSERT(rawpin >= PCI_INTERRUPT_PIN_A);
+	KASSERT(rawpin <= PCI_INTERRUPT_PIN_D);
 	pci_decompose_tag(pc, pa->pa_tag, &bus, &dev, &func);
 	if (mp_busses != NULL) {
-		if (intr_find_mpmapping(bus, (dev<<2)|(rawpin-1), ihp) == 0) {
-			if ((*ihp & 0xff) == 0)
+		if (intr_find_mpmapping(bus,
+		(dev << 2) | (rawpin - PCI_INTERRUPT_PIN_A), ihp) == 0) {
+			if (APIC_IRQ_LEGACY_IRQ(*ihp) == 0)
 *ihp |= line;
 			return 0;
 		}



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

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 13:58:34 UTC 2012

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

Log Message:
comment


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/include/pci_machdep_common.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/pci_machdep_common.h
diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.8 src/sys/arch/x86/include/pci_machdep_common.h:1.9
--- src/sys/arch/x86/include/pci_machdep_common.h:1.8	Sun Aug 28 06:04:17 2011
+++ src/sys/arch/x86/include/pci_machdep_common.h	Fri Jun 15 13:58:34 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep_common.h,v 1.8 2011/08/28 06:04:17 dyoung Exp $	*/
+/*	$NetBSD: pci_machdep_common.h,v 1.9 2012/06/15 13:58:34 yamt Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -51,6 +51,13 @@
  * the read and write routines, but this would cause extra overhead.
  *
  * Mode 2 is historical and deprecated by the Revision 2.0 specification.
+ *
+ *
+ * Mode 1 tag:
+ *	 31  24   16 15 11 10  8
+ *	+---+
+ *	|1|  0  |  BUS  |   DEV   |FUNC |   0   |
+ *	+---+
  */
 union x86_pci_tag_u {
 	uint32_t mode1;



CVS commit: src/sys/arch/x86

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 13:58:00 UTC 2012

Modified Files:
src/sys/arch/x86/include: mpconfig.h
src/sys/arch/x86/x86: intr.c

Log Message:
comments


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/include/mpconfig.h
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/x86/x86/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/x86/include/mpconfig.h
diff -u src/sys/arch/x86/include/mpconfig.h:1.13 src/sys/arch/x86/include/mpconfig.h:1.14
--- src/sys/arch/x86/include/mpconfig.h:1.13	Fri Jul  1 18:22:39 2011
+++ src/sys/arch/x86/include/mpconfig.h	Fri Jun 15 13:57:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpconfig.h,v 1.13 2011/07/01 18:22:39 dyoung Exp $	*/
+/*	$NetBSD: mpconfig.h,v 1.14 2012/06/15 13:57:59 yamt Exp $	*/
 
 /*
  * Definitions originally from the mpbios code, but now used for ACPI
@@ -16,7 +16,7 @@
 #include 
 
 /* 
- * Interrupt typess
+ * Interrupt types
  */
 #define MPS_INTTYPE_INT 0
 #define MPS_INTTYPE_NMI 1
@@ -52,10 +52,15 @@ struct mp_intr_map
 {
 	struct mp_intr_map *next;
 	struct mp_bus *bus;
+	/*
+	 * encoding of bus_pin is mp_bus dependant.
+	 * for pci, bus_pin = (pci_device_number << 2) | pin
+	 * where pin is 0=INTA ... 3=INTD.
+	 */
 	int bus_pin;
-	struct pic *ioapic;
+	struct pic *ioapic;	/* NULL for local apic */
 	int ioapic_pin;
-	int ioapic_ih;		/* int handle, for apic_intr_est */
+	int ioapic_ih;		/* int handle, see i82093var.h for encoding */
 	int type;		/* from mp spec intr record */
  	int flags;		/* from mp spec intr record */
 	uint32_t redir;

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.73 src/sys/arch/x86/x86/intr.c:1.74
--- src/sys/arch/x86/x86/intr.c:1.73	Tue Jun 12 17:26:29 2012
+++ src/sys/arch/x86/x86/intr.c	Fri Jun 15 13:57:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.73 2012/06/12 17:26:29 yamt Exp $	*/
+/*	$NetBSD: intr.c,v 1.74 2012/06/15 13:57:59 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.73 2012/06/12 17:26:29 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.74 2012/06/15 13:57:59 yamt Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -360,9 +360,7 @@ intr_find_pcibridge(int bus, pcitag_t *p
 
 #if NIOAPIC > 0 || NACPICA > 0
 /*
- * 'pin' argument is (dev << 2) | pin0
- * where dev is PCI device number (0-255) and
- * pin0 is PCI interrupt pin number (0-3)
+ * 'pin' argument pci bus_pin encoding of a device/pin combination.
  */
 int
 intr_find_mpmapping(int bus, int pin, int *handle)



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

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 13:55:22 UTC 2012

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

Log Message:
comment


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/include/i82093var.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/i82093var.h
diff -u src/sys/arch/x86/include/i82093var.h:1.11 src/sys/arch/x86/include/i82093var.h:1.12
--- src/sys/arch/x86/include/i82093var.h:1.11	Wed Mar 25 22:56:00 2009
+++ src/sys/arch/x86/include/i82093var.h	Fri Jun 15 13:55:22 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: i82093var.h,v 1.11 2009/03/25 22:56:00 dyoung Exp $ */
+/* $NetBSD: i82093var.h,v 1.12 2012/06/15 13:55:22 yamt Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -67,6 +67,8 @@ struct ioapic_softc {
  * ih&0x1000 -> if 0, old-style isa irq; if 1, routed via ioapic.
  * (ih&0xff)>>16 -> ioapic id.
  * (ih&0x00ff00)>>8 -> ioapic pin.
+ *
+ * 0x8000 is used by pci_intr_machdep.c for MPSAFE_MASK
  */
 
 #define APIC_INT_VIA_APIC	0x1000



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

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 13:53:40 UTC 2012

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

Log Message:
emap: reduce the number of atomic ops.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 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.177 src/sys/arch/x86/x86/pmap.c:1.178
--- src/sys/arch/x86/x86/pmap.c:1.177	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/x86/x86/pmap.c	Fri Jun 15 13:53:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.177 2012/04/20 22:23:24 rmind Exp $	*/
+/*	$NetBSD: pmap.c,v 1.178 2012/06/15 13:53:40 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.177 2012/04/20 22:23:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.178 2012/06/15 13:53:40 yamt Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1014,7 +1014,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 void
 pmap_emap_enter(vaddr_t va, paddr_t pa, vm_prot_t prot)
 {
-	pt_entry_t *pte, opte, npte;
+	pt_entry_t *pte, npte;
 
 	KASSERT((prot & ~VM_PROT_ALL) == 0);
 	pte = (va < VM_MIN_KERNEL_ADDRESS) ? vtopte(va) : kvtopte(va);
@@ -1028,7 +1028,7 @@ pmap_emap_enter(vaddr_t va, paddr_t pa, 
 
 	npte = pmap_pa2pte(pa);
 	npte |= protection_codes[prot] | PG_k | PG_V;
-	opte = pmap_pte_testset(pte, npte);
+	pmap_pte_set(pte, npte);
 }
 
 /*
@@ -1061,12 +1061,12 @@ pmap_emap_sync(bool canload)
 void
 pmap_emap_remove(vaddr_t sva, vsize_t len)
 {
-	pt_entry_t *pte, xpte;
+	pt_entry_t *pte;
 	vaddr_t va, eva = sva + len;
 
 	for (va = sva; va < eva; va += PAGE_SIZE) {
 		pte = (va < VM_MIN_KERNEL_ADDRESS) ? vtopte(va) : kvtopte(va);
-		xpte |= pmap_pte_testset(pte, 0);
+		pmap_pte_set(pte, 0);
 	}
 }
 



CVS commit: src/sys/kern

2012-06-15 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Fri Jun 15 13:51:41 UTC 2012

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

Log Message:
comments and assertions.
no functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/kern_turnstile.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/kern_turnstile.c
diff -u src/sys/kern/kern_turnstile.c:1.31 src/sys/kern/kern_turnstile.c:1.32
--- src/sys/kern/kern_turnstile.c:1.31	Fri Dec  2 12:31:53 2011
+++ src/sys/kern/kern_turnstile.c	Fri Jun 15 13:51:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_turnstile.c,v 1.31 2011/12/02 12:31:53 yamt Exp $	*/
+/*	$NetBSD: kern_turnstile.c,v 1.32 2012/06/15 13:51:40 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_turnstile.c,v 1.31 2011/12/02 12:31:53 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_turnstile.c,v 1.32 2012/06/15 13:51:40 yamt Exp $");
 
 #include 
 #include 
@@ -199,7 +199,9 @@ turnstile_exit(wchan_t obj)
  *
  *	Lend our priority to lwps on the blocking chain.
  *
- *
+ *	If the current owner of the lock (l->l_wchan, set by sleepq_enqueue)
+ *	has a priority lower than ours (lwp_eprio(l)), lend our priority to
+ *	him to avoid priority inversions.
  */
 
 static void
@@ -225,29 +227,37 @@ turnstile_lendpri(lwp_t *cur)
 		if (l->l_wchan == NULL)
 			break;
 
+		/*
+		 * Ask syncobj the owner of the lock.
+		 */
 		owner = (*l->l_syncobj->sobj_owner)(l->l_wchan);
 		if (owner == NULL)
 			break;
 
-		/* The owner may have changed as we have dropped the tc lock */
+		/*
+		 * The owner may have changed as we have dropped the tc lock.
+		 */
 		if (cur == owner) {
 			/*
-			 * we own the lock: stop here, sleepq_block()
-			 * should wake up immediatly
+			 * We own the lock: stop here, sleepq_block()
+			 * should wake up immediatly.
 			 */
 			break;
 		}
-		if (l->l_mutex != owner->l_mutex)
-			dolock = true;
-		else
-			dolock = false;
+		/*
+		 * Acquire owner->l_mutex if we don't have it yet.
+		 * Because we already have another LWP lock (l->l_mutex) held,
+		 * we need to play a try lock dance to avoid deadlock.
+		 */
+		dolock = l->l_mutex != owner->l_mutex;
 		if (l == owner || (dolock && !lwp_trylock(owner))) {
 			/*
-			 * restart from curlwp.
+			 * The owner was changed behind us or trylock failed.
+			 * Restart from curlwp.
+			 *
 			 * Note that there may be a livelock here:
-			 * the owner may try grabing cur's lock (which is
-			 * the tc lock) while we're trying to grab
-			 * the owner's lock.
+			 * the owner may try grabing cur's lock (which is the
+			 * tc lock) while we're trying to grab the owner's lock.
 			 */
 			lwp_unlock(l);
 			l = cur;
@@ -255,11 +265,20 @@ turnstile_lendpri(lwp_t *cur)
 			prio = lwp_eprio(l);
 			continue;
 		}
+		/*
+		 * If the owner's priority is already higher than ours,
+		 * there's nothing to do anymore.
+		 */
 		if (prio <= lwp_eprio(owner)) {
 			if (dolock)
 lwp_unlock(owner);
 			break;
 		}
+		/*
+		 * Lend our priority to the 'owner' LWP.
+		 *
+		 * Update lenders info for turnstile_unlendpri.
+		 */
 		ts = l->l_ts;
 		KASSERT(ts->ts_inheritor == owner || ts->ts_inheritor == NULL);
 		if (ts->ts_inheritor == NULL) {
@@ -273,6 +292,7 @@ turnstile_lendpri(lwp_t *cur)
 		}
 		if (dolock)
 			lwp_unlock(l);
+		LOCKDEBUG_BARRIER(owner->l_mutex, 1);
 		l = owner;
 	}
 	LOCKDEBUG_BARRIER(l->l_mutex, 1);



CVS commit: [netbsd-6] src/doc

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 11:22:22 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.0

Log Message:
Ticket #336


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.132 -r1.1.2.133 src/doc/CHANGES-6.0

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-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.132 src/doc/CHANGES-6.0:1.1.2.133
--- src/doc/CHANGES-6.0:1.1.2.132	Fri Jun 15 10:00:29 2012
+++ src/doc/CHANGES-6.0	Fri Jun 15 11:22:22 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.132 2012/06/15 10:00:29 sborrill Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.133 2012/06/15 11:22:22 sborrill Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -5665,3 +5665,9 @@ bin/rm/rm.c	1.52
 	effects.
 	[dholland, ticket #346]
 
+sys/dev/usb/stuirda.c1.15
+
+	Fix a case where an uninitialized USB pipe could be freed in the
+	error path.
+	[joerg, ticket #336]
+



CVS commit: [netbsd-6] src/sys/dev/usb

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 11:22:08 UTC 2012

Modified Files:
src/sys/dev/usb [netbsd-6]: stuirda.c

Log Message:
Pull up the following revisions(s) (requested by joerg in ticket #336):
sys/dev/usb/stuirda.c:  revision 1.15

Fix a case where an uninitialized USB pipe could be freed in the error
path.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/dev/usb/stuirda.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/usb/stuirda.c
diff -u src/sys/dev/usb/stuirda.c:1.13 src/sys/dev/usb/stuirda.c:1.13.2.1
--- src/sys/dev/usb/stuirda.c:1.13	Fri Dec 23 00:51:44 2011
+++ src/sys/dev/usb/stuirda.c	Fri Jun 15 11:22:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: stuirda.c,v 1.13 2011/12/23 00:51:44 jakllsch Exp $	*/
+/*	$NetBSD: stuirda.c,v 1.13.2.1 2012/06/15 11:22:07 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2001,2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stuirda.c,v 1.13 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stuirda.c,v 1.13.2.1 2012/06/15 11:22:07 sborrill Exp $");
 
 #include 
 
@@ -220,7 +220,7 @@ stuirda_fwload(struct uirda_softc *sc) {
 	if (rc) {
 		printf("%s: Cannot switch to f/w d/l mode, error %d\n",
 			device_xname(sc->sc_dev), rc);
-		goto giveup4;
+		goto giveup3;
 	}
 
 	delay(10);



CVS commit: src/games/dab

2012-06-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Jun 15 10:51:26 UTC 2012

Modified Files:
src/games/dab: algor.h

Log Message:
Remove unused fields


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

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/algor.h
diff -u src/games/dab/algor.h:1.4 src/games/dab/algor.h:1.5
--- src/games/dab/algor.h:1.4	Mon Apr 28 20:22:53 2008
+++ src/games/dab/algor.h	Fri Jun 15 10:51:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: algor.h,v 1.4 2008/04/28 20:22:53 martin Exp $	*/
+/*	$NetBSD: algor.h,v 1.5 2012/06/15 10:51:25 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -71,10 +71,6 @@ class ALGOR : public PLAYER {
 #ifdef notyet
 size_t find_single(void);
 #endif
-
-size_t _edge1;
-size_t _edge2;
-size_t _maxedge;
 };
 
 #endif



CVS commit: [netbsd-6] src/doc

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 10:00:29 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.0

Log Message:
Ticket #346


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.131 -r1.1.2.132 src/doc/CHANGES-6.0

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-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.131 src/doc/CHANGES-6.0:1.1.2.132
--- src/doc/CHANGES-6.0:1.1.2.131	Fri Jun 15 08:54:01 2012
+++ src/doc/CHANGES-6.0	Fri Jun 15 10:00:29 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.131 2012/06/15 08:54:01 sborrill Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.132 2012/06/15 10:00:29 sborrill Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -5657,3 +5657,11 @@ tests/lib/libc/sys/t_mmap.c			1.7
 	it doesn't panic when mmaping /dev/wd0d. PR kern/46592
 	[bouyer, ticket #345]
 
+bin/rm/rm.c	1.52
+
+	Rectify race condition in rm -P processing by checking that the
+	file we opened is the one we expected to get. Also use O_NOFOLLOW
+	to help avoid even opening devices, which sometimes produce side
+	effects.
+	[dholland, ticket #346]
+



CVS commit: [netbsd-6] src/bin/rm

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 10:00:05 UTC 2012

Modified Files:
src/bin/rm [netbsd-6]: rm.c

Log Message:
Pull up the following revisions(s) (requested by dholland in ticket #346):
bin/rm/rm.c:revision 1.52

Rectify race condition in rm -P processing by checking that the file
we opened is the one we expected to get. Also use O_NOFOLLOW to help
avoid even opening devices, which sometimes produce side effects.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.51.2.1 src/bin/rm/rm.c

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

Modified files:

Index: src/bin/rm/rm.c
diff -u src/bin/rm/rm.c:1.51 src/bin/rm/rm.c:1.51.2.1
--- src/bin/rm/rm.c:1.51	Sat Jan 21 16:38:41 2012
+++ src/bin/rm/rm.c	Fri Jun 15 10:00:05 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: rm.c,v 1.51 2012/01/21 16:38:41 christos Exp $ */
+/* $NetBSD: rm.c,v 1.51.2.1 2012/06/15 10:00:05 sborrill Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993, 1994, 2003
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19
 #if 0
 static char sccsid[] = "@(#)rm.c	8.8 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: rm.c,v 1.51 2012/01/21 16:38:41 christos Exp $");
+__RCSID("$NetBSD: rm.c,v 1.51.2.1 2012/06/15 10:00:05 sborrill Exp $");
 #endif
 #endif /* not lint */
 
@@ -380,7 +380,7 @@ rm_file(char **argv)
 static int
 rm_overwrite(char *file, struct stat *sbp)
 {
-	struct stat sb;
+	struct stat sb, sb2;
 	int fd, randint;
 	char randchar;
 
@@ -394,8 +394,18 @@ rm_overwrite(char *file, struct stat *sb
 		return 0;
 
 	/* flags to try to defeat hidden caching by forcing seeks */
-	if ((fd = open(file, O_RDWR|O_SYNC|O_RSYNC, 0)) == -1)
+	if ((fd = open(file, O_RDWR|O_SYNC|O_RSYNC|O_NOFOLLOW, 0)) == -1)
+		goto err;
+
+	if (fstat(fd, &sb2)) {
 		goto err;
+	}
+
+	if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino ||
+	!S_ISREG(sb2.st_mode)) {
+		errno = EPERM;
+		goto err;
+	}
 
 #define RAND_BYTES	1
 #define THIS_BYTE	0



CVS commit: [netbsd-5-1] src/sys/arch/amd64/amd64

2012-06-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jun 15 09:21:12 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5-1]: trap.c

Log Message:
Fix build fallout from ticket #1772 for Xen kernels


To generate a diff of this commit:
cvs rdiff -u -r1.52.4.2.2.1 -r1.52.4.2.2.2 src/sys/arch/amd64/amd64/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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.52.4.2.2.1 src/sys/arch/amd64/amd64/trap.c:1.52.4.2.2.2
--- src/sys/arch/amd64/amd64/trap.c:1.52.4.2.2.1	Tue Jun 12 20:44:07 2012
+++ src/sys/arch/amd64/amd64/trap.c	Fri Jun 15 09:21:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.52.4.2.2.1 2012/06/12 20:44:07 riz Exp $	*/
+/*	$NetBSD: trap.c,v 1.52.4.2.2.2 2012/06/15 09:21:12 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52.4.2.2.1 2012/06/12 20:44:07 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52.4.2.2.2 2012/06/15 09:21:12 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -183,7 +183,9 @@ trap(struct trapframe *frame)
 #if defined(COMPAT_10) || defined(COMPAT_IBCS2)
 	extern char IDTVEC(oosyscall)[];
 #endif
+#ifndef XEN
 	struct trapframe *vframe;
+#endif
 	void *onfault;
 	int error;
 	uint64_t cr2;



CVS commit: [netbsd-5-0] src/sys/arch/amd64/amd64

2012-06-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jun 15 09:20:48 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5-0]: trap.c

Log Message:
Fix build fallout from ticket #1772 for Xen kernels


To generate a diff of this commit:
cvs rdiff -u -r1.52.6.3 -r1.52.6.4 src/sys/arch/amd64/amd64/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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.52.6.3 src/sys/arch/amd64/amd64/trap.c:1.52.6.4
--- src/sys/arch/amd64/amd64/trap.c:1.52.6.3	Tue Jun 12 20:43:59 2012
+++ src/sys/arch/amd64/amd64/trap.c	Fri Jun 15 09:20:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.52.6.3 2012/06/12 20:43:59 riz Exp $	*/
+/*	$NetBSD: trap.c,v 1.52.6.4 2012/06/15 09:20:48 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52.6.3 2012/06/12 20:43:59 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52.6.4 2012/06/15 09:20:48 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -183,7 +183,9 @@ trap(struct trapframe *frame)
 #if defined(COMPAT_10) || defined(COMPAT_IBCS2)
 	extern char IDTVEC(oosyscall)[];
 #endif
+#ifndef XEN
 	struct trapframe *vframe;
+#endif
 	void *onfault;
 	int error;
 	uint64_t cr2;



CVS commit: [netbsd-5] src/sys/arch/amd64/amd64

2012-06-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Jun 15 09:20:00 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-5]: trap.c

Log Message:
Fix build fallout from ticket #1772 for Xen kernels


To generate a diff of this commit:
cvs rdiff -u -r1.52.4.3 -r1.52.4.4 src/sys/arch/amd64/amd64/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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.52.4.3 src/sys/arch/amd64/amd64/trap.c:1.52.4.4
--- src/sys/arch/amd64/amd64/trap.c:1.52.4.3	Tue Jun 12 20:43:47 2012
+++ src/sys/arch/amd64/amd64/trap.c	Fri Jun 15 09:20:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.52.4.3 2012/06/12 20:43:47 riz Exp $	*/
+/*	$NetBSD: trap.c,v 1.52.4.4 2012/06/15 09:20:00 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52.4.3 2012/06/12 20:43:47 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.52.4.4 2012/06/15 09:20:00 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -183,7 +183,9 @@ trap(struct trapframe *frame)
 #if defined(COMPAT_10) || defined(COMPAT_IBCS2)
 	extern char IDTVEC(oosyscall)[];
 #endif
+#ifndef XEN
 	struct trapframe *vframe;
+#endif
 	void *onfault;
 	int error;
 	uint64_t cr2;



CVS commit: [netbsd-5] src/doc

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 09:09:05 UTC 2012

Modified Files:
src/doc [netbsd-5]: CHANGES-5.2

Log Message:
Ticket #1775


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.175 -r1.1.2.176 src/doc/CHANGES-5.2

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-5.2
diff -u src/doc/CHANGES-5.2:1.1.2.175 src/doc/CHANGES-5.2:1.1.2.176
--- src/doc/CHANGES-5.2:1.1.2.175	Wed Jun 13 14:01:22 2012
+++ src/doc/CHANGES-5.2	Fri Jun 15 09:09:05 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.2,v 1.1.2.175 2012/06/13 14:01:22 sborrill Exp $
+# $NetBSD: CHANGES-5.2,v 1.1.2.176 2012/06/15 09:09:05 sborrill Exp $
 
 A complete list of changes from the NetBSD 5.1 release to the NetBSD 5.2
 release:
@@ -6465,14 +6465,22 @@ sys/arch/amd64/amd64/netbsd32_machdep.c	
 	now instead of trying to jump to the bogus address.
 	[spz, ticket #1773]
 
-sbin/raidctl/raidctl.c	1.52
-sys/dev/raidframe/raidframevar.h			1.15
-sys/dev/raidframe/rf_copyback.c1.45
-sys/dev/raidframe/rf_disks.c1.78
-sys/dev/raidframe/rf_netbsdkintf.c			1.282,1.284
-sys/dev/raidframe/rf_reconstruct.c			1.111
+sbin/raidctl/raidctl.c1.52
+sys/dev/raidframe/raidframevar.h		1.15
+sys/dev/raidframe/rf_copyback.c			1.45
+sys/dev/raidframe/rf_disks.c			1.78
+sys/dev/raidframe/rf_netbsdkintf.c		1.282,1.284
+sys/dev/raidframe/rf_reconstruct.c		1.111
 
 	Fix garbage values in partitionSizeHi with RAID array > 2TB. Stops the check
 	against rf_component_label_partitionsize() failing and stopping auto-configure.
 	[mrg, ticket #1774]
 
+bin/rm/rm.c	1.52
+
+	Rectify race condition in rm -P processing by checking that the
+	file we opened is the one we expected to get. Also use O_NOFOLLOW
+	to help avoid even opening devices, which sometimes produce side
+	effects.
+	[dholland, ticket #1775]
+



CVS commit: [netbsd-5] src/bin/rm

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 09:08:03 UTC 2012

Modified Files:
src/bin/rm [netbsd-5]: rm.c

Log Message:
Pull up the following revisions(s) (requested by dholland in ticket #1775):
bin/rm/rm.c:revision 1.52

Rectify race condition in rm -P processing by checking that the file
we opened is the one we expected to get. Also use O_NOFOLLOW to help
avoid even opening devices, which sometimes produce side effects.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.4.1 src/bin/rm/rm.c

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

Modified files:

Index: src/bin/rm/rm.c
diff -u src/bin/rm/rm.c:1.48 src/bin/rm/rm.c:1.48.4.1
--- src/bin/rm/rm.c:1.48	Sun Jul 20 00:52:40 2008
+++ src/bin/rm/rm.c	Fri Jun 15 09:08:03 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: rm.c,v 1.48 2008/07/20 00:52:40 lukem Exp $ */
+/* $NetBSD: rm.c,v 1.48.4.1 2012/06/15 09:08:03 sborrill Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993, 1994, 2003
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19
 #if 0
 static char sccsid[] = "@(#)rm.c	8.8 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: rm.c,v 1.48 2008/07/20 00:52:40 lukem Exp $");
+__RCSID("$NetBSD: rm.c,v 1.48.4.1 2012/06/15 09:08:03 sborrill Exp $");
 #endif
 #endif /* not lint */
 
@@ -374,7 +374,7 @@ rm_file(char **argv)
 int
 rm_overwrite(char *file, struct stat *sbp)
 {
-	struct stat sb;
+	struct stat sb, sb2;
 	int fd, randint;
 	char randchar;
 
@@ -388,8 +388,18 @@ rm_overwrite(char *file, struct stat *sb
 		return 0;
 
 	/* flags to try to defeat hidden caching by forcing seeks */
-	if ((fd = open(file, O_RDWR|O_SYNC|O_RSYNC, 0)) == -1)
+	if ((fd = open(file, O_RDWR|O_SYNC|O_RSYNC|O_NOFOLLOW, 0)) == -1)
+		goto err;
+
+	if (fstat(fd, &sb2)) {
 		goto err;
+	}
+
+	if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino ||
+	!S_ISREG(sb2.st_mode)) {
+		errno = EPERM;
+		goto err;
+	}
 
 #define RAND_BYTES	1
 #define THIS_BYTE	0



CVS commit: [netbsd-4] src/doc

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 09:04:50 UTC 2012

Modified Files:
src/doc [netbsd-4]: CHANGES-4.1

Log Message:
Ticket #1451


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.243 -r1.1.2.244 src/doc/CHANGES-4.1

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-4.1
diff -u src/doc/CHANGES-4.1:1.1.2.243 src/doc/CHANGES-4.1:1.1.2.244
--- src/doc/CHANGES-4.1:1.1.2.243	Wed Jun 13 15:56:47 2012
+++ src/doc/CHANGES-4.1	Fri Jun 15 09:04:49 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: CHANGES-4.1,v 1.1.2.243 2012/06/13 15:56:47 sborrill Exp $
+#	$NetBSD: CHANGES-4.1,v 1.1.2.244 2012/06/15 09:04:49 sborrill Exp $
 
 A complete list of changes from the NetBSD 4.0 release to the NetBSD 4.1
 release:
@@ -4667,3 +4667,11 @@ sys/dev/pci/if_bge.c1.194 via patch
 	Fixes PR kern/40018.
 	[buhrow, ticket #1449]
 
+bin/rm/rm.c	1.52
+
+	Rectify race condition in rm -P processing by checking that the
+	file we opened is the one we expected to get. Also use O_NOFOLLOW
+	to help avoid even opening devices, which sometimes produce side
+	effects.
+	[dholland, ticket #1451]
+



CVS commit: [netbsd-4] src/bin/rm

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 09:04:35 UTC 2012

Modified Files:
src/bin/rm [netbsd-4]: rm.c

Log Message:
Pull up the following revisions(s) (requested by dholland in ticket #1451):
bin/rm/rm.c:revision 1.52

Rectify race condition in rm -P processing by checking that the file
we opened is the one we expected to get. Also use O_NOFOLLOW to help
avoid even opening devices, which sometimes produce side effects.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.2.1 src/bin/rm/rm.c

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

Modified files:

Index: src/bin/rm/rm.c
diff -u src/bin/rm/rm.c:1.45 src/bin/rm/rm.c:1.45.2.1
--- src/bin/rm/rm.c:1.45	Fri Aug 25 11:00:40 2006
+++ src/bin/rm/rm.c	Fri Jun 15 09:04:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: rm.c,v 1.45 2006/08/25 11:00:40 liamjfoy Exp $ */
+/* $NetBSD: rm.c,v 1.45.2.1 2012/06/15 09:04:35 sborrill Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993, 1994, 2003
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 19
 #if 0
 static char sccsid[] = "@(#)rm.c	8.8 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: rm.c,v 1.45 2006/08/25 11:00:40 liamjfoy Exp $");
+__RCSID("$NetBSD: rm.c,v 1.45.2.1 2012/06/15 09:04:35 sborrill Exp $");
 #endif
 #endif /* not lint */
 
@@ -372,7 +372,7 @@ rm_file(char **argv)
 int
 rm_overwrite(char *file, struct stat *sbp)
 {
-	struct stat sb;
+	struct stat sb, sb2;
 	int fd, randint;
 	char randchar;
 
@@ -386,8 +386,18 @@ rm_overwrite(char *file, struct stat *sb
 		return 0;
 
 	/* flags to try to defeat hidden caching by forcing seeks */
-	if ((fd = open(file, O_RDWR|O_SYNC|O_RSYNC, 0)) == -1)
+	if ((fd = open(file, O_RDWR|O_SYNC|O_RSYNC|O_NOFOLLOW, 0)) == -1)
+		goto err;
+
+	if (fstat(fd, &sb2)) {
 		goto err;
+	}
+
+	if (sb2.st_dev != sbp->st_dev || sb2.st_ino != sbp->st_ino ||
+	!S_ISREG(sb2.st_mode)) {
+		errno = EPERM;
+		goto err;
+	}
 
 #define RAND_BYTES	1
 #define THIS_BYTE	0



CVS commit: [netbsd-6] src/doc

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 08:54:01 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.0

Log Message:
Ticket #345


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.130 -r1.1.2.131 src/doc/CHANGES-6.0

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-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.130 src/doc/CHANGES-6.0:1.1.2.131
--- src/doc/CHANGES-6.0:1.1.2.130	Fri Jun 15 08:49:59 2012
+++ src/doc/CHANGES-6.0	Fri Jun 15 08:54:01 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.130 2012/06/15 08:49:59 sborrill Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.131 2012/06/15 08:54:01 sborrill Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -5651,3 +5651,9 @@ sys/arch/amd64/conf/GENERIC			1.1075 via
 	wireless adapter. From OpenBSD.
 	[riz, ticket #343]
 
+tests/lib/libc/sys/t_mmap.c			1.7
+
+	Disable the mmap_block test again. It is only by accident that
+	it doesn't panic when mmaping /dev/wd0d. PR kern/46592
+	[bouyer, ticket #345]
+



CVS commit: [netbsd-6] src/tests/lib/libc/sys

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 08:53:33 UTC 2012

Modified Files:
src/tests/lib/libc/sys [netbsd-6]: t_mmap.c

Log Message:
Pull up the following revisions(s) (requested by bouyer in ticket #345):
tests/lib/libc/sys/t_mmap.c:revision 1.7

Disable the mmap_block test again. It is only by accident that it doesn't
panic when mmaping /dev/wd0d. PR kern/46592


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.1 -r1.2.4.2 src/tests/lib/libc/sys/t_mmap.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_mmap.c
diff -u src/tests/lib/libc/sys/t_mmap.c:1.2.4.1 src/tests/lib/libc/sys/t_mmap.c:1.2.4.2
--- src/tests/lib/libc/sys/t_mmap.c:1.2.4.1	Mon Jun 11 21:25:02 2012
+++ src/tests/lib/libc/sys/t_mmap.c	Fri Jun 15 08:53:32 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mmap.c,v 1.2.4.1 2012/06/11 21:25:02 riz Exp $ */
+/* $NetBSD: t_mmap.c,v 1.2.4.2 2012/06/15 08:53:32 sborrill Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_mmap.c,v 1.2.4.1 2012/06/11 21:25:02 riz Exp $");
+__RCSID("$NetBSD: t_mmap.c,v 1.2.4.2 2012/06/15 08:53:32 sborrill Exp $");
 
 #include 
 #include 
@@ -170,8 +170,7 @@ ATF_TC_BODY(mmap_block, tc)
 	size_t len;
 	int fd = -1;
 
-	atf_tc_expect_signal(SIGSEGV, "mmap of block devices does not work "
-	"(PR kern/38889)");
+	atf_tc_skip("The test case causes a panic (PR kern/38889, kern/46592)");
 
 	ATF_REQUIRE(sysctl(mib, miblen, NULL, &len, NULL, 0) == 0);
 	drives = malloc(len);



CVS commit: [netbsd-6] src/doc

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 08:49:59 UTC 2012

Modified Files:
src/doc [netbsd-6]: CHANGES-6.0

Log Message:
Ticket #343


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.129 -r1.1.2.130 src/doc/CHANGES-6.0

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-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.129 src/doc/CHANGES-6.0:1.1.2.130
--- src/doc/CHANGES-6.0:1.1.2.129	Thu Jun 14 09:51:26 2012
+++ src/doc/CHANGES-6.0	Fri Jun 15 08:49:59 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.129 2012/06/14 09:51:26 sborrill Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.130 2012/06/15 08:49:59 sborrill Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -5636,3 +5636,18 @@ sys/modules/if_urtwn/if_urtwn.ioconf		1.
 	Add support for urtwn(4) wireless. Ported from OpenBSD
 	[riz, ticket #326]
 
+sys/dev/usb/files.usb1.122
+sys/dev/usb/if_urtw.c1.1
+sys/dev/usb/if_urtwreg.h			1.1
+sys/dev/usb/usbdevs1.617
+share/man/man4/Makefile1.586
+share/man/man4/urtw.41.1
+distrib/sets/lists/man/mi			1.1393
+sys/dev/usb/usbdevs1.617
+sys/arch/i386/conf/GENERIC			1.357
+sys/arch/amd64/conf/GENERIC			1.1075 via patch
+
+	Add urtw(4) driver for Realtek RTL8187/RTL8187B 802.11b/g USB
+	wireless adapter. From OpenBSD.
+	[riz, ticket #343]
+



CVS commit: [netbsd-6] src/sys/dev/usb

2012-06-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Jun 15 08:49:20 UTC 2012

Modified Files:
src/sys/dev/usb [netbsd-6]: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.600.2.3 -r1.600.2.4 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.601.2.3 -r1.601.2.4 src/sys/dev/usb/usbdevs_data.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/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.600.2.3 src/sys/dev/usb/usbdevs.h:1.600.2.4
--- src/sys/dev/usb/usbdevs.h:1.600.2.3	Thu Jun 14 09:49:26 2012
+++ src/sys/dev/usb/usbdevs.h	Fri Jun 15 08:49:19 2012
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.600.2.3 2012/06/14 09:49:26 sborrill Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.600.2.4 2012/06/15 08:49:19 sborrill Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.607.2.3 2012/06/14 09:48:47 sborrill Exp
+ *	NetBSD: usbdevs,v 1.607.2.4 2012/06/15 08:48:47 sborrill Exp
  */
 
 /*
@@ -834,6 +834,7 @@
 #define	USB_PRODUCT_ASUSTEK_WL167G	0x1707		/* WL-167g USB2.0 WLAN Adapter */
 #define	USB_PRODUCT_ASUSTEK_WL159G	0x170c		/* WL-159g */
 #define	USB_PRODUCT_ASUSTEK_A9T_WIFI	0x171b		/* A9T wireless */
+#define	USB_PRODUCT_ASUSTEK_P5B_WIFI	0x171d		/* P5B wireless */
 #define	USB_PRODUCT_ASUSTEK_WL167G_2	0x1723		/* WL-167g USB2.0 WLAN Adapter (version 2) */
 #define	USB_PRODUCT_ASUSTEK_WL167G_3	0x1724		/* WL-167g USB2.0 WLAN Adapter (version 2) */
 #define	USB_PRODUCT_ASUSTEK_RT2870_1	0x1731		/* RT2870 */
@@ -946,6 +947,7 @@
 #define	USB_PRODUCT_BELKIN_F5D7051	0x7051		/* F5D7051 54g USB Network Adapter */
 #define	USB_PRODUCT_BELKIN_F5D7050A	0x705a		/* F5D705A 54g USB Network Adapter */
 #define	USB_PRODUCT_BELKIN_F5D7050C	0x705c		/* F5D705C 54g USB Network Adapter */
+#define	USB_PRODUCT_BELKIN_F5D7050E	0x705c		/* F5D705E 54g USB Network Adapter */
 #define	USB_PRODUCT_BELKIN_RT2870_1	0x8053		/* RT2870 */
 #define	USB_PRODUCT_BELKIN_RT2870_2	0x805c		/* RT2870 */
 #define	USB_PRODUCT_BELKIN_F5D8053V3	0x815c		/* F5D8053 v3 */
@@ -1796,6 +1798,7 @@
 #define	USB_PRODUCT_LINKSYS4_USB1000	0x0039		/* USB1000 */
 #define	USB_PRODUCT_LINKSYS4_WUSB100	0x0070		/* WUSB100 */
 #define	USB_PRODUCT_LINKSYS4_WUSB600N	0x0071		/* WUSB600N */
+#define	USB_PRODUCT_LINKSYS4_WUSB54GC_2	0x0073		/* WUSB54GC v2 */
 #define	USB_PRODUCT_LINKSYS4_WUSB54GC_3	0x0077		/* WUSB54GC v3 */
 
 /* Logitec products */
@@ -2653,7 +2656,9 @@
 #define	USB_PRODUCT_SITECOM_CN104	0x2068		/* CN104 serial */
 
 /* Sitecom Europe products */
+#define	USB_PRODUCT_SITECOMEU_WL168V1	0x000d		/* WL-168 v1 */
 #define	USB_PRODUCT_SITECOMEU_RT2870_1	0x0017		/* RT2870 */
+#define	USB_PRODUCT_SITECOMEU_WL168V4	0x0028		/* WL-168 v4 */
 #define	USB_PRODUCT_SITECOMEU_RT2870_2	0x002b		/* RT2870 */
 #define	USB_PRODUCT_SITECOMEU_RT2870_3	0x002c		/* RT2870 */
 #define	USB_PRODUCT_SITECOMEU_RT2870_4	0x002d		/* RT2870 */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.601.2.3 src/sys/dev/usb/usbdevs_data.h:1.601.2.4
--- src/sys/dev/usb/usbdevs_data.h:1.601.2.3	Thu Jun 14 09:49:27 2012
+++ src/sys/dev/usb/usbdevs_data.h	Fri Jun 15 08:49:19 2012
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.601.2.3 2012/06/14 09:49:27 sborrill Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.601.2.4 2012/06/15 08:49:19 sborrill Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.607.2.3 2012/06/14 09:48:47 sborrill Exp
+ *	NetBSD: usbdevs,v 1.607.2.4 2012/06/15 08:48:47 sborrill Exp
  */
 
 /*
@@ -2767,6 +2767,10 @@ const struct usb_product usb_products[] 
 	"A9T wireless",
 	},
 	{
+	USB_VENDOR_ASUSTEK, USB_PRODUCT_ASUSTEK_P5B_WIFI,
+	"P5B wireless",
+	},
+	{
 	USB_VENDOR_ASUSTEK, USB_PRODUCT_ASUSTEK_WL167G_2,
 	"WL-167g USB2.0 WLAN Adapter (version 2)",
 	},
@@ -3099,6 +3103,10 @@ const struct usb_product usb_products[] 
 	"F5D705C 54g USB Network Adapter",
 	},
 	{
+	USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D7050E,
+	"F5D705E 54g USB Network Adapter",
+	},
+	{
 	USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_RT2870_1,
 	"RT2870",
 	},
@@ -5475,6 +5483,10 @@ const struct usb_product usb_products[] 
 	"WUSB600N",
 	},
 	{
+	USB_VENDOR_LINKSYS4, USB_PRODUCT_LINKSYS4_WUSB54GC_2,
+	"WUSB54GC v2",
+	},
+	{
 	USB_VENDOR_LINKSYS4, USB_PRODUCT_LINKSYS4_WUSB54GC_3,
 	"WUSB54GC v3",
 	},
@@ -7975,10 +7987,18 @@ const struct usb_product usb_products[] 
 	"CN104 serial",
 	},
 	{
+	USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_WL168V1,
+	"WL-168 v1",
+	},
+	{
 	USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_RT2870_1,
 	"RT2870",
 	},
 	{
+	USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_WL168V4,
+	"WL-168 v4",
+	},
+	{
 	USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_RT2870_2,
 	"RT2870",
 	},
@@ -9027,4 +9047,4 @@ const str