CVS commit: src/share/man/man9

2013-05-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon May 13 12:07:44 UTC 2013

Modified Files:
src/share/man/man9: microtime.9

Log Message:
Make nanotime and getnanotime prototypes match.
Also, the BUGS section doesn't describe something fixable, so make
it a CAVEATS section instead.
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/share/man/man9/microtime.9

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

Modified files:

Index: src/share/man/man9/microtime.9
diff -u src/share/man/man9/microtime.9:1.18 src/share/man/man9/microtime.9:1.19
--- src/share/man/man9/microtime.9:1.18	Tue Jun  8 05:50:01 2010
+++ src/share/man/man9/microtime.9	Mon May 13 12:07:44 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: microtime.9,v 1.18 2010/06/08 05:50:01 jruoho Exp $
+.\ $NetBSD: microtime.9,v 1.19 2013/05/13 12:07:44 wiz Exp $
 .\
 .\ Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -53,7 +53,7 @@
 .\
 .\ $FreeBSD: src/share/man/man9/microtime.9,v 1.11 2005/10/13 16:01:28 jhb Exp $
 .\
-.Dd June 8, 2010
+.Dd May 13, 2013
 .Dt MICROTIME 9
 .Os
 .Sh NAME
@@ -84,7 +84,7 @@
 .Fc
 .Ft void
 .Fo nanotime
-.Fa struct timespec *ts
+.Fa struct timespec *tsp
 .Fc
 .Ft void
 .Fo getnanotime
@@ -177,7 +177,7 @@ This manual page was written by
 .An Jeremy Cooper
 and
 .An Kelly Yancey Aq kby...@posi.net .
-.Sh BUGS
+.Sh CAVEATS
 Despite the guarantee that the system realtime clock will always be
 monotonically increasing,
 it is always possible for the system clock to be manually reset by the



CVS commit: src/lib/libc/net

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 13:59:39 UTC 2013

Modified Files:
src/lib/libc/net: getaddrinfo.c

Log Message:
CVE 1020938: Fix memory leak


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/lib/libc/net/getaddrinfo.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/getaddrinfo.c
diff -u src/lib/libc/net/getaddrinfo.c:1.103 src/lib/libc/net/getaddrinfo.c:1.104
--- src/lib/libc/net/getaddrinfo.c:1.103	Fri May  3 15:31:13 2013
+++ src/lib/libc/net/getaddrinfo.c	Mon May 13 09:59:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: getaddrinfo.c,v 1.103 2013/05/03 19:31:13 christos Exp $	*/
+/*	$NetBSD: getaddrinfo.c,v 1.104 2013/05/13 13:59:39 christos Exp $	*/
 /*	$KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $	*/
 
 /*
@@ -55,7 +55,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: getaddrinfo.c,v 1.103 2013/05/03 19:31:13 christos Exp $);
+__RCSID($NetBSD: getaddrinfo.c,v 1.104 2013/05/13 13:59:39 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
@@ -1405,6 +1405,11 @@ getanswer(const querybuf *answer, int an
 		}
 		res = __res_get_state();
 		if (res == NULL) {
+			while (srvlist != NULL) {
+srv = srvlist;
+srvlist = srvlist-next;
+free(srv);
+			}
 			h_errno = NETDB_INTERNAL;
 			return NULL;
 		}



CVS commit: src/sys/arch/hpc/hpc

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 15:40:31 UTC 2013

Modified Files:
src/sys/arch/hpc/hpc: disksubr.c

Log Message:
fix lossage from disklabel.h merge


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hpc/hpc/disksubr.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/hpc/hpc/disksubr.c
diff -u src/sys/arch/hpc/hpc/disksubr.c:1.20 src/sys/arch/hpc/hpc/disksubr.c:1.21
--- src/sys/arch/hpc/hpc/disksubr.c:1.20	Wed Jan  2 06:48:25 2008
+++ src/sys/arch/hpc/hpc/disksubr.c	Mon May 13 11:40:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.20 2008/01/02 11:48:25 ad Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.21 2013/05/13 15:40:31 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.20 2008/01/02 11:48:25 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.21 2013/05/13 15:40:31 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -165,7 +165,7 @@ readdisklabel(dev_t dev, void (*strat)(s
 	cyl = LABELSECTOR / lp-d_secpercyl;
 	if (!osdep)
 		goto nombrpart;
-	dp = osdep-dosparts;
+	dp = osdep-mbrparts;
 
 	/* read master boot record */
 	bp-b_blkno = MBR_BBSECTOR;
@@ -386,7 +386,7 @@ writedisklabel(dev_t dev, void (*strat)(
 	cyl = LABELSECTOR / lp-d_secpercyl;
 	if (!osdep)
 		goto nombrpart;
-	dp = osdep-dosparts;
+	dp = osdep-mbrparts;
 
 	/* read master boot record */
 	bp-b_blkno = MBR_BBSECTOR;



CVS commit: src/sys/dev/marvell

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 15:47:19 UTC 2013

Modified Files:
src/sys/dev/marvell: gttwsi.c mvspireg.h

Log Message:
There is no opt_mvsoc.h; the #ifdef ARMADAXP should be changed to some
inherited device property.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/gttwsi.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvspireg.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/marvell/gttwsi.c
diff -u src/sys/dev/marvell/gttwsi.c:1.7 src/sys/dev/marvell/gttwsi.c:1.8
--- src/sys/dev/marvell/gttwsi.c:1.7	Wed May  1 08:25:31 2013
+++ src/sys/dev/marvell/gttwsi.c	Mon May 13 11:47:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $	*/
+/*	$NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $	*/
 /*
  * Copyright (c) 2008 Eiji Kawauchi.
  * All rights reserved.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $);
+__KERNEL_RCSID(0, $NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $);
 #include locators.h
 
 #include sys/param.h
@@ -86,8 +86,6 @@ __KERNEL_RCSID(0, $NetBSD: gttwsi.c,v 1
 #include dev/marvell/marvellvar.h
 #include dev/marvell/gttwsireg.h
 
-#include opt_mvsoc.h
-
 struct gttwsi_softc {
 	device_t sc_dev;
 	bus_space_tag_t sc_bust;

Index: src/sys/dev/marvell/mvspireg.h
diff -u src/sys/dev/marvell/mvspireg.h:1.1 src/sys/dev/marvell/mvspireg.h:1.2
--- src/sys/dev/marvell/mvspireg.h:1.1	Wed May  1 08:17:17 2013
+++ src/sys/dev/marvell/mvspireg.h	Mon May 13 11:47:18 2013
@@ -35,8 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 
 ***/
 
-#include opt_mvsoc.h
-
 #ifndef _MVSPIREG_H_
 #define _MVSPIREG_H_
 



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

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 16:01:31 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
make this compile again; macallan, please commit the right fix!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/voyager/pwmclock.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/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.8 src/sys/dev/pci/voyager/pwmclock.c:1.9
--- src/sys/dev/pci/voyager/pwmclock.c:1.8	Tue Apr 16 05:04:24 2013
+++ src/sys/dev/pci/voyager/pwmclock.c	Mon May 13 12:01:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.8 2013/04/16 09:04:24 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.9 2013/05/13 16:01:31 christos Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.8 2013/04/16 09:04:24 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.9 2013/05/13 16:01:31 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -77,7 +77,6 @@ static u_int get_pwmclock_timecount(stru
 
 struct pwmclock_softc *pwmclock;
 extern void (*initclocks_ptr)(void);
-extern struct clockframe cf;
 
 /* 0, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1 */
 static int scale_m[] = {1, 1, 3, 1, 5, 3, 7, 1};
@@ -306,7 +305,14 @@ pwmclock_intr(void *cookie)
 	if (sc-sc_step_wanted != sc-sc_step) {
 		sc-sc_step = sc-sc_step_wanted;
 	}
+#ifdef notyet
+	struct clockframe cf;
+		 
+	cf.pc = pc;
+	cf.sr = status;
+	cf.intr = (curcpu()-ci_idepth  1);
 	hardclock(cf);
+#endif
 
 	return 1;
 }



CVS commit: src/sys/dev/pci

2013-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 17:08:20 UTC 2013

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
 Set BGE_MISC_CTL's byte/word swap options before using bge_readmem_ind().
Fixes PR#47716.

 Re-enable NVRAM lock stuff again (i.e. revert rev. 1.233).


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/sys/dev/pci/if_bge.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/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.242 src/sys/dev/pci/if_bge.c:1.243
--- src/sys/dev/pci/if_bge.c:1.242	Fri May 10 16:37:10 2013
+++ src/sys/dev/pci/if_bge.c	Mon May 13 17:08:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.242 2013/05/10 16:37:10 christos Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.243 2013/05/13 17:08:20 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.242 2013/05/10 16:37:10 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.243 2013/05/13 17:08:20 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -3591,6 +3591,12 @@ bge_attach(device_t parent, device_t sel
 		}
 	}
 
+	/* 5718 reset step 5, 57XX step 5b-5d */
+	/* Set swap options before using bge_readmem_ind() */
+	pci_conf_write(sc-sc_pc, sc-sc_pcitag, BGE_PCI_MISC_CTL,
+	BGE_PCIMISCCTL_INDIRECT_ACCESS | BGE_PCIMISCCTL_MASK_PCI_INTR |
+	BGE_HIF_SWAP_OPTIONS | BGE_PCIMISCCTL_PCISTATE_RW);
+
 	/*
 	 * Read the hardware config word in the first 32k of NIC internal
 	 * memory, or fall back to the config word in the EEPROM.
@@ -3618,7 +3624,6 @@ bge_attach(device_t parent, device_t sel
 	aprint_normal_dev(sc-bge_dev, HW config %08x, %08x, %08x, %08x\n,
 	hwcfg, hwcfg2, hwcfg3, hwcfg4);
 
-#if 0
 	/*
 	 * Reset NVRAM before bge_reset(). It's required to acquire NVRAM
 	 * lock in bge_reset().
@@ -3627,7 +3632,6 @@ bge_attach(device_t parent, device_t sel
 	BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL));
 	delay(1000);
 	BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
-#endif
 
 	bge_stop_fw(sc);
 	bge_sig_pre_reset(sc, BGE_RESET_START);
@@ -3973,7 +3977,6 @@ bge_reset(struct bge_softc *sc)
 	} else
 		write_op = bge_writereg_ind;
 
-#if 0
 	/* 57XX step 4 */
 	/* Acquire the NVM lock */
 	if ((sc-bge_flags  BGE_NO_EEPROM) == 0 
@@ -3991,7 +3994,7 @@ bge_reset(struct bge_softc *sc)
 			device_xname(sc-bge_dev));
 		}
 	}
-#endif
+
 	/* Take APE lock when performing reset. */
 	bge_ape_lock(sc, BGE_APE_LOCK_GRC);
 



CVS commit: src/sys/dev/pci

2013-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 17:10:59 UTC 2013

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
For BGE_IS_575X_PLUS() devices, don't set BGE_RXLPSTATCONTROL_DACK_FIX bits 
because
these bits are reserved.


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/dev/pci/if_bge.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/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.243 src/sys/dev/pci/if_bge.c:1.244
--- src/sys/dev/pci/if_bge.c:1.243	Mon May 13 17:08:20 2013
+++ src/sys/dev/pci/if_bge.c	Mon May 13 17:10:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.243 2013/05/13 17:08:20 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.244 2013/05/13 17:10:58 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.243 2013/05/13 17:08:20 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.244 2013/05/13 17:10:58 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -2860,7 +2860,13 @@ bge_blockinit(struct bge_softc *sc)
 
 	/* 5718 step 29, 57XX step 58 */
 	/* Inialize RX list placement stats mask. */
-	CSR_WRITE_4(sc, BGE_RXLP_STATS_ENABLE_MASK, 0x007F);
+	if (BGE_IS_575X_PLUS(sc)) {
+		val = CSR_READ_4(sc, BGE_RXLP_STATS_ENABLE_MASK);
+		val = ~BGE_RXLPSTATCONTROL_DACK_FIX;
+		CSR_WRITE_4(sc, BGE_RXLP_STATS_ENABLE_MASK, val);
+	} else
+		CSR_WRITE_4(sc, BGE_RXLP_STATS_ENABLE_MASK, 0x007F);
+
 	/* 5718 step 30, 57XX step 59 */
 	CSR_WRITE_4(sc, BGE_RXLP_STATS_CTL, 0x1);
 



CVS commit: src/lib/libc/net

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 17:54:55 UTC 2013

Modified Files:
src/lib/libc/net: getaddrinfo.c

Log Message:
CVE 1020946: Fix res leak.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/lib/libc/net/getaddrinfo.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/getaddrinfo.c
diff -u src/lib/libc/net/getaddrinfo.c:1.104 src/lib/libc/net/getaddrinfo.c:1.105
--- src/lib/libc/net/getaddrinfo.c:1.104	Mon May 13 09:59:39 2013
+++ src/lib/libc/net/getaddrinfo.c	Mon May 13 13:54:55 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: getaddrinfo.c,v 1.104 2013/05/13 13:59:39 christos Exp $	*/
+/*	$NetBSD: getaddrinfo.c,v 1.105 2013/05/13 17:54:55 christos Exp $	*/
 /*	$KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $	*/
 
 /*
@@ -55,7 +55,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: getaddrinfo.c,v 1.104 2013/05/13 13:59:39 christos Exp $);
+__RCSID($NetBSD: getaddrinfo.c,v 1.105 2013/05/13 17:54:55 christos Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
@@ -1669,6 +1669,7 @@ _dns_host_lookup(const char *name, const
 		q.qtype = T_;
 		break;
 	default:
+		__res_put_state(res);
 		h_errno = NETDB_INTERNAL;
 		return NULL;
 	}



CVS commit: src/sbin/disklabel

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 17:58:50 UTC 2013

Modified Files:
src/sbin/disklabel: main.c

Log Message:
CVE 1020935: Prevent overflow


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sbin/disklabel/main.c

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

Modified files:

Index: src/sbin/disklabel/main.c
diff -u src/sbin/disklabel/main.c:1.32 src/sbin/disklabel/main.c:1.33
--- src/sbin/disklabel/main.c:1.32	Sun May  5 11:59:42 2013
+++ src/sbin/disklabel/main.c	Mon May 13 13:58:50 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.32 2013/05/05 15:59:42 skrll Exp $	*/
+/*	$NetBSD: main.c,v 1.33 2013/05/13 17:58:50 christos Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@ __COPYRIGHT(@(#) Copyright (c) 1987, 19
 static char sccsid[] = @(#)disklabel.c	8.4 (Berkeley) 5/4/95;
 /* from static char sccsid[] = @(#)disklabel.c	1.2 (Symmetric) 11/28/85; */
 #else
-__RCSID($NetBSD: main.c,v 1.32 2013/05/05 15:59:42 skrll Exp $);
+__RCSID($NetBSD: main.c,v 1.33 2013/05/13 17:58:50 christos Exp $);
 #endif
 #endif	/* not lint */
 
@@ -1835,6 +1835,12 @@ getasciilabel(FILE *f, struct disklabel 
 			errors++;
 			continue;
 		}
+		if (part = __arraycount(lp-d_partitions)) {
+			warnx(line %d: partition id %s, = %zu, lineno,
+			cp, __arraycount(lp-d_partitions));
+			errors++;
+			continue;
+		}
 		pp = lp-d_partitions[part];
 
 		NXTXNUM(pp-p_size);



CVS commit: src/sbin/disklabel

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 18:01:08 UTC 2013

Modified Files:
src/sbin/disklabel: main.c

Log Message:
CVE 1020933: Prevent integer overflow by using wider type


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sbin/disklabel/main.c

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

Modified files:

Index: src/sbin/disklabel/main.c
diff -u src/sbin/disklabel/main.c:1.33 src/sbin/disklabel/main.c:1.34
--- src/sbin/disklabel/main.c:1.33	Mon May 13 13:58:50 2013
+++ src/sbin/disklabel/main.c	Mon May 13 14:01:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.33 2013/05/13 17:58:50 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.34 2013/05/13 18:01:08 christos Exp $	*/
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@ __COPYRIGHT(@(#) Copyright (c) 1987, 19
 static char sccsid[] = @(#)disklabel.c	8.4 (Berkeley) 5/4/95;
 /* from static char sccsid[] = @(#)disklabel.c	1.2 (Symmetric) 11/28/85; */
 #else
-__RCSID($NetBSD: main.c,v 1.33 2013/05/13 17:58:50 christos Exp $);
+__RCSID($NetBSD: main.c,v 1.34 2013/05/13 18:01:08 christos Exp $);
 #endif
 #endif	/* not lint */
 
@@ -1136,7 +1136,7 @@ find_label(int f, u_int sector)
 {
 	struct disklabel *disk_lp, hlp;
 	int i;
-	u_int offset;
+	off_t offset;
 	const char *is_deleted;
 
 	bootarea_len = pread(f, bootarea, sizeof bootarea,
@@ -1172,19 +1172,19 @@ find_label(int f, u_int sector)
 			if (target32toh(disk_lp-d_magic) == DISKMAGIC_REV 
 			target32toh(disk_lp-d_magic2) == DISKMAGIC_REV)
 warnx(ignoring %sbyteswapped label
- at offset %u from sector %u,
+ at offset %td from sector %u,
 is_deleted, offset, sector);
 			continue;
 		}
 		if (target16toh(disk_lp-d_npartitions)  maxpartitions ||
 		dkcksum_target(disk_lp) != 0) {
 			if (verbose  0)
-warnx(corrupt label found at offset %u in 
+warnx(corrupt label found at offset %td in 
 sector %u, offset, sector);
 			continue;
 		}
 		if (verbose  1)
-			warnx(%slabel found at offset %u from sector %u,
+			warnx(%slabel found at offset %td from sector %u,
 			is_deleted, offset, sector);
 		if (!read_all)
 			return disk_lp;
@@ -1192,7 +1192,7 @@ find_label(int f, u_int sector)
 		/* To print all the labels we have to do it here */
 		/* XXX: maybe we should compare them? */
 		targettohlabel(hlp, disk_lp);
-		printf(# %ssector %u offset %u bytes\n,
+		printf(# %ssector %u offset %td bytes\n,
 		is_deleted, sector, offset);
 		if (tflag)
 			makedisktab(stdout, hlp);



CVS commit: src/sbin/savecore

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 18:44:11 UTC 2013

Modified Files:
src/sbin/savecore: savecore.c

Log Message:
- avoid using globals where it is simple.
- simplify: only use stdio for output.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sbin/savecore/savecore.c

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

Modified files:

Index: src/sbin/savecore/savecore.c
diff -u src/sbin/savecore/savecore.c:1.85 src/sbin/savecore/savecore.c:1.86
--- src/sbin/savecore/savecore.c:1.85	Sat Apr  7 12:44:10 2012
+++ src/sbin/savecore/savecore.c	Mon May 13 14:44:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: savecore.c,v 1.85 2012/04/07 16:44:10 christos Exp $	*/
+/*	$NetBSD: savecore.c,v 1.86 2013/05/13 18:44:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1992, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = @(#)savecore.c	8.5 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: savecore.c,v 1.85 2012/04/07 16:44:10 christos Exp $);
+__RCSID($NetBSD: savecore.c,v 1.86 2013/05/13 18:44:11 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -154,30 +154,32 @@ static long	panicstr;
 static char	vers[1024];
 static char	gzmode[3];
 
-static int	clear, compress, force, verbose;	/* flags */
-
 static void	check_kmem(void);
 static int	check_space(void);
 static void	clear_dump(void);
 static int	Create(char *, int);
-static int	dump_exists(void);
+static int	dump_exists(int);
 static char	*find_dev(dev_t, mode_t);
 static int	get_crashtime(void);
-static void	kmem_setup(void);
+static void	kmem_setup(int);
 static void	Lseek(int, off_t, int);
 static int	Open(const char *, int rw);
-static void	save_core(void);
+static void	save_core(int);
 __dead static void	usage(const char *fmt, ...) __printflike(1, 2);
 
 int
 main(int argc, char *argv[])
 {
-	int ch, level, testonly;
+	int ch, level, testonly, compress, force, clear, verbose;
 	char *ep;
 
 	kernel = NULL;
 	level = 1;		/* default to fastest gzip compression */
+	force = 0;
+	clear = 0;
 	testonly = 0;
+	verbose = 0;
+	compress = 0;
 	gzmode[0] = 'w';
 
 	openlog(savecore, LOG_PERROR, LOG_DAEMON);
@@ -224,14 +226,14 @@ main(int argc, char *argv[])
 	gzmode[1] = level + '0';
 
 	(void)time(now);
-	kmem_setup();
+	kmem_setup(verbose);
 
 	if (clear  !testonly) {
 		clear_dump();
 		exit(0);
 	}
 
-	if (!dump_exists()  !force)
+	if (!dump_exists(verbose)  !force)
 		exit(1);
 
 	if (testonly)
@@ -248,14 +250,14 @@ main(int argc, char *argv[])
 	if ((!get_crashtime() || !check_space())  !force)
 		exit(1);
 
-	save_core();
+	save_core(compress);
 
 	clear_dump();
 	exit(0);
 }
 
 static void
-kmem_setup(void)
+kmem_setup(int verbose)
 {
 	kvm_t *kd_kern;
 	char errbuf[_POSIX2_LINE_MAX];
@@ -473,7 +475,7 @@ nomsguf:
 }
 
 static int
-dump_exists(void)
+dump_exists(int verbose)
 {
 	u_int32_t newdumpmag;
 
@@ -516,16 +518,13 @@ clear_dump(void)
 static char buf[1024 * 1024];
 
 static void
-save_kernel(int ofd, FILE *fp, char *path)
+save_kernel(FILE *fp, char *path)
 {
 	int nw, nr, ifd;
 
 	ifd = Open(kernel, O_RDONLY);
 	while ((nr = read(ifd, buf, sizeof(buf)))  0) {
-		if (compress)
-			nw = fwrite(buf, 1, nr, fp);
-		else
-			nw = write(ofd, buf, nr);
+		nw = fwrite(buf, 1, nr, fp);
 		if (nw != nr) {
 			syslog(LOG_ERR, %s: %s,
 			path, strerror(nw == 0 ? EIO : errno));
@@ -553,7 +552,7 @@ ksymsget(u_long addr, void *ptr, size_t 
 }
 
 static int
-save_ksyms(int ofd, FILE *fp, char *path)
+save_ksyms(FILE *fp, char *path)
 {
 	struct ksyms_hdr khdr;
 	int nw, symsz, strsz;
@@ -579,10 +578,7 @@ save_ksyms(int ofd, FILE *fp, char *path
 	khdr.kh_shdr[STRTAB].sh_size = strsz;
 
 	/* Write out the ELF headers. */
-	if (compress)
-		nw = fwrite(khdr, 1, sizeof(khdr), fp);
-	else
-		nw = write(ofd, khdr, sizeof(khdr));
+	nw = fwrite(khdr, 1, sizeof(khdr), fp);
 	if (nw != sizeof(khdr)) {
 		syslog(LOG_ERR, %s: %s,
 		path, strerror(nw == 0 ? EIO : errno));
@@ -605,10 +601,7 @@ save_ksyms(int ofd, FILE *fp, char *path
 			free(p);
 			return 1;
 		}
-		if (compress)
-			nw = fwrite(p, 1, st.sd_symsize, fp);
-		else
-			nw = write(ofd, p, st.sd_symsize);
+		nw = fwrite(p, 1, st.sd_symsize, fp);
 		free(p);
 		if (nw != st.sd_symsize) {
 			syslog(LOG_ERR, %s: %s,
@@ -633,10 +626,7 @@ save_ksyms(int ofd, FILE *fp, char *path
 			free(p);
 			return 1;
 		}
-		if (compress)
-			nw = fwrite(p, 1, st.sd_strsize, fp);
-		else
-			nw = write(ofd, p, st.sd_strsize);
+		nw = fwrite(p, 1, st.sd_strsize, fp);
 		free(p);
 		if (nw != st.sd_strsize) {
 			syslog(LOG_ERR, %s: %s,
@@ -651,7 +641,7 @@ save_ksyms(int ofd, FILE *fp, char *path
 }
 
 static void
-save_core(void)
+save_core(int compress)
 {
 	FILE *fp;
 	int bounds, ifd, nr, nw, ofd, tryksyms;
@@ -768,25 +758,25 @@ err2:			syslog(LOG_WARNING,
 syslog(LOG_ERR, %s: %m, path);
 exit(1);
 			}
-		} else
+		} else {
 			ofd = Create(path, S_IRUSR | 

CVS commit: src/sys/dev/pci

2013-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 14 00:27:39 UTC 2013

Modified Files:
src/sys/dev/pci: if_bgereg.h

Log Message:
Add some definitions.
Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/if_bgereg.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_bgereg.h
diff -u src/sys/dev/pci/if_bgereg.h:1.77 src/sys/dev/pci/if_bgereg.h:1.78
--- src/sys/dev/pci/if_bgereg.h:1.77	Wed May  8 07:50:28 2013
+++ src/sys/dev/pci/if_bgereg.h	Tue May 14 00:27:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bgereg.h,v 1.77 2013/05/08 07:50:28 msaitoh Exp $	*/
+/*	$NetBSD: if_bgereg.h,v 1.78 2013/05/14 00:27:39 msaitoh Exp $	*/
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -1102,6 +1102,10 @@
 #define BGE_RXLPSTAT_MAPOUTRANGE_ATTN	0x0008
 #define BGE_RXLPSTAT_STATSOFLOW_ATTN	0x0010
 
+/* Receive List Placement Statistics Enable Mask register */
+#define BGE_RXLPSTATCONTROL_DACK_FIX	0x0004
+#define BGE_RXLPSTATCONTROL_LBIRST_FIX	0x0040
+
 /*
  * Receive Data and Receive BD Initiator Control Registers
  */



CVS commit: src/crypto/external/bsd/openssh/dist

2013-05-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue May 14 05:18:11 UTC 2013

Modified Files:
src/crypto/external/bsd/openssh/dist: readconf.c

Log Message:
The previous patch didn't apply cleanly, because our code doesn't
use #ifdef OPENSSL_HAS_ECC.
Apply manually.
Drop now unused len variable.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/crypto/external/bsd/openssh/dist/readconf.c

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/openssh/dist/readconf.c
diff -u src/crypto/external/bsd/openssh/dist/readconf.c:1.9 src/crypto/external/bsd/openssh/dist/readconf.c:1.10
--- src/crypto/external/bsd/openssh/dist/readconf.c:1.9	Mon Apr 29 17:59:50 2013
+++ src/crypto/external/bsd/openssh/dist/readconf.c	Tue May 14 05:18:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: readconf.c,v 1.9 2013/04/29 17:59:50 mlelstv Exp $	*/
+/*	$NetBSD: readconf.c,v 1.10 2013/05/14 05:18:11 mlelstv Exp $	*/
 /* $OpenBSD: readconf.c,v 1.196 2013/02/22 04:45:08 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen y...@cs.hut.fi
@@ -14,7 +14,7 @@
  */
 
 #include includes.h
-__RCSID($NetBSD: readconf.c,v 1.9 2013/04/29 17:59:50 mlelstv Exp $);
+__RCSID($NetBSD: readconf.c,v 1.10 2013/05/14 05:18:11 mlelstv Exp $);
 #include sys/types.h
 #include sys/stat.h
 #include sys/socket.h
@@ -1334,8 +1334,6 @@ initialize_options(Options * options)
 void
 fill_default_options(Options * options)
 {
-	int len;
-
 	if (options-forward_agent == -1)
 		options-forward_agent = 0;
 	if (options-forward_x11 == -1)
@@ -1413,30 +1411,16 @@ fill_default_options(Options * options)
 		options-protocol = SSH_PROTO_2;
 	if (options-num_identity_files == 0) {
 		if (options-protocol  SSH_PROTO_1) {
-			len = 2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1;
-			options-identity_files[options-num_identity_files] =
-			xmalloc(len);
-			snprintf(options-identity_files[options-num_identity_files++],
-			len, ~/%.100s, _PATH_SSH_CLIENT_IDENTITY);
+			add_identity_file(options, ~/,
+			_PATH_SSH_CLIENT_IDENTITY, 0);
 		}
 		if (options-protocol  SSH_PROTO_2) {
-			len = 2 + strlen(_PATH_SSH_CLIENT_ID_RSA) + 1;
-			options-identity_files[options-num_identity_files] =
-			xmalloc(len);
-			snprintf(options-identity_files[options-num_identity_files++],
-			len, ~/%.100s, _PATH_SSH_CLIENT_ID_RSA);
-
-			len = 2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1;
-			options-identity_files[options-num_identity_files] =
-			xmalloc(len);
-			snprintf(options-identity_files[options-num_identity_files++],
-			len, ~/%.100s, _PATH_SSH_CLIENT_ID_DSA);
-
-			len = 2 + strlen(_PATH_SSH_CLIENT_ID_ECDSA) + 1;
-			options-identity_files[options-num_identity_files] =
-			xmalloc(len);
-			snprintf(options-identity_files[options-num_identity_files++],
-			len, ~/%.100s, _PATH_SSH_CLIENT_ID_ECDSA);
+			add_identity_file(options, ~/,
+			_PATH_SSH_CLIENT_ID_RSA, 0);
+			add_identity_file(options, ~/,
+			_PATH_SSH_CLIENT_ID_DSA, 0);
+			add_identity_file(options, ~/,
+			_PATH_SSH_CLIENT_ID_ECDSA, 0);
 		}
 	}
 	if (options-escape_char == -1)