CVS commit: src/tests/lib

2012-09-26 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Sep 26 07:24:38 UTC 2012

Modified Files:
src/tests/lib/libc/stdlib: t_strtod.c
src/tests/lib/libm: t_infinity.c

Log Message:
Remove expected failures that no longer fail (probably due a Qemu update).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/lib/libc/stdlib/t_strtod.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libm/t_infinity.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/stdlib/t_strtod.c
diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.30 src/tests/lib/libc/stdlib/t_strtod.c:1.31
--- src/tests/lib/libc/stdlib/t_strtod.c:1.30	Tue May 15 18:46:20 2012
+++ src/tests/lib/libc/stdlib/t_strtod.c	Wed Sep 26 07:24:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_strtod.c,v 1.30 2012/05/15 18:46:20 alnsn Exp $ */
+/*	$NetBSD: t_strtod.c,v 1.31 2012/09/26 07:24:38 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Public domain, Otto Moerbeek o...@drijf.net, 2006. */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: t_strtod.c,v 1.30 2012/05/15 18:46:20 alnsn Exp $);
+__RCSID($NetBSD: t_strtod.c,v 1.31 2012/09/26 07:24:38 jruoho Exp $);
 
 #include errno.h
 #include math.h
@@ -155,8 +155,6 @@ ATF_TC_BODY(strtold_inf, tc)
 {
 #ifndef __vax__
 #   ifdef __HAVE_LONG_DOUBLE
-	if (system(cpuctl identify 0 | grep -q QEMU) == 0)
-		atf_tc_expect_fail(PR misc/44767);
 
 	for (size_t i = 0; i  __arraycount(inf_strings); i++) {
 		volatile long double ld = strtold(inf_strings[i], NULL);
@@ -221,9 +219,6 @@ ATF_TC_BODY(strtold_nan, tc)
 
 	char *end;
 
-	if (system(cpuctl identify 0 | grep -q QEMU) == 0)
-		atf_tc_expect_fail(PR misc/44767);
-
 	volatile long double ld = strtold(nan_string, end);
 	ATF_REQUIRE(isnan(ld) != 0);
 	ATF_REQUIRE(__isnanl(ld) != 0);

Index: src/tests/lib/libm/t_infinity.c
diff -u src/tests/lib/libm/t_infinity.c:1.5 src/tests/lib/libm/t_infinity.c:1.6
--- src/tests/lib/libm/t_infinity.c:1.5	Fri Jul  8 05:10:05 2011
+++ src/tests/lib/libm/t_infinity.c	Wed Sep 26 07:24:38 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: t_infinity.c,v 1.5 2011/07/08 05:10:05 jruoho Exp $ */
+/* $NetBSD: t_infinity.c,v 1.6 2012/09/26 07:24:38 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_infinity.c,v 1.5 2011/07/08 05:10:05 jruoho Exp $);
+__RCSID($NetBSD: t_infinity.c,v 1.6 2012/09/26 07:24:38 jruoho Exp $);
 
 #include atf-c.h
 #include math.h
@@ -89,11 +89,6 @@ ATF_TC_HEAD(infinity_long_double, tc)
 
 ATF_TC_BODY(infinity_long_double, tc)
 {
-	/*
-	 * May fail under QEMU; cf. PR misc/44767.
-	 */
-	if (system(cpuctl identify 0 | grep -q QEMU) == 0)
-		atf_tc_expect_fail(PR misc/44767);
 
 #ifndef LDBL_MAX
 	atf_tc_skip(no long double support on this architecture);



CVS commit: src/lib/libc/gen

2012-09-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Sep 26 15:33:43 UTC 2012

Modified Files:
src/lib/libc/gen: fts.c

Log Message:
Fix in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/gen/fts.c

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

Modified files:

Index: src/lib/libc/gen/fts.c
diff -u src/lib/libc/gen/fts.c:1.45 src/lib/libc/gen/fts.c:1.46
--- src/lib/libc/gen/fts.c:1.45	Sat Sep 15 19:31:12 2012
+++ src/lib/libc/gen/fts.c	Wed Sep 26 15:33:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fts.c,v 1.45 2012/09/15 19:31:12 spz Exp $	*/
+/*	$NetBSD: fts.c,v 1.46 2012/09/26 15:33:43 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = @(#)fts.c	8.6 (Berkeley) 8/14/94;
 #else
-__RCSID($NetBSD: fts.c,v 1.45 2012/09/15 19:31:12 spz Exp $);
+__RCSID($NetBSD: fts.c,v 1.46 2012/09/26 15:33:43 msaitoh Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -205,7 +205,7 @@ fts_open(char * const *argv, int options
 	sp-fts_cur-fts_info = FTS_INIT;
 
 	/*
-	 * If using chdir(2), grab a file descriptor pointing to dot to insure
+	 * If using chdir(2), grab a file descriptor pointing to dot to ensure
 	 * that we can get back here; this could be avoided for some paths,
 	 * but almost certainly not worth the effort.  Slashes, symbolic links,
 	 * and .. are all fairly nasty problems.  Note, if we can't get the
@@ -488,7 +488,7 @@ name:		t = sp-fts_path + NAPPEND(p-fts
 		return (sp-fts_cur = NULL);
 	}
 
-	/* Nul terminate the pathname. */
+	/* NUL terminate the pathname. */
 	sp-fts_path[p-fts_pathlen] = '\0';
 
 	/*



CVS commit: src/sys/arch/arm/arm32

2012-09-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep 26 18:18:08 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
If we get a fault we shouldn't have, set pmap_needs_pte_sync and retry.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.237 src/sys/arch/arm/arm32/pmap.c:1.238
--- src/sys/arch/arm/arm32/pmap.c:1.237	Sat Sep 22 00:33:37 2012
+++ src/sys/arch/arm/arm32/pmap.c	Wed Sep 26 18:18:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.237 2012/09/22 00:33:37 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.238 2012/09/26 18:18:08 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -212,7 +212,7 @@
 #include arm/cpuconf.h
 #include arm/arm32/katelib.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.237 2012/09/22 00:33:37 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.238 2012/09/26 18:18:08 matt Exp $);
 
 #ifdef PMAP_DEBUG
 
@@ -4002,6 +4002,17 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, 
 	}
 #endif /* CPU_SA110 */
 
+	/*
+	 * If 'rv == 0' at this point, it generally indicates that there is a
+	 * stale TLB entry for the faulting address.  That might be due to a
+	 * wrong setting of pmap_needs_pte_sync.  So set it and retry.
+	 */
+	if (rv == 0  pm-pm_l1-l1_domain_use_count == 1
+	 pmap_needs_pte_sync == 0) {
+		pmap_needs_pte_sync = 1;
+		rv = 1;
+	}
+
 #ifdef DEBUG
 	/*
 	 * If 'rv == 0' at this point, it generally indicates that there is a



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

2012-09-26 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Sep 26 21:58:27 UTC 2012

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
npf.conf(5): improve and explain grammar definition.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/npf/npfctl/npf.conf.5

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.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.15 src/usr.sbin/npf/npfctl/npf.conf.5:1.16
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.15	Mon Aug 13 01:18:31 2012
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Wed Sep 26 21:58:27 2012
@@ -1,4 +1,4 @@
-.\$NetBSD: npf.conf.5,v 1.15 2012/08/13 01:18:31 rmind Exp $
+.\$NetBSD: npf.conf.5,v 1.16 2012/09/26 21:58:27 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 August 12, 2012
+.Dd September 26, 2012
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -132,40 +132,64 @@ There are two types of storage: tree (
 hash.
 .\ -
 .Sh GRAMMAR
+The following is a non-formal BNF-like definition of the grammar.
+The definition is simplified and is intended to be human readable,
+therefore it does not strictly represent the full syntax, which
+is more flexible.
 .Bd -literal
-line		= ( def | table | map | group | rproc )
+; Syntax of a single line.  Lines can be separated by LF (\n) or
+; a semicolon.  Comments start with a hash (#) character.
 
-var		= $\*[Lt]name\*[Gt]
-iface		= ( \*[Lt]interface\*[Gt] | var )
-def		= ( var = { \*[Lt]value_1\*[Gt], \*[Lt]value_2\*[Gt], ... } | \*[Lt]value\*[Gt] )
-
-table		= table \*[Lt]tid\*[Gt] type ( hash | tree )
-		  ( dynamic | file \*[Lt]path\*[Gt] )
-
-map-di		= ( - | - | - )
-map-type	= ( static | dynamic )
-map		= map iface map-type \*[Lt]seg1\*[Gt] map-di \*[Lt]seg2\*[Gt] [ pass filt-opts ]
-
-rproc		= procedure \*[Lt]name\*[Gt] procs
-procs		= { op1 \*[Lt]newline\*[Gt], op2 \*[Lt]newline\*[Gt], ... }
-op		= ( log iface | normalise ( norm-opt1 , norm-opt2 ... ) )
-norm-opt	= [ random-id | min-ttl \*[Lt]num\*[Gt] | max-mss \*[Lt]num\*[Gt] | no-df ]
-
-group		= group ( ( default | group-opts ) ) ruleset
-group-opts	= [ name \*[Lt]name\*[Gt] , ] interface iface [ , ( in | out ) ]
-
-ruleset		= { rule1 \*[Lt]newline\*[Gt], rule2 \*[Lt]newline\*[Gt], ... }
-
-rule		= ( block block-opts | pass ) [ stateful ] [ in | out ] [ final ]
-		  [ on iface ] [ family fam-opt ] [ proto \*[Lt]protocol\*[Gt] [ proto-opts ] ]
-		  ( all | filt-opts ) [ apply rproc ] }
-
-fam-opt		= [ inet | inet6 ]
-block-opts	= [ return-rst | return-icmp | return ]
-filt-addr	= iface | var | \*[Lt]addr/mask\*[Gt] | \*[Lt]tid\*[Gt]
-port-opts	= [ port ( \*[Lt]port-num\*[Gt] | \*[Lt]port-from\*[Gt] - \*[Lt]port-to\*[Gt] | var ) ]
-filt-opts	= [ from filt-addr [ port-opts ] ] [ to filt-addr [ port-opts ] ]
-proto-opts	= [ flags \*[Lt]tcp_flags\*[Gt] | icmp-type \*[Lt]type\*[Gt] code \*[Lt]code\*[Gt] ]
+syntax		= var-def | table-def | map | group | rproc | comment
+
+; Variable definition.  Names can be alpha-numeric, including _ character.
+
+var-name	= $ . string
+interface	= interface-name | var-name
+var-def		= var = ( var-value | { value *[ , value ] } )
+
+; Table definition.  Table ID shall be numeric.  Path is in the double quotes.
+
+table-id	= \*[Lt]tid\*[Gt]
+table-def	= table table-id type ( hash | tree )
+		  ( dynamic | file path )
+
+; Mapping for address translation.
+
+map		= map interface ( static | dynamic )
+		  net-seg ( - | - | - ) net-seg
+		  [ pass filt-opts ]
+
+; Rule procedure definition.  The name should be in the double quotes.
+; 
+; Each call can have its own options in a form of key-value pairs.
+; Both key and values may be strings (either in double quotes or not)
+; and numbers, depending on the extension.
+
+proc		= procedure proc-name { *( proc-call [ new-line ] ) }
+proc-opts	= key   val [ , proc-opts ]
+proc-call	= call-name : proc-opts new-line
+
+; Group definition and the ruleset.
+
+group		= group ( ( default | group-opts ) ) { ruleset }
+group-opts	= [ name string ] [ interface interface ] [ in | out ]
+ruleset		= [ rule new-line ] [ ruleset ]
+
+rule		= ( block [ block-opts ] | pass ) [ stateful ]
+		  [ in | out ] [ final ] [ on iface ]
+		  [ family fam-opt ] [ proto protocol [ proto-opts ] ]
+		  ( all | filt-opts ) [ apply proc-name ]
+
+block-opts	= return-rst | return-icmp | return
+fam-opt		= inet | inet6
+proto-opts	= flags tcp-flags [ / tcp-flag-mask ] |
+		  icmp-type type [ code icmp-code ]
+
+addr-mask	= addr [ / mask ]
+filt-opts	= from filt-addr [ port-opts ] to filt-addr [ port-opts ]
+filt-addr	= [ interface | var-name | addr-mask | table-id | any ]
+filt-port	= port ( port-num | port-from - port-to | var-name )
 .Ed
 .\ -
 .Sh FILES
@@ -197,12 +221,8 @@ 

CVS commit: src/tests/lib/libc/hash

2012-09-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Sep 26 22:23:30 UTC 2012

Modified Files:
src/tests/lib/libc/hash: t_sha2.c

Log Message:
Fix year.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/hash/t_sha2.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/hash/t_sha2.c
diff -u src/tests/lib/libc/hash/t_sha2.c:1.2 src/tests/lib/libc/hash/t_sha2.c:1.3
--- src/tests/lib/libc/hash/t_sha2.c:1.2	Wed Nov  3 16:10:22 2010
+++ src/tests/lib/libc/hash/t_sha2.c	Wed Sep 26 22:23:30 2012
@@ -1,6 +1,6 @@
-/*	$NetBSD: t_sha2.c,v 1.2 2010/11/03 16:10:22 christos Exp $	*/
+/*	$NetBSD: t_sha2.c,v 1.3 2012/09/26 22:23:30 joerg Exp $	*/
 /*-
- * Copyright (c) 20010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: t_sha2.c,v 1.2 2010/11/03 16:10:22 christos Exp $);
+__RCSID($NetBSD: t_sha2.c,v 1.3 2012/09/26 22:23:30 joerg Exp $);
 
 #include atf-c.h
 #include sys/types.h



CVS commit: src/usr.bin/fstat

2012-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 26 23:01:04 UTC 2012

Modified Files:
src/usr.bin/fstat: fstat.c

Log Message:
fix non-numeric address and port printing.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/fstat/fstat.c

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

Modified files:

Index: src/usr.bin/fstat/fstat.c
diff -u src/usr.bin/fstat/fstat.c:1.96 src/usr.bin/fstat/fstat.c:1.97
--- src/usr.bin/fstat/fstat.c:1.96	Sat Mar 24 17:51:23 2012
+++ src/usr.bin/fstat/fstat.c	Wed Sep 26 19:01:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstat.c,v 1.96 2012/03/24 21:51:23 christos Exp $	*/
+/*	$NetBSD: fstat.c,v 1.97 2012/09/26 23:01:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)fstat.c	8.3 (Berkeley) 5/2/95;
 #else
-__RCSID($NetBSD: fstat.c,v 1.96 2012/03/24 21:51:23 christos Exp $);
+__RCSID($NetBSD: fstat.c,v 1.97 2012/09/26 23:01:04 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -767,31 +767,36 @@ getmnton(struct mount *m)
 static const char *
 inet_addrstr(char *buf, size_t len, const struct in_addr *a, uint16_t p)
 {
-	char addr[256];
+	char addr[256], serv[256];
+	struct sockaddr_in sin;
+	const int niflags = nflg ? (NI_NUMERICHOST|NI_NUMERICSERV) : 0;
+
+	(void)memset(sin, 0, sizeof(sin));
+	sin.sin_family = AF_INET;
+	sin.sin_len = sizeof(sin);
+	sin.sin_addr = *a;
+	sin.sin_port = htons(p);
+
+	serv[0] = '\0';
+
+	if (getnameinfo((struct sockaddr *)sin, sin.sin_len,
+	addr, sizeof(addr), serv, sizeof(serv), niflags)) {
+		if (inet_ntop(AF_INET, a, addr, sizeof(addr)) == NULL)
+			strlcpy(addr, invalid, sizeof(addr));
+	}
+
+	if (serv[0] == '\0')
+		snprintf(serv, sizeof(serv), %u, p);
 
 	if (a-s_addr == INADDR_ANY) {
 		if (p == 0)
-			addr[0] = '\0';
+			buf[0] = '\0';
 		else
-			strlcpy(addr, *, sizeof(addr));
-	} else {
-		struct sockaddr_in sin;
-		const int niflags = NI_NUMERICHOST;
-
-		(void)memset(sin, 0, sizeof(sin));
-		sin.sin_family = AF_INET6;
-		sin.sin_len = sizeof(sin);
-		sin.sin_addr = *a;
-
-		if (getnameinfo((struct sockaddr *)sin, sin.sin_len,
-		addr, sizeof(addr), NULL, 0, niflags))
-			if (inet_ntop(AF_INET, a, addr, sizeof(addr)) == NULL)
-strlcpy(addr, invalid, sizeof(addr));
+			snprintf(buf, len, *:%s, serv);
+		return buf;
 	}
-	if (addr[0])
-		snprintf(buf, len, %s:%u, addr, p);
-	else
-		strlcpy(buf, addr, len);
+
+	snprintf(buf, len, %s:%s, addr, serv);
 	return buf;
 }
 
@@ -799,39 +804,47 @@ inet_addrstr(char *buf, size_t len, cons
 static const char *
 inet6_addrstr(char *buf, size_t len, const struct in6_addr *a, uint16_t p)
 {
-	char addr[256];
+	char addr[256], serv[256];
+	struct sockaddr_in6 sin6;
+	const int niflags = nflg ? (NI_NUMERICHOST|NI_NUMERICSERV) : 0;
+
+	(void)memset(sin6, 0, sizeof(sin6));
+	sin6.sin6_family = AF_INET6;
+	sin6.sin6_len = sizeof(sin6);
+	sin6.sin6_addr = *a;
+	sin6.sin6_port = htons(p);
+
+	if (IN6_IS_ADDR_LINKLOCAL(a) 
+	*(u_int16_t *)sin6.sin6_addr.s6_addr[2] != 0) {
+		sin6.sin6_scope_id =
+			ntohs(*(uint16_t *)sin6.sin6_addr.s6_addr[2]);
+		sin6.sin6_addr.s6_addr[2] = 0;
+		sin6.sin6_addr.s6_addr[3] = 0;
+	}
+
+	serv[0] = '\0';
+
+	if (getnameinfo((struct sockaddr *)sin6, sin6.sin6_len,
+	addr, sizeof(addr), serv, sizeof(serv), niflags)) {
+		if (inet_ntop(AF_INET6, a, addr, sizeof(addr)) == NULL)
+			strlcpy(addr, invalid, sizeof(addr));
+	}
+
+	if (serv[0] == '\0')
+		snprintf(serv, sizeof(serv), %u, p);
 
 	if (IN6_IS_ADDR_UNSPECIFIED(a)) {
 		if (p == 0)
-			addr[0] = '\0';
+			buf[0] = '\0';
 		else
-			strlcpy(addr, *, sizeof(addr));
-	} else {
-		struct sockaddr_in6 sin6;
-		const int niflags = NI_NUMERICHOST;
-
-		(void)memset(sin6, 0, sizeof(sin6));
-		sin6.sin6_family = AF_INET6;
-		sin6.sin6_len = sizeof(sin6);
-		sin6.sin6_addr = *a;
-
-		if (IN6_IS_ADDR_LINKLOCAL(a) 
-		*(u_int16_t *)sin6.sin6_addr.s6_addr[2] != 0) {
-			sin6.sin6_scope_id =
-ntohs(*(uint16_t *)sin6.sin6_addr.s6_addr[2]);
-			sin6.sin6_addr.s6_addr[2] = 0;
-			sin6.sin6_addr.s6_addr[3] = 0;
-		}
-
-		if (getnameinfo((struct sockaddr *)sin6, sin6.sin6_len,
-		addr, sizeof(addr), NULL, 0, niflags))
-			if (inet_ntop(AF_INET6, a, addr, sizeof(addr)) == NULL)
-strlcpy(addr, invalid, sizeof(addr));
+			snprintf(buf, len, *:%s, serv);
+		return buf;
 	}
-	if (addr[0])
-		snprintf(buf, len, [%s]:%u, addr, p);
+
+	if (strchr(addr, ':') == NULL)
+		snprintf(buf, len, %s:%s, addr, serv);
 	else
-		strlcpy(buf, addr, len);
+		snprintf(buf, len, [%s]:%s, addr, serv);
 
 	return buf;
 }



CVS commit: src/lib/libc/net

2012-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 26 23:13:00 UTC 2012

Modified Files:
src/lib/libc/net: getnameinfo.3 getnameinfo.c

Log Message:
add and document AF_LOCAL (and the rest that were not)


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/lib/libc/net/getnameinfo.3
cvs rdiff -u -r1.52 -r1.53 src/lib/libc/net/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/lib/libc/net/getnameinfo.3
diff -u src/lib/libc/net/getnameinfo.3:1.38 src/lib/libc/net/getnameinfo.3:1.39
--- src/lib/libc/net/getnameinfo.3:1.38	Sat Mar  3 22:23:35 2012
+++ src/lib/libc/net/getnameinfo.3	Wed Sep 26 19:13:00 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: getnameinfo.3,v 1.38 2012/03/04 03:23:35 christos Exp $
+.\	$NetBSD: getnameinfo.3,v 1.39 2012/09/26 23:13:00 christos Exp $
 .\	$KAME: getnameinfo.3,v 1.37 2005/01/05 03:23:05 itojun Exp $
 .\	$OpenBSD: getnameinfo.3,v 1.36 2004/12/21 09:48:20 jmc Exp $
 .\
@@ -17,7 +17,7 @@
 .\ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 .\ PERFORMANCE OF THIS SOFTWARE.
 .\
-.Dd March 3, 2012
+.Dd September 26, 2012
 .Dt GETNAMEINFO 3
 .Os
 .Sh NAME
@@ -47,11 +47,19 @@ The
 .Li sockaddr
 structure
 .Fa sa
-should point to either a
+should point to a
 .Li sockaddr_in
-or
+(for IPv4),
 .Li sockaddr_in6
-structure (for IPv4 or IPv6 respectively) that is
+(for IPv6),
+.Li sockaddr_atalk
+(for AppleTalk),
+.Li sockaddr_link
+(for link layer),
+or
+.Li sockaddr_local
+(for local/unix)
+structures that are
 .Fa salen
 bytes long.
 .Pp

Index: src/lib/libc/net/getnameinfo.c
diff -u src/lib/libc/net/getnameinfo.c:1.52 src/lib/libc/net/getnameinfo.c:1.53
--- src/lib/libc/net/getnameinfo.c:1.52	Tue Mar 20 13:44:18 2012
+++ src/lib/libc/net/getnameinfo.c	Wed Sep 26 19:13:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: getnameinfo.c,v 1.52 2012/03/20 17:44:18 matt Exp $	*/
+/*	$NetBSD: getnameinfo.c,v 1.53 2012/09/26 23:13:00 christos Exp $	*/
 /*	$KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $	*/
 
 /*
@@ -47,12 +47,13 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: getnameinfo.c,v 1.52 2012/03/20 17:44:18 matt Exp $);
+__RCSID($NetBSD: getnameinfo.c,v 1.53 2012/09/26 23:13:00 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
 #include sys/types.h
 #include sys/socket.h
+#include sys/un.h
 #include net/if.h
 #include net/if_dl.h
 #include net/if_ieee1394.h
@@ -104,6 +105,8 @@ static int ip6_sa2str(const struct socka
 #endif
 static int getnameinfo_atalk(const struct sockaddr *, socklen_t, char *,
 socklen_t, char *, socklen_t, int);
+static int getnameinfo_local(const struct sockaddr *, socklen_t, char *,
+socklen_t, char *, socklen_t, int);
 
 static int getnameinfo_link(const struct sockaddr *, socklen_t, char *,
 socklen_t, char *, socklen_t, int);
@@ -131,6 +134,9 @@ getnameinfo(const struct sockaddr *sa, s
 	case AF_LINK:
 		return getnameinfo_link(sa, salen, host, hostlen,
 		serv, servlen, flags);
+	case AF_LOCAL:
+		return getnameinfo_local(sa, salen, host, hostlen,
+		serv, servlen, flags);
 	default:
 		return EAI_FAMILY;
 	}
@@ -197,6 +203,29 @@ errout:
 }
 
 /*
+ * getnameinfo_local():
+ * Format an local address into a printable format.
+ */
+/* ARGSUSED */
+static int
+getnameinfo_local(const struct sockaddr *sa, socklen_t salen,
+char *host, socklen_t hostlen, char *serv, socklen_t servlen,
+int flags)
+{
+	const struct sockaddr_un *sun =
+	(const struct sockaddr_un *)(const void *)sa;
+
+	if (serv != NULL  servlen  0)
+		serv[0] = '\0';
+
+	if (host  hostlen  0)
+		strlcpy(host, sun-sun_path,
+		MIN(sizeof(sun-sun_path) + 1, hostlen));
+
+	return 0;
+}
+
+/*
  * getnameinfo_inet():
  * Format an IPv4 or IPv6 sockaddr into a printable string.
  */



CVS commit: src/external/bsd/atf/dist/atf-c

2012-09-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Sep 26 23:27:34 UTC 2012

Modified Files:
src/external/bsd/atf/dist/atf-c: atf-c-api.3

Log Message:
now sense - no sense


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.7 -r1.2 src/external/bsd/atf/dist/atf-c/atf-c-api.3

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/atf/dist/atf-c/atf-c-api.3
diff -u src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.1.1.7 src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.2
--- src/external/bsd/atf/dist/atf-c/atf-c-api.3:1.1.1.7	Mon Jan 16 22:36:31 2012
+++ src/external/bsd/atf/dist/atf-c/atf-c-api.3	Wed Sep 26 23:27:34 2012
@@ -382,7 +382,7 @@ variant of the macros immediately abort 
 condition is detected by calling the
 .Fn atf_tc_fail
 function.
-Use this variant whenever it makes now sense to continue the execution of a
+Use this variant whenever it makes no sense to continue the execution of a
 test case when the checked condition is not met.
 The
 .Sq CHECK



CVS commit: src/sys/arch/evbarm/bcm53xx

2012-09-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Sep 27 00:22:39 UTC 2012

Modified Files:
src/sys/arch/evbarm/bcm53xx: bcm53xx_machdep.c bcm53xx_start.S

Log Message:
Print out u-boot args


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/bcm53xx/bcm53xx_start.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/evbarm/bcm53xx/bcm53xx_machdep.c
diff -u src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c:1.2 src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c:1.3
--- src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c:1.2	Fri Sep  7 11:53:49 2012
+++ src/sys/arch/evbarm/bcm53xx/bcm53xx_machdep.c	Thu Sep 27 00:22:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_machdep.c,v 1.2 2012/09/07 11:53:49 matt Exp $	*/
+/*	$NetBSD: bcm53xx_machdep.c,v 1.3 2012/09/27 00:22:39 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define IDM_PRIVATE
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bcm53xx_machdep.c,v 1.2 2012/09/07 11:53:49 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: bcm53xx_machdep.c,v 1.3 2012/09/27 00:22:39 matt Exp $);
 
 #include opt_evbarm_boardtype.h
 #include opt_broadcom.h
@@ -83,6 +83,8 @@ BootConfig bootconfig;
 static char bootargs[MAX_BOOT_STRING];
 char *boot_args = NULL; 
 
+u_int uboot_args[4] = { 0 };
+
 static void bcm53xx_system_reset(void);
 
 /*
@@ -214,6 +216,9 @@ initarm(void *arg)
 	bcm53xx_rng_start(bcm53xx_ioreg_bst, bcm53xx_ioreg_bsh);
 #endif
 
+	printf(uboot arg = %#x, %#x, %#x, %#x\n,
+	uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);  
+
 	/* Talk to the user */
 	printf(\nNetBSD/evbarm ( ___STRING(EVBARM_BOARDTYPE) ) booting ...\n);
 
@@ -226,10 +231,15 @@ initarm(void *arg)
 	arm_cpu_max + 1, arm_cpu_max + 1 ? s : ,
 	arm_cpu_hatched);
 #endif
+	printf(, CLIDR=%010o CTR=%#x,
+	armreg_clidr_read(), armreg_ctr_read());
 	printf(\n);
 #endif
 
-	arm32_bootmem_init(KERN_VTOPHYS(KERNEL_BASE), bcm53xx_memprobe(),
+	psize_t memsize = bcm53xx_memprobe();
+	//memsize = 128*1024*1024;
+
+	arm32_bootmem_init(KERN_VTOPHYS(KERNEL_BASE), memsize,
 	(paddr_t)KERNEL_BASE_phys);
 
 	/*

Index: src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S
diff -u src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S:1.3 src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S:1.4
--- src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S:1.3	Fri Sep  7 11:53:50 2012
+++ src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S	Thu Sep 27 00:22:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm53xx_start.S,v 1.3 2012/09/07 11:53:50 matt Exp $	*/
+/*	$NetBSD: bcm53xx_start.S,v 1.4 2012/09/27 00:22:39 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -45,7 +45,7 @@
 #define	CONADDR		0x18000300
 #endif
 
-RCSID($NetBSD: bcm53xx_start.S,v 1.3 2012/09/07 11:53:50 matt Exp $)
+RCSID($NetBSD: bcm53xx_start.S,v 1.4 2012/09/27 00:22:39 matt Exp $)
 
 #undef VERBOSE_INIT_ARM
 #define VERBOSE_INIT_ARM
@@ -67,6 +67,12 @@ RCSID($NetBSD: bcm53xx_start.S,v 1.3 20
 	.global	_C_LABEL(bcm53xx_start)
 _C_LABEL(bcm53xx_start):
 	/*
+	 * Save any arguments u-boot passed us.
+	 */
+	ldr	r4, .Luboot_args
+	stmia	r4, {r0-r3}
+
+	/*
 	 * Let's turn on the CCA watchdog in case something goes horribly wrong.
 	 */
 	ldr	r0, .Lcca_wdog
@@ -127,6 +133,9 @@ _C_LABEL(bcm53xx_start):
 
 	/* NOTREACHED */
 
+.Luboot_args:
+	.word	uboot_args
+
 .Lsku_rom_lut:
 	.word	0x0400
 



CVS commit: src/sys/arch/arm/broadcom

2012-09-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Sep 27 00:24:36 UTC 2012

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_usb.c

Log Message:
Add vendor name.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm53xx_usb.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/arm/broadcom/bcm53xx_usb.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.1 src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.2
--- src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.1	Sat Sep  1 00:04:44 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_usb.c	Thu Sep 27 00:24:36 2012
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: bcm53xx_usb.c,v 1.1 2012/09/01 00:04:44 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: bcm53xx_usb.c,v 1.2 2012/09/27 00:24:36 matt Exp $);
 
 #include sys/bus.h
 #include sys/device.h
@@ -52,6 +52,8 @@ __KERNEL_RCSID(1, $NetBSD: bcm53xx_usb.
 #include dev/usb/ehcireg.h
 #include dev/usb/ehcivar.h
 
+#include dev/pci/pcidevs.h
+
 struct bcmusb_softc {
 	device_t usbsc_dev;
 	bus_dma_tag_t usbsc_dmat;
@@ -112,6 +114,9 @@ ohci_bcmusb_attach(device_t parent, devi
 	sc-sc_bus.dmatag = usbaa-usbaa_dmat;
 	sc-sc_bus.hci_private = sc;
 
+	sc-sc_id_vendor = PCI_VENDOR_BROADCOM;
+	strlcpy(sc-sc_vendor, Broadcom, sizeof(sc-sc_vendor));
+
 	aprint_naive(: OHCI USB controller\n);
 	aprint_normal(: OHCI USB controller\n);
 
@@ -168,6 +173,9 @@ ehci_bcmusb_attach(device_t parent, devi
 		sc-sc_comps[sc-sc_ncomp++] = usbsc-usbsc_ohci_dev;
 	}
 
+	sc-sc_id_vendor = PCI_VENDOR_BROADCOM;
+	strlcpy(sc-sc_vendor, Broadcom, sizeof(sc-sc_vendor));
+
 	aprint_naive(: EHCI USB controller\n);
 	aprint_normal(: ECHI USB controller\n);
 



CVS commit: src/sys/arch/arm/broadcom

2012-09-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Sep 27 00:25:26 UTC 2012

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_pax.c

Log Message:
Don't initialize PCIe inbound windows.  This avoids the 256MB limitation
on DMAs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm53xx_pax.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/arm/broadcom/bcm53xx_pax.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.4 src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.5
--- src/sys/arch/arm/broadcom/bcm53xx_pax.c:1.4	Sat Sep 22 01:47:46 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_pax.c	Thu Sep 27 00:25:26 2012
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: bcm53xx_pax.c,v 1.4 2012/09/22 01:47:46 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: bcm53xx_pax.c,v 1.5 2012/09/27 00:25:26 matt Exp $);
 
 #include sys/bus.h
 #include sys/device.h
@@ -146,10 +146,10 @@ bcmpax_ccb_match(device_t parent, cfdata
 static int
 bcmpax_iwin_init(struct bcmpax_softc *sc)
 {
+#if 0
 	uint32_t megs = (physical_end + 0xf - physical_start)  20;
 	uint32_t iwin_megs = min(256, megs);
 #if 1
-#if 1
 	bus_addr_t iwin1_start = physical_start;
 #else
 	bus_addr_t iwin1_start = 0;
@@ -173,7 +173,6 @@ bcmpax_iwin_init(struct bcmpax_softc *sc
 #endif
 		bcmpax_conf_write(sc, 0, PCI_MAPREG_START+8, iwin2_start);
 	}
-#endif
 
 	if (megs = iwin_megs) {
 		/*
@@ -184,6 +183,13 @@ bcmpax_iwin_init(struct bcmpax_softc *sc
 
 	return bus_dmatag_subregion(sc-sc_dmat, physical_start,
 	physical_start + (iwin_megs  20) - 1, sc-sc_dmat, 0);
+#else
+	bcmpax_write_4(sc, PCIE_IARR_1_LOWER, 0);
+	bcmpax_write_4(sc, PCIE_FUNC0_IMAP1, 0);
+	bcmpax_write_4(sc, PCIE_IARR_2_LOWER, 0);
+	bcmpax_write_4(sc, PCIE_FUNC0_IMAP2, 0);
+	return 0;
+#endif
 }
 
 static void



CVS commit: src/lib/libc/cdb

2012-09-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Sep 27 00:37:43 UTC 2012

Modified Files:
src/lib/libc/cdb: cdbr.c

Log Message:
Don't refuse the open databases without entries or keys, just protect
the divisions. cdbr_find and cdbr_get already have the appropiate
checks.


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

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

Modified files:

Index: src/lib/libc/cdb/cdbr.c
diff -u src/lib/libc/cdb/cdbr.c:1.3 src/lib/libc/cdb/cdbr.c:1.4
--- src/lib/libc/cdb/cdbr.c:1.3	Mon Jun  4 19:06:45 2012
+++ src/lib/libc/cdb/cdbr.c	Thu Sep 27 00:37:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdbr.c,v 1.3 2012/06/04 19:06:45 joerg Exp $	*/
+/*	$NetBSD: cdbr.c,v 1.4 2012/09/27 00:37:43 joerg Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: cdbr.c,v 1.3 2012/06/04 19:06:45 joerg Exp $);
+__RCSID($NetBSD: cdbr.c,v 1.4 2012/09/27 00:37:43 joerg Exp $);
 
 #include namespace.h
 
@@ -152,17 +152,21 @@ cdbr_open(const char *path, int flags)
 	cdbr-data_base  cdbr-mmap_base ||
 	cdbr-data_base + cdbr-data_size  cdbr-mmap_base ||
 	cdbr-data_base + cdbr-data_size 
-	cdbr-mmap_base + cdbr-mmap_size ||
-	cdbr-entries == 0 || cdbr-entries_index == 0) {
+	cdbr-mmap_base + cdbr-mmap_size) {
 		errno = EINVAL;
 		cdbr_close(cdbr);
 		return NULL;
 	}
 
-	fast_divide32_prepare(cdbr-entries, cdbr-entries_m,
-	cdbr-entries_s1, cdbr-entries_s2);
-	fast_divide32_prepare(cdbr-entries_index, cdbr-entries_index_m,
-	cdbr-entries_index_s1, cdbr-entries_index_s2);
+	if (cdbr-entries) {
+		fast_divide32_prepare(cdbr-entries, cdbr-entries_m,
+		cdbr-entries_s1, cdbr-entries_s2);
+	}
+	if (cdbr-entries_index) {
+		fast_divide32_prepare(cdbr-entries_index,
+		cdbr-entries_index_m,
+		cdbr-entries_index_s1, cdbr-entries_index_s2);
+	}
 
 	return cdbr;
 }



CVS commit: src/tests/lib/libc

2012-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 27 00:37:56 UTC 2012

Modified Files:
src/tests/lib/libc: t_gdtoa.c

Log Message:
make the test more precise.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/t_gdtoa.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/t_gdtoa.c
diff -u src/tests/lib/libc/t_gdtoa.c:1.2 src/tests/lib/libc/t_gdtoa.c:1.3
--- src/tests/lib/libc/t_gdtoa.c:1.2	Tue Jun 14 08:17:57 2011
+++ src/tests/lib/libc/t_gdtoa.c	Wed Sep 26 20:37:56 2012
@@ -34,7 +34,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_gdtoa.c,v 1.2 2011/06/14 12:17:57 njoly Exp $);
+__RCSID($NetBSD: t_gdtoa.c,v 1.3 2012/09/27 00:37:56 christos Exp $);
 
 #include atf-c.h
 
@@ -53,7 +53,8 @@ ATF_TC_HEAD(long_format, tc)
 ATF_TC_BODY(long_format, tc)
 {
 	char *buf;
-	(void)asprintf(buf, %1.262159f, 1.1);
+	ATF_REQUIRE_EQ(262161, asprintf(buf, %1.262159f, 1.1));
+	free(buf);
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src

2012-09-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Sep 27 00:38:57 UTC 2012

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib/libc: Makefile
Added Files:
src/tests/lib/libc: t_cdb.c

Log Message:
Add regression test for cdbr(3) and cdbw(3).


To generate a diff of this commit:
cvs rdiff -u -r1.495 -r1.496 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.42 -r1.43 src/tests/lib/libc/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/t_cdb.c

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.495 src/distrib/sets/lists/tests/mi:1.496
--- src/distrib/sets/lists/tests/mi:1.495	Tue Sep 18 08:30:35 2012
+++ src/distrib/sets/lists/tests/mi	Thu Sep 27 00:38:57 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.495 2012/09/18 08:30:35 martin Exp $
+# $NetBSD: mi,v 1.496 2012/09/27 00:38:57 joerg Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -591,6 +591,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/t_clone.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/t_context.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/t_convfp.debug			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/t_cdb.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/t_gdtoa.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/t_hsearch.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/t_inet.debug			tests-obsolete		obsolete
@@ -2510,6 +2511,7 @@
 ./usr/tests/lib/libc/t_clone			tests-obsolete		obsolete
 ./usr/tests/lib/libc/t_context			tests-obsolete		obsolete
 ./usr/tests/lib/libc/t_convfp			tests-lib-tests		atf
+./usr/tests/lib/libc/t_cdb			tests-lib-tests		atf
 ./usr/tests/lib/libc/t_gdtoa			tests-lib-tests		atf
 ./usr/tests/lib/libc/t_hsearch			tests-obsolete		obsolete
 ./usr/tests/lib/libc/t_inet			tests-obsolete		obsolete

Index: src/tests/lib/libc/Makefile
diff -u src/tests/lib/libc/Makefile:1.42 src/tests/lib/libc/Makefile:1.43
--- src/tests/lib/libc/Makefile:1.42	Mon Sep 19 05:42:13 2011
+++ src/tests/lib/libc/Makefile	Thu Sep 27 00:38:57 2012
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.42 2011/09/19 05:42:13 jruoho Exp $
+# $NetBSD: Makefile,v 1.43 2012/09/27 00:38:57 joerg Exp $
 
 .include Makefile.inc
 .include bsd.sys.mk
@@ -17,5 +17,6 @@ TESTSDIR=	${TESTSBASE}/lib/libc
 
 TESTS_C+=	t_convfp
 TESTS_C+=	t_gdtoa
+TESTS_C+=	t_cdb
 
 .include bsd.test.mk

Added files:

Index: src/tests/lib/libc/t_cdb.c
diff -u /dev/null src/tests/lib/libc/t_cdb.c:1.1
--- /dev/null	Thu Sep 27 00:38:57 2012
+++ src/tests/lib/libc/t_cdb.c	Thu Sep 27 00:38:57 2012
@@ -0,0 +1,158 @@
+/*	$NetBSD: t_cdb.c,v 1.1 2012/09/27 00:38:57 joerg Exp $	*/
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__RCSID($NetBSD: t_cdb.c,v 1.1 2012/09/27 00:38:57 joerg Exp $);
+
+#include atf-c.h
+#include assert.h
+#include cdbr.h
+#include cdbw.h
+#include fcntl.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#define	MAXKEYS	16384
+
+static const char database_name[] = test.cdb;
+
+uint32_t keys[MAXKEYS];
+
+static int
+cmp_keys(const void *a_, const void *b_)
+{
+	uint32_t a = *(const uint32_t *)a_;
+	uint32_t b = *(const uint32_t *)b_;
+
+	return a  b ? 1 : (a  b ? 1 : 0);
+}
+
+static void
+init_keys(size_t len)
+{
+	

CVS commit: src/sys/dev/ic

2012-09-26 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Sep 27 00:39:47 UTC 2012

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

Log Message:
Add some more debugging messages.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/ic/ahcisata_core.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/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.43 src/sys/dev/ic/ahcisata_core.c:1.44
--- src/sys/dev/ic/ahcisata_core.c:1.43	Mon Aug 20 12:48:47 2012
+++ src/sys/dev/ic/ahcisata_core.c	Thu Sep 27 00:39:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.43 2012/08/20 12:48:47 bouyer Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.44 2012/09/27 00:39:47 matt Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.43 2012/08/20 12:48:47 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.44 2012/09/27 00:39:47 matt Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -50,7 +50,6 @@ __KERNEL_RCSID(0, $NetBSD: ahcisata_cor
 
 #include atapibus.h
 
-#define AHCI_DEBUG
 #ifdef AHCI_DEBUG
 int ahcidebug_mask = 0;
 #endif
@@ -839,11 +838,12 @@ ahci_probe_drive(struct ata_channel *chp
 		}
 		/* clear port interrupt register */
 		AHCI_WRITE(sc, AHCI_P_IS(chp-ch_channel), 0x);
+		
 		/* and enable interrupts */
 		AHCI_WRITE(sc, AHCI_P_IE(chp-ch_channel),
 		AHCI_P_IX_TFES | AHCI_P_IX_HBFS | AHCI_P_IX_IFS |
 		AHCI_P_IX_OFS | AHCI_P_IX_DPS | AHCI_P_IX_UFS |
-		AHCI_P_IX_DHRS);
+		AHCI_P_IX_PSS | AHCI_P_IX_DHRS);
 		/* wait 500ms before actually starting operations */
 		tsleep(sc, PRIBIO, ahciprb, mstohz(500));
 		break;
@@ -922,8 +922,9 @@ ahci_cmd_start(struct ata_channel *chp, 
 	int i;
 	int channel = chp-ch_channel;
 
-	AHCIDEBUG_PRINT((ahci_cmd_start CI 0x%x\n,
-	AHCI_READ(sc, AHCI_P_CI(chp-ch_channel))), DEBUG_XFERS);
+	AHCIDEBUG_PRINT((ahci_cmd_start CI 0x%x timo %d\n,
+	AHCI_READ(sc, AHCI_P_CI(chp-ch_channel)), ata_c-timeout),
+	DEBUG_XFERS);
 
 	cmd_tbl = achp-ahcic_cmd_tbl[slot];
 	AHCIDEBUG_PRINT((%s port %d tbl %p\n, AHCINAME(sc), chp-ch_channel,
@@ -1066,18 +1067,18 @@ ahci_cmd_done(struct ata_channel *chp, s
 	uint16_t *idwordbuf;
 	int i;
 
-	AHCIDEBUG_PRINT((ahci_cmd_done channel %d\n, chp-ch_channel),
-	DEBUG_FUNCS);
+	AHCIDEBUG_PRINT((ahci_cmd_done channel %d (status %#x) flags %#x/%#x\n,
+	chp-ch_channel, chp-ch_status, xfer-c_flags, ata_c-flags), DEBUG_FUNCS);
 
 	/* this comamnd is not active any more */
 	achp-ahcic_cmds_active = ~(1  slot);
 
 	if (ata_c-flags  (AT_READ|AT_WRITE)  ata_c-bcount  0) {
-		bus_dmamap_sync(sc-sc_dmat, achp-ahcic_datad[slot], 0,
-		achp-ahcic_datad[slot]-dm_mapsize,
+		bus_dmamap_t map = achp-ahcic_datad[slot];
+		bus_dmamap_sync(sc-sc_dmat, map, 0, map-dm_mapsize,
 		(ata_c-flags  AT_READ) ? BUS_DMASYNC_POSTREAD :
 		BUS_DMASYNC_POSTWRITE);
-		bus_dmamap_unload(sc-sc_dmat, achp-ahcic_datad[slot]);
+		bus_dmamap_unload(sc-sc_dmat, map);
 	}
 
 	AHCI_CMDH_SYNC(sc, achp, slot,
@@ -1375,8 +1376,12 @@ ahci_timeout(void *v)
 {
 	struct ata_channel *chp = (struct ata_channel *)v;
 	struct ata_xfer *xfer = chp-ch_queue-active_xfer;
+#ifdef AHCI_DEBUG
+	struct ahci_softc *sc = (struct ahci_softc *)chp-ch_atac;
+#endif
 	int s = splbio();
-	AHCIDEBUG_PRINT((ahci_timeout xfer %p\n, xfer), DEBUG_INTR);
+	AHCIDEBUG_PRINT((ahci_timeout xfer %p intr %#x\n, xfer, AHCI_READ(sc, AHCI_P_IS(chp-ch_channel))), DEBUG_INTR);
+	
 	if ((chp-ch_flags  ATACH_IRQ_WAIT) != 0) {
 		xfer-c_flags |= C_TIMEOU;
 		xfer-c_intr(chp, xfer, 0);



CVS commit: src/bin/pax

2012-09-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 27 00:44:59 UTC 2012

Modified Files:
src/bin/pax: ftree.c

Log Message:
deal properly with empty lines in spec file


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/pax/ftree.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/pax/ftree.c
diff -u src/bin/pax/ftree.c:1.41 src/bin/pax/ftree.c:1.42
--- src/bin/pax/ftree.c:1.41	Tue Mar 20 14:42:28 2012
+++ src/bin/pax/ftree.c	Wed Sep 26 20:44:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ftree.c,v 1.41 2012/03/20 18:42:28 matt Exp $	*/
+/*	$NetBSD: ftree.c,v 1.42 2012/09/27 00:44:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -71,7 +71,7 @@
 #if 0
 static char sccsid[] = @(#)ftree.c	8.2 (Berkeley) 4/18/94;
 #else
-__RCSID($NetBSD: ftree.c,v 1.41 2012/03/20 18:42:28 matt Exp $);
+__RCSID($NetBSD: ftree.c,v 1.42 2012/09/27 00:44:59 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -347,7 +347,7 @@ ftree_arg(void)
 			 * the user didn't supply any args, get the file trees
 			 * to process from stdin;
 			 */
-			for (i = 0; i  PAXPATHLEN + 2; i++) {
+			for (i = 0; i  PAXPATHLEN + 2;) {
 c = getchar();
 if (c == EOF)
 	break;
@@ -355,7 +355,7 @@ ftree_arg(void)
 	if (i != 0)
 		break;
 } else
-	farray[0][i] = c;
+	farray[0][i++] = c;
 			}
 			if (i == 0)
 return -1;