CVS commit: src/sys/conf

2011-05-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue May 17 07:16:03 UTC 2011

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
Add support for source specific AFLAGS and COPTS.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.132 src/sys/conf/Makefile.kern.inc:1.133
--- src/sys/conf/Makefile.kern.inc:1.132	Wed May 11 16:03:56 2011
+++ src/sys/conf/Makefile.kern.inc	Tue May 17 07:16:02 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.132 2011/05/11 16:03:56 jakllsch Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.133 2011/05/17 07:16:02 joerg Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -133,18 +133,18 @@
 # NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
 NORMAL_C?=	@${_MKSHMSG} compile  ${.CURDIR:T}/${.TARGET}  \
 		${_MKSHECHO}\
-		${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $  \
-		${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $  \
+		${CC} ${COPTS.${:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $  \
+		${CC} ${COPTS.${:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $  \
 		${COMPILE_CTFCONVERT}
 NOPROF_C?=	@${_MKSHMSG} compile  ${.CURDIR:T}/${.TARGET}  \
 		${_MKSHECHO}\
-		${CC} ${CFLAGS} ${CPPFLAGS} -c $  \
-		${CC} ${CFLAGS} ${CPPFLAGS} -c $  \
+		${CC} ${COPTS.${:T}} ${CFLAGS} ${CPPFLAGS} -c $  \
+		${CC} ${COPTS.${:T}} ${CFLAGS} ${CPPFLAGS} -c $  \
 		${COMPILE_CTFCONVERT}
 NORMAL_S?=	@${_MKSHMSG} compile  ${.CURDIR:T}/${.TARGET}  \
 		${_MKSHECHO}\
-		${CC} ${AFLAGS} ${CPPFLAGS} -c $  \
-		${CC} ${AFLAGS} ${CPPFLAGS} -c $
+		${CC} ${AFLAGS} ${AFLAGS.${:T}} ${CPPFLAGS} -c $  \
+		${CC} ${AFLAGS} ${AFLAGS.${:T}} ${CPPFLAGS} -c $
 
 ##
 ## (3) libkern and compat



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

2011-05-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 17 07:57:02 UTC 2011

Modified Files:
src/sys/arch/sparc64/conf: GENERIC

Log Message:
Disable DEBUG=-g by default again (accidently slipped in with last changes).
Ok: mrg


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/sparc64/conf/GENERIC

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

Modified files:

Index: src/sys/arch/sparc64/conf/GENERIC
diff -u src/sys/arch/sparc64/conf/GENERIC:1.138 src/sys/arch/sparc64/conf/GENERIC:1.139
--- src/sys/arch/sparc64/conf/GENERIC:1.138	Tue May 17 04:18:05 2011
+++ src/sys/arch/sparc64/conf/GENERIC	Tue May 17 07:57:02 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.138 2011/05/17 04:18:05 mrg Exp $
+# $NetBSD: GENERIC,v 1.139 2011/05/17 07:57:02 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.138 $
+#ident 		GENERIC-$Revision: 1.139 $
 
 maxusers	64
 
@@ -99,7 +99,7 @@
 ## Compile the kernel with debugging symbols (`netbsd.gdb' is the debug file),
 ## such that gdb(1) can be used on a kernel coredump.
 
-makeoptions	DEBUG=-g
+#makeoptions	DEBUG=-g
 
 
 ## Adds code to the kernel that does internal consistency checks, and will



CVS commit: othersrc/external/bsd/genraidconf

2011-05-17 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Tue May 17 11:23:41 UTC 2011

Modified Files:
othersrc/external/bsd/genraidconf: genraidconf.8

Log Message:
Various improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/genraidconf/genraidconf.8

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

Modified files:

Index: othersrc/external/bsd/genraidconf/genraidconf.8
diff -u othersrc/external/bsd/genraidconf/genraidconf.8:1.2 othersrc/external/bsd/genraidconf/genraidconf.8:1.3
--- othersrc/external/bsd/genraidconf/genraidconf.8:1.2	Tue May 17 03:51:40 2011
+++ othersrc/external/bsd/genraidconf/genraidconf.8	Tue May 17 11:23:41 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: genraidconf.8,v 1.2 2011/05/17 03:51:40 agc Exp $
+.\ $NetBSD: genraidconf.8,v 1.3 2011/05/17 11:23:41 wiz Exp $
 .\
 .\ Copyright (c) 2011 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -28,14 +28,14 @@
 .Os
 .Sh NAME
 .Nm genraidconf
-.Nd Utility to configure RAID sets
+.Nd utility to configure RAID sets
 .Sh SYNOPSIS
 .Nm
 .Fl nv
 .Op Fl d Ar raidN
 .Op Fl o Ar raid1|raid5|root|spare|zero
 .Op Fl r Ar 1|5
-components
+.Ar components
 .Sh DESCRIPTION
 The
 .Nm
@@ -43,12 +43,11 @@
 It uses various pieces of information to construct a
 number of disklabels for the RAID set component disks using
 .Xr disklabel 8 ,
-and a configuration file for RAID frame itself,
-.Xr raid 4 
+and a configuration file for RAIDframe itself,
+.Xr raid 4
 producing a file as described in
 .Xr raidctl 8 .
 .Pp
-.Pp
 The following options are available:
 .Bl -tag -width raidN123
 .It Fl d Ar raidN
@@ -60,11 +59,11 @@
 .It Fl n
 Do not do any processing - echo the commands which would otherwise be performed.
 .It Fl o Ar raid1
-Generate a configuration for RAID1 protection
+Generate a configuration for RAID1 protection.
 .It Fl o Ar raid5
-Generate a configuration for RAID5 protection
+Generate a configuration for RAID5 protection.
 .It Fl o Ar root
-Enable the generated root device to be used as a root device
+Enable the generated root device to be used as a root device.
 .It Fl o Ar spare
 In a RAID 5 device, use one of the given disks as a hot-spare.
 The component that will be used as the hot spare is the final
@@ -75,9 +74,9 @@
 than raidframe in completing this task, and so this step has been
 added as a separate option.
 .It Fl r Ar 1
-Generate a configuration for RAID1 protection
+Generate a configuration for RAID1 protection.
 .It Fl r Ar 5
-Generate a configuration for RAID5 protection
+Generate a configuration for RAID5 protection.
 .It Fl v
 Perform operations in a verbose manner (useful for debugging)
 .El
@@ -97,7 +96,7 @@
 .Nm
 utility will also zero the components prior to configuring them
 if the
-.Fl z
+.Fl o Ar zero
 option is provided on the command line.
 .Pp
 Various sanity checks are performed, such as whether there are enough component



CVS commit: src/crypto/external/bsd/heimdal/include

2011-05-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 17 12:56:44 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/include: krb5-protos.h

Log Message:
add missing prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/crypto/external/bsd/heimdal/include/krb5-protos.h

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

Modified files:

Index: src/crypto/external/bsd/heimdal/include/krb5-protos.h
diff -u src/crypto/external/bsd/heimdal/include/krb5-protos.h:1.1 src/crypto/external/bsd/heimdal/include/krb5-protos.h:1.2
--- src/crypto/external/bsd/heimdal/include/krb5-protos.h:1.1	Wed Apr 13 15:03:58 2011
+++ src/crypto/external/bsd/heimdal/include/krb5-protos.h	Tue May 17 08:56:44 2011
@@ -2781,6 +2781,11 @@
 	char */*prefix*/,
 	size_t /*prefixsize*/);
 
+KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
+krb5_kt_have_content (
+	krb5_context /*context*/,
+krb5_keytab /*id*/);
+
 KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
 krb5_kt_next_entry (
 	krb5_context /*context*/,
@@ -3861,6 +3866,9 @@
 KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
 krb5_sockaddr_uninteresting (const struct sockaddr */*sa*/);
 
+KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL
+krb5_sockaddr_is_loopback (const struct sockaddr */*sa*/);
+
 KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 krb5_std_usage (
 	int /*code*/,



CVS commit: src/sys/netipsec

2011-05-17 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Tue May 17 18:43:03 UTC 2011

Modified Files:
src/sys/netipsec: key.c

Log Message:
fix lookup of SAs for outgoing packets in the !prefered_oldsa case,
as done in KAME and FAST_IPSEC after NetBSD imported the code
(The default differs: KAME uses the oldest valid SA while FAST_IPSEC
in NetBSD uses the newest one. I'm not changing this -- there is a lack
of specification and behavior can be changed with the oldsa sysctl.)
For incoming packets it shouldn't matter but I made it look similar
just to avoid unnecessary differences.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.66 src/sys/netipsec/key.c:1.67
--- src/sys/netipsec/key.c:1.66	Mon Feb 21 22:28:18 2011
+++ src/sys/netipsec/key.c	Tue May 17 18:43:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.66 2011/02/21 22:28:18 drochner Exp $	*/
+/*	$NetBSD: key.c,v 1.67 2011/05/17 18:43:02 drochner Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 	
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: key.c,v 1.66 2011/02/21 22:28:18 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: key.c,v 1.67 2011/05/17 18:43:02 drochner Exp $);
 
 /*
  * This code is referd to RFC 2367
@@ -152,13 +152,17 @@
 static LIST_HEAD(_spacqtree, secspacq) spacqtree;	/* SP acquiring list */
 
 /* search order for SAs */
-static const u_int saorder_state_valid[] = {
-	SADB_SASTATE_DYING, SADB_SASTATE_MATURE,
 	/*
 	 * This order is important because we must select the oldest SA
 	 * for outbound processing.  For inbound, This is not important.
 	 */
+static const u_int saorder_state_valid_prefer_old[] = {
+	SADB_SASTATE_DYING, SADB_SASTATE_MATURE,
+};
+static const u_int saorder_state_valid_prefer_new[] = {
+	SADB_SASTATE_MATURE, SADB_SASTATE_DYING,
 };
+
 static const u_int saorder_state_alive[] = {
 	/* except DEAD */
 	SADB_SASTATE_MATURE, SADB_SASTATE_DYING, SADB_SASTATE_LARVAL
@@ -885,6 +889,8 @@
 	struct secashead *sah;
 	struct secasvar *sav;
 	u_int stateidx, state;
+	const u_int *saorder_state_valid;
+	int arraysize;
 
 	LIST_FOREACH(sah, sahtree, chain) {
 		if (sah-state == SADB_SASTATE_DEAD)
@@ -897,9 +903,21 @@
 
 found:
 
+	/*
+	 * search a valid state list for outbound packet.
+	 * This search order is important.
+	 */
+	if (key_prefered_oldsa) {
+		saorder_state_valid = saorder_state_valid_prefer_old;
+		arraysize = _ARRAYLEN(saorder_state_valid_prefer_old);
+	} else {
+		saorder_state_valid = saorder_state_valid_prefer_new;
+		arraysize = _ARRAYLEN(saorder_state_valid_prefer_new);
+	}
+
 	/* search valid state */
 	for (stateidx = 0;
-	 stateidx  _ARRAYLEN(saorder_state_valid);
+	 stateidx  arraysize;
 	 stateidx++) {
 
 		state = saorder_state_valid[stateidx];
@@ -1075,6 +1093,8 @@
 	struct secashead *sah;
 	struct secasvar *sav;
 	u_int stateidx, state;
+	const u_int *saorder_state_valid;
+	int arraysize;
 	int s;
 	int chkport = 0;
 
@@ -1119,11 +1139,16 @@
 	 * encrypted so we can't check internal IP header.
 	 */
 	s = splsoftnet();	/*called from softclock()*/
+	if (key_prefered_oldsa) {
+		saorder_state_valid = saorder_state_valid_prefer_old;
+		arraysize = _ARRAYLEN(saorder_state_valid_prefer_old);
+	} else {
+		saorder_state_valid = saorder_state_valid_prefer_new;
+		arraysize = _ARRAYLEN(saorder_state_valid_prefer_new);
+	}
 	LIST_FOREACH(sah, sahtree, chain) {
 		/* search valid state */
-		for (stateidx = 0;
-		 stateidx  _ARRAYLEN(saorder_state_valid);
-		 stateidx++) {
+		for (stateidx = 0; stateidx  arraysize; stateidx++) {
 			state = saorder_state_valid[stateidx];
 			LIST_FOREACH(sav, sah-savtree[state], chain) {
 /* sanity check */



CVS commit: src/sys/netipsec

2011-05-17 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Tue May 17 18:57:02 UTC 2011

Modified Files:
src/sys/netipsec: key.c

Log Message:
cleanup some error handling to avoid memory leaks and doube frees,
from Wolfgang Stukenbrock per PR kern/44948, and part of kern/44952


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.67 src/sys/netipsec/key.c:1.68
--- src/sys/netipsec/key.c:1.67	Tue May 17 18:43:02 2011
+++ src/sys/netipsec/key.c	Tue May 17 18:57:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.67 2011/05/17 18:43:02 drochner Exp $	*/
+/*	$NetBSD: key.c,v 1.68 2011/05/17 18:57:02 drochner Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 	
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: key.c,v 1.67 2011/05/17 18:43:02 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: key.c,v 1.68 2011/05/17 18:57:02 drochner Exp $);
 
 /*
  * This code is referd to RFC 2367
@@ -991,7 +991,7 @@
 		 * permanent.
 		 */
 		if (d-lft_c-sadb_lifetime_addtime != 0) {
-			struct mbuf *m, *result;
+			struct mbuf *m, *result = 0;
 			uint8_t satype;
 
 			key_sa_chgstate(d, SADB_SASTATE_DEAD);
@@ -1046,10 +1046,12 @@
 			mtod(result, struct sadb_msg *)-sadb_msg_len =
 PFKEY_UNIT64(result-m_pkthdr.len);
 
-			if (key_sendup_mbuf(NULL, result,
-	KEY_SENDUP_REGISTERED))
-goto msgfail;
+			key_sendup_mbuf(NULL, result,
+	KEY_SENDUP_REGISTERED);
+			result = 0;
 		 msgfail:
+			if (result)
+m_freem(result);
 			KEY_FREESAV(d);
 		}
 	}
@@ -3578,32 +3580,24 @@
 		switch (dumporder[i]) {
 		case SADB_EXT_SA:
 			m = key_setsadbsa(sav);
-			if (!m)
-goto fail;
 			break;
 
 		case SADB_X_EXT_SA2:
 			m = key_setsadbxsa2(sav-sah-saidx.mode,
 	sav-replay ? sav-replay-count : 0,
 	sav-sah-saidx.reqid);
-			if (!m)
-goto fail;
 			break;
 
 		case SADB_EXT_ADDRESS_SRC:
 			m = key_setsadbaddr(SADB_EXT_ADDRESS_SRC,
 			sav-sah-saidx.src.sa,
 			FULLMASK, IPSEC_ULPROTO_ANY);
-			if (!m)
-goto fail;
 			break;
 
 		case SADB_EXT_ADDRESS_DST:
 			m = key_setsadbaddr(SADB_EXT_ADDRESS_DST,
 			sav-sah-saidx.dst.sa,
 			FULLMASK, IPSEC_ULPROTO_ANY);
-			if (!m)
-goto fail;
 			break;
 
 		case SADB_EXT_KEY_AUTH:
@@ -3643,22 +3637,23 @@
 
 #ifdef IPSEC_NAT_T
 		case SADB_X_EXT_NAT_T_TYPE:
-			if ((m = key_setsadbxtype(sav-natt_type)) == NULL)
-goto fail;
+			m = key_setsadbxtype(sav-natt_type);
 			break;
 		
 		case SADB_X_EXT_NAT_T_DPORT:
-			if ((m = key_setsadbxport(
+			if (sav-natt_type == 0)
+continue;
+			m = key_setsadbxport(
 key_portfromsaddr(sav-sah-saidx.dst),
-SADB_X_EXT_NAT_T_DPORT)) == NULL)
-goto fail;
+SADB_X_EXT_NAT_T_DPORT);
 			break;
 
 		case SADB_X_EXT_NAT_T_SPORT:
-			if ((m = key_setsadbxport(
+			if (sav-natt_type == 0)
+continue;
+			m = key_setsadbxport(
 key_portfromsaddr(sav-sah-saidx.src),
-SADB_X_EXT_NAT_T_SPORT)) == NULL)
-goto fail;
+SADB_X_EXT_NAT_T_SPORT);
 			break;
 
 		case SADB_X_EXT_NAT_T_OAI:
@@ -3676,7 +3671,8 @@
 			continue;
 		}
 
-		if ((!m  !p) || (m  p))
+		KASSERT(!(m  p));
+		if (!m  !p)
 			goto fail;
 		if (p  tres) {
 			M_PREPEND(tres, l, M_DONTWAIT);
@@ -3698,6 +3694,7 @@
 	}
 
 	m_cat(result, tres);
+	tres = NULL; /* avoid free on error below */
 
 	if (result-m_len  sizeof(struct sadb_msg)) {
 		result = m_pullup(result, sizeof(struct sadb_msg));



CVS commit: src/usr.bin/make

2011-05-17 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Tue May 17 21:56:52 UTC 2011

Modified Files:
src/usr.bin/make: Makefile parse.c

Log Message:
If a makefile if a multiple of the page size and doesn't end with a
newline, then it all goes horribly wrong when make tries to terminate
the last input line.
This was all ok before the mmap changes (rev 1.169) because the last
32 bytes of the input buffer were never read into.
The non-mmap case has a similar problem.
Bug found because my .depend files don't have a newline at the end of
the .OPTIO|NAL line (don't know if that is a local change).


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/make/Makefile
cvs rdiff -u -r1.177 -r1.178 src/usr.bin/make/parse.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/make/Makefile
diff -u src/usr.bin/make/Makefile:1.51 src/usr.bin/make/Makefile:1.52
--- src/usr.bin/make/Makefile:1.51	Mon Sep 13 15:36:57 2010
+++ src/usr.bin/make/Makefile	Tue May 17 21:56:51 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.51 2010/09/13 15:36:57 sjg Exp $
+#	$NetBSD: Makefile,v 1.52 2011/05/17 21:56:51 dsl Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
@@ -38,6 +38,7 @@
 CPPFLAGS+= -DMAKE_NATIVE
 COPTS.var.c+= -Wno-cast-qual
 
+.if 0
 .ifdef TOOLDIR
 # this is a native netbsd build, 
 # use libutil rather than the local emalloc etc.
@@ -45,6 +46,7 @@
 LDADD+=-lutil
 DPADD+=${LIBUTIL}
 .endif
+.endif
 
 # A simple unit-test driver to help catch regressions
 accept test:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.177 src/usr.bin/make/parse.c:1.178
--- src/usr.bin/make/parse.c:1.177	Thu Mar  3 14:53:02 2011
+++ src/usr.bin/make/parse.c	Tue May 17 21:56:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.177 2011/03/03 14:53:02 nakayama Exp $	*/
+/*	$NetBSD: parse.c,v 1.178 2011/05/17 21:56:51 dsl Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = $NetBSD: parse.c,v 1.177 2011/03/03 14:53:02 nakayama Exp $;
+static char rcsid[] = $NetBSD: parse.c,v 1.178 2011/05/17 21:56:51 dsl Exp $;
 #else
 #include sys/cdefs.h
 #ifndef lint
 #if 0
 static char sccsid[] = @(#)parse.c	8.3 (Berkeley) 3/19/94;
 #else
-__RCSID($NetBSD: parse.c,v 1.177 2011/03/03 14:53:02 nakayama Exp $);
+__RCSID($NetBSD: parse.c,v 1.178 2011/05/17 21:56:51 dsl Exp $);
 #endif
 #endif /* not lint */
 #endif
@@ -518,6 +518,14 @@
 			   MAP_FILE|MAP_COPY, fd, 0);
 		if (lf-buf != MAP_FAILED) {
 			/* succeeded */
+			if (lf-len == lf-maplen  lf-buf[lf-len - 1] != '\n') {
+char *b = malloc(lf-len + 1);
+b[lf-len] = '\n';
+memcpy(b, lf-buf, lf-len++);
+munmap(lf-buf, lf-maplen);
+lf-maplen = 0;
+lf-buf = b;
+			}
 			goto done;
 		}
 	}



CVS commit: src/sys/arch

2011-05-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue May 17 22:19:38 UTC 2011

Modified Files:
src/sys/arch/algor/conf: P6032
src/sys/arch/evbarm/conf: NSLU2
src/sys/arch/evbmips/conf: AP30 MERAKI RB153 WGT624V3

Log Message:
Increase SYMTAB_SPACE to fix compilation of these kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/algor/conf/P6032
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/conf/NSLU2
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbmips/conf/AP30
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbmips/conf/MERAKI
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbmips/conf/RB153
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbmips/conf/WGT624V3

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/algor/conf/P6032
diff -u src/sys/arch/algor/conf/P6032:1.56 src/sys/arch/algor/conf/P6032:1.57
--- src/sys/arch/algor/conf/P6032:1.56	Thu Apr  7 04:02:29 2011
+++ src/sys/arch/algor/conf/P6032	Tue May 17 22:19:37 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: P6032,v 1.56 2011/04/07 04:02:29 dyoung Exp $
+#	$NetBSD: P6032,v 1.57 2011/05/17 22:19:37 dyoung Exp $
 #
 # Algorithmics P-6032 kernel.
 #
@@ -7,7 +7,7 @@
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		P6032-$Revision: 1.56 $
+#ident 		P6032-$Revision: 1.57 $
 
 maxusers 32
 
@@ -25,7 +25,7 @@
 options 	DDB			# kernel debugger
 makeoptions	DEBUG=-g
 #makeoptions	DEBUGLIST=pattern1 pattern2 ...
-options 	SYMTAB_SPACE=38
+options 	SYMTAB_SPACE=42
 
 # File systems
 file-system	FFS		# Fast file system

Index: src/sys/arch/evbarm/conf/NSLU2
diff -u src/sys/arch/evbarm/conf/NSLU2:1.18 src/sys/arch/evbarm/conf/NSLU2:1.19
--- src/sys/arch/evbarm/conf/NSLU2:1.18	Sun Mar  6 17:08:22 2011
+++ src/sys/arch/evbarm/conf/NSLU2	Tue May 17 22:19:37 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: NSLU2,v 1.18 2011/03/06 17:08:22 bouyer Exp $
+#	$NetBSD: NSLU2,v 1.19 2011/05/17 22:19:37 dyoung Exp $
 #
 #	Linksys NSLU2 Slug NAS Device
 #
@@ -139,7 +139,7 @@
 options 	DDB		# in-kernel debugger
 options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
 #makeoptions	DEBUG=-g	# compile full symbol table
-options 	SYMTAB_SPACE=31
+options 	SYMTAB_SPACE=34
 
 config		netbsd		root on ? type ?
 

Index: src/sys/arch/evbmips/conf/AP30
diff -u src/sys/arch/evbmips/conf/AP30:1.18 src/sys/arch/evbmips/conf/AP30:1.19
--- src/sys/arch/evbmips/conf/AP30:1.18	Sun Mar  6 17:08:23 2011
+++ src/sys/arch/evbmips/conf/AP30	Tue May 17 22:19:38 2011
@@ -1,10 +1,10 @@
-#	$NetBSD: AP30,v 1.18 2011/03/06 17:08:23 bouyer Exp $
+#	$NetBSD: AP30,v 1.19 2011/05/17 22:19:38 dyoung Exp $
 
 include 	arch/evbmips/conf/std.atheros
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		AP30-$Revision: 1.18 $
+#ident 		AP30-$Revision: 1.19 $
 
 maxusers	32
 
@@ -45,7 +45,7 @@
 options 	DDB		# kernel dynamic debugger
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG=-g	# compile full symbol table
-options 	SYMTAB_SPACE=15	# size for embedded symbol table
+options 	SYMTAB_SPACE=35	# size for embedded symbol table
 
 # Compatibility options
 #options 	COMPAT_43	# compatibility with 4.3BSD binaries

Index: src/sys/arch/evbmips/conf/MERAKI
diff -u src/sys/arch/evbmips/conf/MERAKI:1.14 src/sys/arch/evbmips/conf/MERAKI:1.15
--- src/sys/arch/evbmips/conf/MERAKI:1.14	Sun Mar  6 17:08:23 2011
+++ src/sys/arch/evbmips/conf/MERAKI	Tue May 17 22:19:38 2011
@@ -1,10 +1,10 @@
-#	$NetBSD: MERAKI,v 1.14 2011/03/06 17:08:23 bouyer Exp $
+#	$NetBSD: MERAKI,v 1.15 2011/05/17 22:19:38 dyoung Exp $
 
 include 	arch/evbmips/conf/std.meraki
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		MERAKI-$Revision: 1.14 $
+#ident 		MERAKI-$Revision: 1.15 $
 
 maxusers	32
 
@@ -45,7 +45,7 @@
 options 	DDB		# kernel dynamic debugger
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG=-g	# compile full symbol table
-options 	SYMTAB_SPACE=30	# size for embedded symbol table
+options 	SYMTAB_SPACE=36	# size for embedded symbol table
 
 # Compatibility options
 #options 	COMPAT_43	# compatibility with 4.3BSD binaries

Index: src/sys/arch/evbmips/conf/RB153
diff -u src/sys/arch/evbmips/conf/RB153:1.6 src/sys/arch/evbmips/conf/RB153:1.7
--- src/sys/arch/evbmips/conf/RB153:1.6	Sun Mar  6 17:08:23 2011
+++ src/sys/arch/evbmips/conf/RB153	Tue May 17 22:19:38 2011
@@ -1,10 +1,10 @@
-#	$NetBSD: RB153,v 1.6 2011/03/06 17:08:23 bouyer Exp $
+#	$NetBSD: RB153,v 1.7 2011/05/17 22:19:38 dyoung Exp $
 #
 # Example kernel config for the RouterBOARD 153.
 
 include 	arch/evbmips/conf/std.adm5120
 
-#ident 		RB153-$Revision: 1.6 $
+#ident 		RB153-$Revision: 1.7 $
 
 maxusers	32
 
@@ -34,7 +34,7 @@
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG=-g	# compile full symbol table
 makeoptions 	CPUFLAGS=-march=4kc

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

2011-05-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 17 22:26:33 UTC 2011

Modified Files:
src/sys/arch/sgimips/dev: crmfbreg.h

Log Message:
add some constants, clarify some hw limitations


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sgimips/dev/crmfbreg.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/sgimips/dev/crmfbreg.h
diff -u src/sys/arch/sgimips/dev/crmfbreg.h:1.14 src/sys/arch/sgimips/dev/crmfbreg.h:1.15
--- src/sys/arch/sgimips/dev/crmfbreg.h:1.14	Thu Apr  7 01:20:31 2011
+++ src/sys/arch/sgimips/dev/crmfbreg.h	Tue May 17 22:26:33 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfbreg.h,v 1.14 2011/04/07 01:20:31 macallan Exp $ */
+/* $NetBSD: crmfbreg.h,v 1.15 2011/05/17 22:26:33 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -166,8 +166,9 @@
 #define		CRMFB_OVR_CONTROL_DMAEN_SHIFT	0
 
 #define CRMFB_FRM_TILESIZE	0x0003
-#define		CRMFB_FRM_TILESIZE_RHS_SHIFT	0
-#define		CRMFB_FRM_TILESIZE_WIDTH_SHIFT	5
+#define		CRMFB_FRM_TILESIZE_RHS_SHIFT	0 /* width of a partial tile
+		   * on the right in 32 BYTES */
+#define		CRMFB_FRM_TILESIZE_WIDTH_SHIFT	5 /* width in tiles */
 #define		CRMFB_FRM_TILESIZE_DEPTH_SHIFT	13
 #define			CRMFB_FRM_TILESIZE_DEPTH_8	0
 #define			CRMFB_FRM_TILESIZE_DEPTH_16	1
@@ -193,6 +194,9 @@
 #define CRMFB_MODE		0x00048000
 #define		CRMFB_MODE_TYP_SHIFT		2
 #define			CRMFB_MODE_TYP_I8	0
+#define			CRMFB_MODE_TYP_I12	1
+#define			CRMFB_MODE_TYP_RG3B2	2
+#define			CRMFB_MODE_TYP_RGB4	3
 #define			CRMFB_MODE_TYP_ARGB5	4
 #define			CRMFB_MODE_TYP_RGB8	5
 #define		CRMFB_MODE_BUF_SHIFT		0



CVS commit: xsrc/external/mit/xf86-video-wsfb/dist/src

2011-05-17 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue May 17 22:28:15 UTC 2011

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
xf86LoaderReqSymbols() is no more


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.10 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.11
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.10	Sun May 15 23:44:47 2011
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Tue May 17 22:28:15 2011
@@ -100,6 +100,7 @@
 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION)  6
 #define xf86LoaderReqSymLists(...) do {} while (0)
 #define LoaderRefSymLists(...) do {} while (0)
+#define xf86LoaderReqSymbols(...) do {} while (0)
 #endif
 
 #define DEBUG 0



CVS commit: src/external/mit/xorg/server/drivers

2011-05-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 17 22:29:06 UTC 2011

Modified Files:
src/external/mit/xorg/server/drivers: Makefile

Log Message:
wsfb is no longer borked


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/external/mit/xorg/server/drivers/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/Makefile
diff -u src/external/mit/xorg/server/drivers/Makefile:1.54 src/external/mit/xorg/server/drivers/Makefile:1.55
--- src/external/mit/xorg/server/drivers/Makefile:1.54	Sun May 15 23:42:01 2011
+++ src/external/mit/xorg/server/drivers/Makefile	Tue May 17 22:29:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.54 2011/05/15 23:42:01 christos Exp $
+#	$NetBSD: Makefile,v 1.55 2011/05/17 22:29:06 macallan Exp $
 
 # xf86-input drivers
 
@@ -60,9 +60,8 @@
 	xf86-video-trident \
 	xf86-video-tseng \
 	xf86-video-vmware \
-	xf86-video-vesa 
-
-#	xf86-video-wsfb 	# broken no xf86LoaderReqSymbols anymore
+	xf86-video-vesa \
+	xf86-video-wsfb
 #	xf86-video-rendition
 
 .if ${MACHINE_ARCH} == i386



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

2011-05-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 17 22:52:28 UTC 2011

Modified Files:
src/sys/arch/sgimips/dev: crmfb.c

Log Message:
add support for running the console in more than 8 bit
Now modes like 1680x1050 work. The hardware requires a stride of a multiple
of 32 bytes, with 1680 this requires 16bit colour.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sgimips/dev/crmfb.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/sgimips/dev/crmfb.c
diff -u src/sys/arch/sgimips/dev/crmfb.c:1.33 src/sys/arch/sgimips/dev/crmfb.c:1.34
--- src/sys/arch/sgimips/dev/crmfb.c:1.33	Wed Apr 13 16:22:09 2011
+++ src/sys/arch/sgimips/dev/crmfb.c	Tue May 17 22:52:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfb.c,v 1.33 2011/04/13 16:22:09 plunky Exp $ */
+/* $NetBSD: crmfb.c,v 1.34 2011/05/17 22:52:28 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: crmfb.c,v 1.33 2011/04/13 16:22:09 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: crmfb.c,v 1.34 2011/05/17 22:52:28 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -147,9 +147,12 @@
 	int			sc_width;
 	int			sc_height;
 	int			sc_depth;
+	int			sc_console_depth;
 	int			sc_tiles_x, sc_tiles_y;
 	uint32_t		sc_fbsize;
 	int			sc_mte_direction;
+	int			sc_mte_x_shift;
+	uint32_t		sc_mte_mode;
 	uint8_t			*sc_scratch;
 	paddr_t			sc_linear;
 	int			sc_wsmode;
@@ -289,6 +292,8 @@
 	aprint_normal_dev(sc-sc_dev, initial resolution %dx%d\n,
 	sc-sc_width, sc-sc_height);
 
+	sc-sc_console_depth = 8;
+
 	crmfb_setup_ddc(sc);
 	if ((sc-sc_edid_info.edid_preferred_mode != NULL)) {
 		if (crmfb_set_mode(sc, sc-sc_edid_info.edid_preferred_mode))
@@ -359,7 +364,7 @@
 	aprint_normal_dev(sc-sc_dev, allocated %d byte fb @ %p (%p)\n, 
 	sc-sc_fbsize, KERNADDR(sc-sc_dmai), KERNADDR(sc-sc_dma));
 
-	crmfb_setup_video(sc, 8);
+	crmfb_setup_video(sc, sc-sc_console_depth);
 	ri = crmfb_console_screen.scr_ri;
 	memset(ri, 0, sizeof(struct rasops_info));
 
@@ -456,7 +461,7 @@
 		if (nmode != sc-sc_wsmode) {
 			sc-sc_wsmode = nmode;
 			if (nmode == WSDISPLAYIO_MODE_EMUL) {
-crmfb_setup_video(sc, 8);
+crmfb_setup_video(sc, sc-sc_console_depth);
 crmfb_setup_palette(sc);
 vcons_redraw_screen(vd-active);
 			} else {
@@ -560,17 +565,17 @@
 	ri = scr-scr_ri;
 
 	ri-ri_flg = RI_CENTER | RI_FULLCLEAR;
-	ri-ri_depth = sc-sc_depth;
+	ri-ri_depth = sc-sc_console_depth;
 	ri-ri_width = sc-sc_width;
 	ri-ri_height = sc-sc_height;
 	ri-ri_stride = ri-ri_width * (ri-ri_depth / 8);
-
+#if 1
 	switch (ri-ri_depth) {
 	case 16:
 		ri-ri_rnum = ri-ri_gnum = ri-ri_bnum = 5;
-		ri-ri_rpos = 10;
-		ri-ri_gpos = 5;
-		ri-ri_bpos = 0;
+		ri-ri_rpos = 11;
+		ri-ri_gpos = 6;
+		ri-ri_bpos = 1;
 		break;
 	case 32:
 		ri-ri_rnum = ri-ri_gnum = ri-ri_bnum = 8;
@@ -579,7 +584,7 @@
 		ri-ri_bpos = 24;
 		break;
 	}
-
+#endif
 	ri-ri_bits = KERNADDR(sc-sc_dma);
 
 	if (existing)
@@ -1012,15 +1017,30 @@
 		case 8:
 			mode = DE_MODE_TLB_A | DE_MODE_BUFDEPTH_8 |
 			DE_MODE_TYPE_CI | DE_MODE_PIXDEPTH_8;
+			sc-sc_mte_mode = MTE_MODE_DST_ECC |
+			(MTE_TLB_A  MTE_DST_TLB_SHIFT) |
+			(MTE_TLB_A  MTE_SRC_TLB_SHIFT) |
+			(MTE_DEPTH_8  MTE_DEPTH_SHIFT);
+			sc-sc_mte_x_shift = 0;
 			break;
 		case 16:
 			mode = DE_MODE_TLB_A | DE_MODE_BUFDEPTH_16 |
-			DE_MODE_TYPE_RGB | DE_MODE_PIXDEPTH_16;
+			DE_MODE_TYPE_RGBA | DE_MODE_PIXDEPTH_16;
+			sc-sc_mte_mode = MTE_MODE_DST_ECC |
+			(MTE_TLB_A  MTE_DST_TLB_SHIFT) |
+			(MTE_TLB_A  MTE_SRC_TLB_SHIFT) |
+			(MTE_DEPTH_16  MTE_DEPTH_SHIFT);
+			sc-sc_mte_x_shift = 1;
 			break;
 		case 32:
 			mode = DE_MODE_TLB_A | DE_MODE_BUFDEPTH_32 |
 			DE_MODE_TYPE_RGBA | DE_MODE_PIXDEPTH_32;
 			break;
+			sc-sc_mte_mode = MTE_MODE_DST_ECC |
+			(MTE_TLB_A  MTE_DST_TLB_SHIFT) |
+			(MTE_TLB_A  MTE_SRC_TLB_SHIFT) |
+			(MTE_DEPTH_32  MTE_DEPTH_SHIFT);
+			sc-sc_mte_x_shift = 2;
 		default:
 			panic(%s: unsuported colour depth %d\n, __func__,
 			depth);
@@ -1032,11 +1052,7 @@
 
 	/* initialize memory transfer engine */
 	bus_space_write_4(sc-sc_iot, sc-sc_reh, CRIME_MTE_MODE,
-	MTE_MODE_DST_ECC |
-	(MTE_TLB_A  MTE_DST_TLB_SHIFT) |
-	(MTE_TLB_A  MTE_SRC_TLB_SHIFT) |
-	(MTE_DEPTH_8  MTE_DEPTH_SHIFT) |
-	MTE_MODE_COPY);
+	sc-sc_mte_mode | MTE_MODE_COPY);
 	sc-sc_mte_direction = 1;
 	bus_space_write_4(sc-sc_iot, sc-sc_reh, CRIME_MTE_DST_Y_STEP, 1);
 	bus_space_write_4(sc-sc_iot, sc-sc_reh, CRIME_MTE_SRC_Y_STEP, 1);
@@ -1086,20 +1102,20 @@
 crmfb_fill_rect(struct crmfb_softc *sc, int x, int y, int width, int height,
 uint32_t colour)
 {
+	int rxa, rxe;
+
+	rxa = x  sc-sc_mte_x_shift;
+	rxe = ((x + width)  sc-sc_mte_x_shift) - 1;
 	crmfb_wait_idle(sc);
 	crmfb_set_mte_direction(sc, 1);
 	bus_space_write_4(sc-sc_iot, 

CVS commit: src/sys/dev/pci/cxgb

2011-05-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed May 18 01:02:00 UTC 2011

Modified Files:
src/sys/dev/pci/cxgb: cxgb_adapter.h cxgb_lro.c cxgb_main.c
cxgb_offload.c cxgb_osdep.c cxgb_osdep.h cxgb_sge.c

Log Message:
MI code must #include sys/bus.h, not machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/cxgb/cxgb_adapter.h \
src/sys/dev/pci/cxgb/cxgb_lro.c src/sys/dev/pci/cxgb/cxgb_main.c \
src/sys/dev/pci/cxgb/cxgb_offload.c src/sys/dev/pci/cxgb/cxgb_osdep.c \
src/sys/dev/pci/cxgb/cxgb_osdep.h src/sys/dev/pci/cxgb/cxgb_sge.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/pci/cxgb/cxgb_adapter.h
diff -u src/sys/dev/pci/cxgb/cxgb_adapter.h:1.1 src/sys/dev/pci/cxgb/cxgb_adapter.h:1.2
--- src/sys/dev/pci/cxgb/cxgb_adapter.h:1.1	Sun Mar 21 21:11:13 2010
+++ src/sys/dev/pci/cxgb/cxgb_adapter.h	Wed May 18 01:01:59 2011
@@ -43,7 +43,7 @@
 #include net/if_ether.h
 #include net/if_media.h
 
-#include machine/bus.h
+#include sys/bus.h
 #include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
 
Index: src/sys/dev/pci/cxgb/cxgb_lro.c
diff -u src/sys/dev/pci/cxgb/cxgb_lro.c:1.1 src/sys/dev/pci/cxgb/cxgb_lro.c:1.2
--- src/sys/dev/pci/cxgb/cxgb_lro.c:1.1	Sun Mar 21 21:11:13 2010
+++ src/sys/dev/pci/cxgb/cxgb_lro.c	Wed May 18 01:01:59 2011
@@ -28,14 +28,14 @@
 ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cxgb_lro.c,v 1.1 2010/03/21 21:11:13 jklos Exp $);
+__KERNEL_RCSID(0, $NetBSD: cxgb_lro.c,v 1.2 2011/05/18 01:01:59 dyoung Exp $);
 
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/conf.h
-#include machine/bus.h
+#include sys/bus.h
 #include sys/queue.h
 
 #include netinet/in_systm.h
Index: src/sys/dev/pci/cxgb/cxgb_main.c
diff -u src/sys/dev/pci/cxgb/cxgb_main.c:1.1 src/sys/dev/pci/cxgb/cxgb_main.c:1.2
--- src/sys/dev/pci/cxgb/cxgb_main.c:1.1	Sun Mar 21 21:11:13 2010
+++ src/sys/dev/pci/cxgb/cxgb_main.c	Wed May 18 01:01:59 2011
@@ -28,13 +28,13 @@
 ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cxgb_main.c,v 1.1 2010/03/21 21:11:13 jklos Exp $);
+__KERNEL_RCSID(0, $NetBSD: cxgb_main.c,v 1.2 2011/05/18 01:01:59 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/conf.h
-#include machine/bus.h
+#include sys/bus.h
 #include sys/ioccom.h
 #include sys/mbuf.h
 #include sys/socket.h
Index: src/sys/dev/pci/cxgb/cxgb_offload.c
diff -u src/sys/dev/pci/cxgb/cxgb_offload.c:1.1 src/sys/dev/pci/cxgb/cxgb_offload.c:1.2
--- src/sys/dev/pci/cxgb/cxgb_offload.c:1.1	Sun Mar 21 21:11:13 2010
+++ src/sys/dev/pci/cxgb/cxgb_offload.c	Wed May 18 01:01:59 2011
@@ -31,13 +31,13 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cxgb_offload.c,v 1.1 2010/03/21 21:11:13 jklos Exp $);
+__KERNEL_RCSID(0, $NetBSD: cxgb_offload.c,v 1.2 2011/05/18 01:01:59 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/conf.h
-#include machine/bus.h
+#include sys/bus.h
 #include sys/ioccom.h
 #include sys/mbuf.h
 #include sys/socket.h
Index: src/sys/dev/pci/cxgb/cxgb_osdep.c
diff -u src/sys/dev/pci/cxgb/cxgb_osdep.c:1.1 src/sys/dev/pci/cxgb/cxgb_osdep.c:1.2
--- src/sys/dev/pci/cxgb/cxgb_osdep.c:1.1	Sun Mar 21 21:11:13 2010
+++ src/sys/dev/pci/cxgb/cxgb_osdep.c	Wed May 18 01:01:59 2011
@@ -33,7 +33,7 @@
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/conf.h
-#include machine/bus.h
+#include sys/bus.h
 #include sys/ioccom.h
 #include sys/mbuf.h
 #include sys/socket.h
Index: src/sys/dev/pci/cxgb/cxgb_osdep.h
diff -u src/sys/dev/pci/cxgb/cxgb_osdep.h:1.1 src/sys/dev/pci/cxgb/cxgb_osdep.h:1.2
--- src/sys/dev/pci/cxgb/cxgb_osdep.h:1.1	Sun Mar 21 21:11:13 2010
+++ src/sys/dev/pci/cxgb/cxgb_osdep.h	Wed May 18 01:01:59 2011
@@ -41,7 +41,7 @@
 #include dev/pci/cxgb/cxgb_version.h
 #include dev/pci/cxgb/cxgb_config.h
 #include sys/mbuf.h
-#include machine/bus.h
+#include sys/bus.h
 
 #include netinet/in_systm.h
 #include netinet/in.h
Index: src/sys/dev/pci/cxgb/cxgb_sge.c
diff -u src/sys/dev/pci/cxgb/cxgb_sge.c:1.1 src/sys/dev/pci/cxgb/cxgb_sge.c:1.2
--- src/sys/dev/pci/cxgb/cxgb_sge.c:1.1	Sun Mar 21 21:11:13 2010
+++ src/sys/dev/pci/cxgb/cxgb_sge.c	Wed May 18 01:01:59 2011
@@ -28,13 +28,13 @@
 ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cxgb_sge.c,v 1.1 2010/03/21 21:11:13 jklos Exp $);
+__KERNEL_RCSID(0, $NetBSD: cxgb_sge.c,v 1.2 2011/05/18 01:01:59 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/conf.h
-#include machine/bus.h
+#include sys/bus.h
 #include sys/queue.h
 #include sys/sysctl.h
 



CVS commit: src/sys/dev/pci

2011-05-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed May 18 01:02:44 UTC 2011

Modified Files:
src/sys/dev/pci: if_bgevar.h if_bwi_pci.c if_et.c if_iwn.c
src/sys/dev/pci/n8: helper.h

Log Message:
#include sys/bus.h, not machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/if_bgevar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/if_bwi_pci.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/n8/helper.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/pci/if_bgevar.h
diff -u src/sys/dev/pci/if_bgevar.h:1.6 src/sys/dev/pci/if_bgevar.h:1.7
--- src/sys/dev/pci/if_bgevar.h:1.6	Sun Jan  9 13:01:03 2011
+++ src/sys/dev/pci/if_bgevar.h	Wed May 18 01:02:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bgevar.h,v 1.6 2011/01/09 13:01:03 jruoho Exp $	*/
+/*	$NetBSD: if_bgevar.h,v 1.7 2011/05/18 01:02:43 dyoung Exp $	*/
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -66,7 +66,7 @@
 #ifndef _DEV_PCI_IF_BGEVAR_H_
 #define _DEV_PCI_IF_BGEVAR_H_
 
-#include machine/bus.h
+#include sys/bus.h
 #include net/if_ether.h
 #include dev/pci/pcivar.h
 

Index: src/sys/dev/pci/if_bwi_pci.c
diff -u src/sys/dev/pci/if_bwi_pci.c:1.10 src/sys/dev/pci/if_bwi_pci.c:1.11
--- src/sys/dev/pci/if_bwi_pci.c:1.10	Sat Oct  9 19:46:15 2010
+++ src/sys/dev/pci/if_bwi_pci.c	Wed May 18 01:02:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwi_pci.c,v 1.10 2010/10/09 19:46:15 phx Exp $	*/
+/*	$NetBSD: if_bwi_pci.c,v 1.11 2011/05/18 01:02:43 dyoung Exp $	*/
 /*	$OpenBSD: if_bwi_pci.c,v 1.6 2008/02/14 22:10:02 brad Exp $ */
 
 /*
@@ -24,7 +24,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bwi_pci.c,v 1.10 2010/10/09 19:46:15 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bwi_pci.c,v 1.11 2011/05/18 01:02:43 dyoung Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -36,7 +36,7 @@
 #include sys/sockio.h
 #include sys/systm.h
 
-#include machine/bus.h
+#include sys/bus.h
 
 #include net/if.h
 #include net/if_dl.h

Index: src/sys/dev/pci/if_et.c
diff -u src/sys/dev/pci/if_et.c:1.1 src/sys/dev/pci/if_et.c:1.2
--- src/sys/dev/pci/if_et.c:1.1	Sat Nov 13 00:47:25 2010
+++ src/sys/dev/pci/if_et.c	Wed May 18 01:02:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.1 2010/11/13 00:47:25 jnemeth Exp $	*/
+/*	$NetBSD: if_et.c,v 1.2 2011/05/18 01:02:43 dyoung Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.1 2010/11/13 00:47:25 jnemeth Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.2 2011/05/18 01:02:43 dyoung Exp $);
 
 #include opt_inet.h
 #include vlan.h
@@ -54,7 +54,7 @@
 #include sys/callout.h
 #include sys/socket.h
 
-#include machine/bus.h
+#include sys/bus.h
  
 #include net/if.h
 #include net/if_dl.h

Index: src/sys/dev/pci/if_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.53 src/sys/dev/pci/if_iwn.c:1.54
--- src/sys/dev/pci/if_iwn.c:1.53	Sun May 15 13:56:20 2011
+++ src/sys/dev/pci/if_iwn.c	Wed May 18 01:02:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.53 2011/05/15 13:56:20 christos Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.54 2011/05/18 01:02:43 dyoung Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.96 2010/05/13 09:25:03 damien Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_iwn.c,v 1.53 2011/05/15 13:56:20 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_iwn.c,v 1.54 2011/05/18 01:02:43 dyoung Exp $);
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -42,7 +42,7 @@
 
 #include dev/sysmon/sysmonvar.h
 
-#include machine/bus.h
+#include sys/bus.h
 #include machine/endian.h
 #include machine/intr.h
 

Index: src/sys/dev/pci/n8/helper.h
diff -u src/sys/dev/pci/n8/helper.h:1.1 src/sys/dev/pci/n8/helper.h:1.2
--- src/sys/dev/pci/n8/helper.h:1.1	Thu Oct 30 12:02:14 2008
+++ src/sys/dev/pci/n8/helper.h	Wed May 18 01:02:44 2011
@@ -70,7 +70,7 @@
 #include sys/bus.h
 #include sys/uio.h
 #include sys/poll.h
-#include machine/bus.h
+#include sys/bus.h
 #include sys/rman.h
 #include machine/resource.h
 #include sys/proc.h



CVS commit: src/sys/dev/isa

2011-05-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed May 18 01:03:15 UTC 2011

Modified Files:
src/sys/dev/isa: wbsio.c

Log Message:
#include sys/bus.h, not machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/isa/wbsio.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/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.2 src/sys/dev/isa/wbsio.c:1.3
--- src/sys/dev/isa/wbsio.c:1.2	Fri Mar 19 02:17:41 2010
+++ src/sys/dev/isa/wbsio.c	Wed May 18 01:03:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.2 2010/03/19 02:17:41 cnst Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.3 2011/05/18 01:03:15 dyoung Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis kette...@openbsd.org
@@ -25,7 +25,7 @@
 #include sys/kernel.h
 #include sys/systm.h
 
-#include machine/bus.h
+#include sys/bus.h
 
 #include dev/isa/isareg.h
 #include dev/isa/isavar.h



CVS commit: src/sys/dev/sdmmc

2011-05-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed May 18 01:07:17 UTC 2011

Modified Files:
src/sys/dev/sdmmc: sdmmcchip.h sdmmcvar.h

Log Message:
#include sys/bus.h, not machine/bus.h.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sdmmc/sdmmcchip.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/sdmmc/sdmmcvar.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/sdmmc/sdmmcchip.h
diff -u src/sys/dev/sdmmc/sdmmcchip.h:1.3 src/sys/dev/sdmmc/sdmmcchip.h:1.4
--- src/sys/dev/sdmmc/sdmmcchip.h:1.3	Thu Oct  7 12:00:21 2010
+++ src/sys/dev/sdmmc/sdmmcchip.h	Wed May 18 01:07:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcchip.h,v 1.3 2010/10/07 12:00:21 kiyohara Exp $	*/
+/*	$NetBSD: sdmmcchip.h,v 1.4 2011/05/18 01:07:17 dyoung Exp $	*/
 /*	$OpenBSD: sdmmcchip.h,v 1.3 2007/05/31 10:09:01 uwe Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
 
 #include sys/device.h
 
-#include machine/bus.h
+#include sys/bus.h
 
 struct sdmmc_command;
 

Index: src/sys/dev/sdmmc/sdmmcvar.h
diff -u src/sys/dev/sdmmc/sdmmcvar.h:1.10 src/sys/dev/sdmmc/sdmmcvar.h:1.11
--- src/sys/dev/sdmmc/sdmmcvar.h:1.10	Sun Feb 13 06:43:52 2011
+++ src/sys/dev/sdmmc/sdmmcvar.h	Wed May 18 01:07:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmcvar.h,v 1.10 2011/02/13 06:43:52 nonaka Exp $	*/
+/*	$NetBSD: sdmmcvar.h,v 1.11 2011/05/18 01:07:17 dyoung Exp $	*/
 /*	$OpenBSD: sdmmcvar.h,v 1.13 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -24,7 +24,7 @@
 #include sys/mutex.h
 #include sys/callout.h
 
-#include machine/bus.h
+#include sys/bus.h
 
 #include dev/sdmmc/sdmmcchip.h
 #include dev/sdmmc/sdmmcreg.h



CVS commit: othersrc/external/bsd/genraidconf

2011-05-17 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed May 18 01:37:58 UTC 2011

Modified Files:
othersrc/external/bsd/genraidconf: genraidconf.sh

Log Message:
work out the partition letter of the first partition properly

invoke fdisk properly

use the correct partition letter in the raidN.conf file

invoke ci with a default description of the file as well as a commit message.

with these changes, we properly configure and initialise a raid1 set on 2 vnd
devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/genraidconf/genraidconf.sh

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

Modified files:

Index: othersrc/external/bsd/genraidconf/genraidconf.sh
diff -u othersrc/external/bsd/genraidconf/genraidconf.sh:1.1.1.1 othersrc/external/bsd/genraidconf/genraidconf.sh:1.2
--- othersrc/external/bsd/genraidconf/genraidconf.sh:1.1.1.1	Tue May 17 03:48:50 2011
+++ othersrc/external/bsd/genraidconf/genraidconf.sh	Wed May 18 01:37:58 2011
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: genraidconf.sh,v 1.1.1.1 2011/05/17 03:48:50 agc Exp $
+# $NetBSD: genraidconf.sh,v 1.2 2011/05/18 01:37:58 agc Exp $
 
 # Copyright (c) 2011 Alistair Crooks a...@netbsd.org
 # All rights reserved.
@@ -80,14 +80,16 @@
 
 # work out whether we use a dos disk lebel
 case $(sysctl kern.rawpartition) in
-2)	wholedisk=c
+*2)	wholedisk=c
 	firstpart=d
 	doslabel=false
 	;;
-3)	wholedisk=d
+*3)	wholedisk=d
 	firstpart=e
 	doslabel=true
 	;;
+*)	die can't find raw partition number
+	;;
 esac
 
 # count number of devices
@@ -104,7 +106,11 @@
 sectorc=0
 devs=
 while [ $# -gt ${lastdev} ]; do
-	devs=${devs}|/dev/$1${firstpart}
+	case $1 in
+	vnd*)	part1=a ;;
+	*)	part1=${firstpart} ;;
+	esac
+	devs=${devs}|/dev/$1${part1}
 	nsectorc=$(disklabel $1 2/dev/null | awk '/^total sectors:/ {print $3;exit}')
 	case ${nsectorc} in
 	)	die device $1 not found on computer ;;
@@ -148,7 +154,8 @@
 # put an fdisk label on there
 if ${doslabel}; then
 	for d in ${disks}; do
-		${doit} fdisk -uai -A 2048 ${d}a
+		secs=$(expr ${sectorc} - 2048)
+		${doit} fdisk -u -a -i -f -3 -s 169/2048/${secs} -b 100/1/${sectorc} -A 2048/2048 ${d}a
 	done
 fi
 
@@ -185,7 +192,7 @@
 if [ -e /etc/${raiddev}.conf ]; then
 	echo Preserving previous ${raiddev}.conf in /etc/RCS
 	${doit} mkdir -p /etc/RCS
-	(cd /etc  ${doit} ci -l -mcreating new ${raiddev}.conf ${raiddev}.conf)
+	(cd /etc  ${doit} ci -l -mcreating new ${raiddev}.conf -t-new ${raiddev}.conf file ${raiddev}.conf)
 fi
 
 # set up spare definitions if we need one
@@ -195,8 +202,12 @@
 	spare2=
 	;;
 1)
+	case $1 in
+	vnd*)	part1=a ;;
+	*)	part1=${firstpart} ;;
+	esac
 	spare1=START spare
-	spare2=/dev/${1}${firstpart}
+	spare2=/dev/${1}${part1}
 	;;
 esac
 case ${doit} in



CVS commit: src/lib/libc/stdlib

2011-05-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 18 01:59:39 UTC 2011

Modified Files:
src/lib/libc/stdlib: jemalloc.c malloc.c

Log Message:
cleanup saving and restoring errno, and make it similar.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/stdlib/jemalloc.c
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/stdlib/malloc.c

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

Modified files:

Index: src/lib/libc/stdlib/jemalloc.c
diff -u src/lib/libc/stdlib/jemalloc.c:1.23 src/lib/libc/stdlib/jemalloc.c:1.24
--- src/lib/libc/stdlib/jemalloc.c:1.23	Fri May 13 19:11:00 2011
+++ src/lib/libc/stdlib/jemalloc.c	Tue May 17 21:59:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: jemalloc.c,v 1.23 2011/05/13 23:11:00 christos Exp $	*/
+/*	$NetBSD: jemalloc.c,v 1.24 2011/05/18 01:59:39 christos Exp $	*/
 
 /*-
  * Copyright (C) 2006,2007 Jason Evans jas...@freebsd.org.
@@ -118,7 +118,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $); */ 
-__RCSID($NetBSD: jemalloc.c,v 1.23 2011/05/13 23:11:00 christos Exp $);
+__RCSID($NetBSD: jemalloc.c,v 1.24 2011/05/18 01:59:39 christos Exp $);
 
 #ifdef __FreeBSD__
 #include libc_private.h
@@ -3337,6 +3337,7 @@
 		return (false);
 	}
 
+	serrno = errno;
 	/* Get number of CPUs. */
 	{
 		int mib[2];
@@ -3372,7 +3373,6 @@
 		/* Get runtime configuration. */
 		switch (i) {
 		case 0:
-			serrno = errno;
 			if ((linklen = readlink(/etc/malloc.conf, buf,
 		sizeof(buf) - 1)) != -1) {
 /*
@@ -3382,7 +3382,6 @@
 buf[linklen] = '\0';
 opts = buf;
 			} else {
-errno = serrno;
 /* No configuration specified. */
 buf[0] = '\0';
 opts = buf;
@@ -3518,6 +3517,7 @@
 			}
 		}
 	}
+	errno = serrno;
 
 	/* Take care to call atexit() only once. */
 	if (opt_print_stats) {

Index: src/lib/libc/stdlib/malloc.c
diff -u src/lib/libc/stdlib/malloc.c:1.53 src/lib/libc/stdlib/malloc.c:1.54
--- src/lib/libc/stdlib/malloc.c:1.53	Fri May 13 19:11:00 2011
+++ src/lib/libc/stdlib/malloc.c	Tue May 17 21:59:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: malloc.c,v 1.53 2011/05/13 23:11:00 christos Exp $	*/
+/*	$NetBSD: malloc.c,v 1.54 2011/05/18 01:59:39 christos Exp $	*/
 
 /*
  * 
@@ -90,7 +90,7 @@
 #include sys/cdefs.h
 #include extern.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: malloc.c,v 1.53 2011/05/13 23:11:00 christos Exp $);
+__RCSID($NetBSD: malloc.c,v 1.54 2011/05/18 01:59:39 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 int utrace(const char *, void *, size_t);
 
@@ -447,7 +447,7 @@
 char b[64];
 size_t i;
 ssize_t j;
-int save_errno = errno;
+int serrno = errno;
 
 /*
  * Compute page-size related variables.
@@ -467,12 +467,9 @@
 
 for (i = 0; i  3; i++) {
 	if (i == 0) {
-	int serrno = errno;
 	j = readlink(/etc/malloc.conf, b, sizeof b - 1);
-	if (j == -1) {
-		errno = serrno; 
+	if (j == -1)
 		continue;
-	}
 	b[j] = '\0';
 	p = b;
 	} else if (i == 1  issetugid() == 0) {
@@ -550,7 +547,7 @@
  */
 px = imalloc(sizeof *px);
 
-errno = save_errno;
+errno = serrno;
 }
 
 /*



CVS commit: src/tests/syscall

2011-05-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 18 02:57:49 UTC 2011

Modified Files:
src/tests/syscall: Makefile
Added Files:
src/tests/syscall: t_pselect.c

Log Message:
Add a test for signal delivery during pselect, with temporary mask change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/syscall/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/syscall/t_pselect.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/syscall/Makefile
diff -u src/tests/syscall/Makefile:1.26 src/tests/syscall/Makefile:1.27
--- src/tests/syscall/Makefile:1.26	Mon May  2 13:26:23 2011
+++ src/tests/syscall/Makefile	Tue May 17 22:57:48 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.26 2011/05/02 17:26:23 jruoho Exp $
+# $NetBSD: Makefile,v 1.27 2011/05/18 02:57:48 christos Exp $
 
 .include bsd.own.mk
 
@@ -7,7 +7,7 @@
 TESTS_C+=	t_access t_cmsg t_dup t_fsync
 TESTS_C+=	t_getgroups t_getpid t_getrusage t_getsid t_gettimeofday
 TESTS_C+=	t_itimer t_kill t_mmap t_mprotect t_msync t_nanosleep
-TESTS_C+=	t_setrlimit t_setuid t_timer t_umask
+TESTS_C+=	t_pselect t_setrlimit t_setuid t_timer t_umask
 
 LDADD.t_getpid+=	-lpthread
 LDADD.t_timer+=		-lpthread

Added files:

Index: src/tests/syscall/t_pselect.c
diff -u /dev/null src/tests/syscall/t_pselect.c:1.1
--- /dev/null	Tue May 17 22:57:49 2011
+++ src/tests/syscall/t_pselect.c	Tue May 17 22:57:48 2011
@@ -0,0 +1,125 @@
+/*	$NetBSD: t_pselect.c,v 1.1 2011/05/18 02:57:48 christos Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundatiom
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/types.h
+#include sys/select.h
+#include sys/wait.h
+#include err.h
+#include stdio.h
+#include string.h
+#include signal.h
+#include stdlib.h
+#include unistd.h
+#include errno.h
+#include fcntl.h
+
+#include atf-c.h
+
+static sig_atomic_t keep_going = 1;
+
+static void
+sig_handler(int signum)
+{
+	keep_going = 0;
+}
+
+static void __attribute__((__noreturn__))
+child(void)
+{
+	struct sigaction sa;
+	sigset_t set;
+	int fd;
+
+	memset(sa, 0, sizeof(sa));
+	sa.sa_handler = sig_handler;
+	if ((fd = open(/dev/null, O_RDONLY)) == -1)
+		err(1, open);
+
+	if (sigaction(SIGTERM, sa, NULL) == -1)
+		err(1, sigaction);
+
+	sigfillset(set);
+	if (sigprocmask(SIG_BLOCK, set, NULL) == -1)
+		err(1, procmask);
+
+	sigemptyset(set);
+
+	for (;;) {
+		fd_set rset;
+		FD_ZERO(rset);
+		FD_SET(fd, rset);
+		if (pselect(1, rset, NULL, NULL, NULL, set) == -1) {
+			if(errno == EINTR) {
+if (!keep_going)
+	exit(0);
+			}
+		}
+   }
+}
+
+ATF_TC(pselect_signal_mask);
+ATF_TC_HEAD(pselect_signal_mask, tc)
+{
+
+	/* Cf. PR lib/43625. */
+	atf_tc_set_md_var(tc, descr,
+	Checks pselect's temporary mask setting);
+	atf_tc_set_md_var(tc, timeout, 2);
+}
+
+ATF_TC_BODY(pselect_signal_mask, tc)
+{
+	pid_t pid;
+	int status;
+
+	switch (pid = fork()) {
+	case 0:
+		child();
+	case -1:
+		err(1, fork);
+	default:
+		usleep(500);
+		if (kill(pid, SIGTERM) == -1)
+			err(1, kill);
+		if (waitpid(pid, status, 0) == -1)
+			err(1, wait);
+		break;
+	}
+}
+
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_ADD_TC(tp, pselect_signal_mask);
+
+	return atf_no_error();
+}



CVS commit: src/distrib/sets/lists/tests

2011-05-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 18 03:07:37 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
add pselect


To generate a diff of this commit:
cvs rdiff -u -r1.336 -r1.337 src/distrib/sets/lists/tests/mi

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.336 src/distrib/sets/lists/tests/mi:1.337
--- src/distrib/sets/lists/tests/mi:1.336	Tue May 10 09:03:05 2011
+++ src/distrib/sets/lists/tests/mi	Tue May 17 23:07:37 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.336 2011/05/10 13:03:05 jruoho Exp $
+# $NetBSD: mi,v 1.337 2011/05/18 03:07:37 christos Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -620,6 +620,7 @@
 ./usr/libdata/debug/usr/tests/syscall/t_mprotect.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_msync.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_nanosleep.debug			tests-syscall-debug	debug,atf
+./usr/libdata/debug/usr/tests/syscall/t_pselect.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_setrlimit.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_setuid.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall/t_timer.debug			tests-syscall-debug	debug,atf
@@ -2322,6 +2323,7 @@
 ./usr/tests/syscall/t_mprotect			tests-syscall-tests	atf
 ./usr/tests/syscall/t_msync			tests-syscall-tests	atf
 ./usr/tests/syscall/t_nanosleep			tests-syscall-tests	atf
+./usr/tests/syscall/t_pselect			tests-syscall-tests	atf
 ./usr/tests/syscall/t_setrlimit			tests-syscall-tests	atf
 ./usr/tests/syscall/t_setuid			tests-syscall-tests	atf
 ./usr/tests/syscall/t_timer			tests-syscall-tests	atf



CVS commit: src/tests/syscall

2011-05-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 18 03:15:12 UTC 2011

Modified Files:
src/tests/syscall: t_pselect.c

Log Message:
Don't depend on the atf timeout stuff, do it ourselves.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/syscall/t_pselect.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/syscall/t_pselect.c
diff -u src/tests/syscall/t_pselect.c:1.1 src/tests/syscall/t_pselect.c:1.2
--- src/tests/syscall/t_pselect.c:1.1	Tue May 17 22:57:48 2011
+++ src/tests/syscall/t_pselect.c	Tue May 17 23:15:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pselect.c,v 1.1 2011/05/18 02:57:48 christos Exp $ */
+/*	$NetBSD: t_pselect.c,v 1.2 2011/05/18 03:15:12 christos Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -92,7 +92,6 @@
 	/* Cf. PR lib/43625. */
 	atf_tc_set_md_var(tc, descr,
 	Checks pselect's temporary mask setting);
-	atf_tc_set_md_var(tc, timeout, 2);
 }
 
 ATF_TC_BODY(pselect_signal_mask, tc)
@@ -109,9 +108,18 @@
 		usleep(500);
 		if (kill(pid, SIGTERM) == -1)
 			err(1, kill);
-		if (waitpid(pid, status, 0) == -1)
+		usleep(500);
+		switch (waitpid(pid, status, WNOHANG)) {
+		case -1:
 			err(1, wait);
-		break;
+		case 0:
+			if (kill(pid, SIGKILL) == -1)
+err(1, kill);
+			atf_tc_fail(pselect() did not receive signal);
+			break;
+		default:
+			break;
+		}
 	}
 }
 



CVS commit: src/sys

2011-05-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 18 03:51:41 UTC 2011

Modified Files:
src/sys/kern: sys_select.c sys_sig.c
src/sys/sys: signalvar.h

Log Message:
PR/43625: Mark Davies: Fix pselect(2) to honor the temporary mask. pselect(2)
(and pollts(2)) are similar to sigsuspend(2) in that they temporarily change
the process signal mask and wait for signal delivery. Factor out and share the
code that does this.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/sys_select.c
cvs rdiff -u -r1.32 -r1.33 src/sys/kern/sys_sig.c
cvs rdiff -u -r1.79 -r1.80 src/sys/sys/signalvar.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/kern/sys_select.c
diff -u src/sys/kern/sys_select.c:1.30 src/sys/kern/sys_select.c:1.31
--- src/sys/kern/sys_select.c:1.30	Sat Mar  5 23:41:58 2011
+++ src/sys/kern/sys_select.c	Tue May 17 23:51:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_select.c,v 1.30 2011/03/06 04:41:58 rmind Exp $	*/
+/*	$NetBSD: sys_select.c,v 1.31 2011/05/18 03:51:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_select.c,v 1.30 2011/03/06 04:41:58 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_select.c,v 1.31 2011/05/18 03:51:41 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -219,10 +219,8 @@
 struct timespec *ts, sigset_t *mask, register_t *retval)
 {
 	lwp_t		* const l = curlwp;
-	proc_t		* const p = l-l_proc;
 	selcluster_t	*sc;
 	kmutex_t	*lock;
-	sigset_t	oldmask;
 	struct timespec	sleepts;
 	int		error, timo;
 
@@ -233,13 +231,7 @@
 
 	if (__predict_false(mask)) {
 		sigminusset(sigcantmask, mask);
-		mutex_enter(p-p_lock);
-		oldmask = l-l_sigmask;
-		l-l_sigmask = *mask;
-		mutex_exit(p-p_lock);
-	} else {
-		/* XXXgcc */
-		oldmask = l-l_sigmask;
+		sigsuspendsetup(l, mask);
 	}
 
 	sc = curcpu()-ci_data.cpu_selcluster;
@@ -314,12 +306,6 @@
 	}
 	selclear();
 
-	if (__predict_false(mask)) {
-		mutex_enter(p-p_lock);
-		l-l_sigmask = oldmask;
-		mutex_exit(p-p_lock);
-	}
-
 	/* select and poll are not restarted after signals... */
 	if (error == ERESTART)
 		return EINTR;

Index: src/sys/kern/sys_sig.c
diff -u src/sys/kern/sys_sig.c:1.32 src/sys/kern/sys_sig.c:1.33
--- src/sys/kern/sys_sig.c:1.32	Thu Mar  3 15:46:16 2011
+++ src/sys/kern/sys_sig.c	Tue May 17 23:51:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_sig.c,v 1.32 2011/03/03 20:46:16 martin Exp $	*/
+/*	$NetBSD: sys_sig.c,v 1.33 2011/05/18 03:51:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_sig.c,v 1.32 2011/03/03 20:46:16 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_sig.c,v 1.33 2011/05/18 03:51:41 christos Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -604,33 +604,39 @@
 	mutex_exit(p-p_lock);
 }
 
-int
-sigsuspend1(struct lwp *l, const sigset_t *ss)
+void
+sigsuspendsetup(struct lwp *l, const sigset_t *ss)
 {
 	struct proc *p = l-l_proc;
 
-	if (ss) {
-		/*
-		 * When returning from sigsuspend, we want
-		 * the old mask to be restored after the
-		 * signal handler has finished.  Thus, we
-		 * save it here and mark the sigctx structure
-		 * to indicate this.
-		 */
-		mutex_enter(p-p_lock);
-		l-l_sigrestore = 1;
-		l-l_sigoldmask = l-l_sigmask;
-		l-l_sigmask = *ss;
-		sigminusset(sigcantmask, l-l_sigmask);
+	/*
+	 * When returning from sigsuspend/pselect/pollts, we want
+	 * the old mask to be restored after the
+	 * signal handler has finished.  Thus, we
+	 * save it here and mark the sigctx structure
+	 * to indicate this.
+	 */
+	mutex_enter(p-p_lock);
+	l-l_sigrestore = 1;
+	l-l_sigoldmask = l-l_sigmask;
+	l-l_sigmask = *ss;
+	sigminusset(sigcantmask, l-l_sigmask);
 
-		/* Check for pending signals when sleeping. */
-		if (sigispending(l, 0)) {
-			lwp_lock(l);
-			l-l_flag |= LW_PENDSIG;
-			lwp_unlock(l);
-		}
-		mutex_exit(p-p_lock);
+	/* Check for pending signals when sleeping. */
+	if (sigispending(l, 0)) {
+		lwp_lock(l);
+		l-l_flag |= LW_PENDSIG;
+		lwp_unlock(l);
 	}
+	mutex_exit(p-p_lock);
+}
+
+int
+sigsuspend1(struct lwp *l, const sigset_t *ss)
+{
+
+	if (ss)
+		sigsuspendsetup(l, ss);
 
 	while (kpause(pause, true, 0, NULL) == 0)
 		;

Index: src/sys/sys/signalvar.h
diff -u src/sys/sys/signalvar.h:1.79 src/sys/sys/signalvar.h:1.80
--- src/sys/sys/signalvar.h:1.79	Tue Apr 26 20:38:37 2011
+++ src/sys/sys/signalvar.h	Tue May 17 23:51:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: signalvar.h,v 1.79 2011/04/27 00:38:37 rmind Exp $	*/
+/*	$NetBSD: signalvar.h,v 1.80 2011/05/18 03:51:41 christos Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -148,6 +148,7 @@
 	struct sigaction *, const void *, int);
 int	sigprocmask1(struct lwp *, int, const sigset_t *, sigset_t *);
 void	sigpending1(struct lwp *,