CVS commit: src/common/lib/libc/arch/arm/string

2013-01-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 15 08:52:27 UTC 2013

Added Files:
src/common/lib/libc/arch/arm/string: strrchr_arm.S

Log Message:
Add ARM optimized version of strrchr.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/arm/string/strrchr_arm.S

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

Added files:

Index: src/common/lib/libc/arch/arm/string/strrchr_arm.S
diff -u /dev/null src/common/lib/libc/arch/arm/string/strrchr_arm.S:1.1
--- /dev/null	Tue Jan 15 08:52:27 2013
+++ src/common/lib/libc/arch/arm/string/strrchr_arm.S	Tue Jan 15 08:52:27 2013
@@ -0,0 +1,145 @@
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 machine/asm.h
+
+RCSID($NetBSD: strrchr_arm.S,v 1.1 2013/01/15 08:52:27 matt Exp $)
+
+#ifdef __ARMEL__
+#define	BYTE0	0x00ff
+#define	BYTE1	0xff00
+#define	BYTE2	0x00ff
+#define	BYTE3	0xff00
+#define	lshi	lsl
+#else
+#define	BYTE0	0xff00
+#define	BYTE1	0x00ff
+#define	BYTE2	0xff00
+#define	BYTE3	0x00ff
+#define	lshi	lsr
+#endif
+
+	.text
+ENTRY(strrchr)
+	mov	ip, r0			/* we use r0 at the return value */
+	mov	r0, #0			/* return NULL by default */
+	and	r2, r1, #0xff		/* restrict to byte value */
+1:	tst	ip, #3			/* test for word alignment */
+	beq	.Lpre_main_loop		/*   finally word aligned */
+	ldrb	r3, [ip], #1		/* load a byte */
+	cmp	r3, r2			/* did it match? */
+	subeq	r0, ip, #1		/*   yes, remember that it did */
+	teq	r3, #0			/* was it NUL? */
+	bne	1b			/*   no, try next byte */
+	RET/* return */
+.Lpre_main_loop:
+	push	{r4, r5}		/* save some registers */
+#if defined(_ARM_ARCH_7)
+	movw	r1, #0xfefe		/* magic constant; 254 in each byte */
+	movt	r1, #0xfefe		/* magic constant; 254 in each byte */
+#elif defined(_ARM_ARCH_6)
+	mov	r1, #0xfe		/* put 254 in low byte */
+	orr	r1, r1, r1, lsl #8	/* move to next byte */
+	orr	r1, r1, r1, lsl #16	/* move to next halfword */
+#endif /* _ARM_ARCH_6 */
+	orr	r2, r2, r2, lsl #8	/* move to next byte */
+	orr	r2, r2, r2, lsl #16	/* move to next halfword */
+.Lmain_loop:
+	ldr	r3, [ip], #4		/* load next word */
+#if defined(_ARM_ARCH_6)
+	/*
+	 * Add 254 to each byte using the UQADD8 (unsigned saturating add 8)
+	 * instruction.  For every non-NUL byte, the result for that byte will
+	 * become 255.  For NUL, it will be 254.  When we complement the
+	 * result, if the result is non-0 then we must have encountered a NUL.
+	 */
+	uqadd8	r4, r3, r1		/* NUL detection happens here */
+	usub8	r3, r3, r2		/* bias for char looked for? */
+	uqadd8	r5, r3, r1		/* char detection happens here */
+	and	r3, r4, r5		/* merge results */
+	mvns	r3, r3			/* is the complement non-0? */
+	beq	.Lmain_loop		/*   no, then keep going */
+
+	mvns	r5, r5			/* get we find any matching bytes? */
+	beq	.Ldone			/*   no, then we hit the end, return */
+	mvns	r4, r4			/* did we encounter a NUL? */
+	beq	.Lfind_match		/*   no, find matching byte */
+	/*
+	 * Copy the NUL bit to the following byte lanes.  Then clear any match
+	 * bits in those byte lanes to prevent false positives in those bytes.
+	 */
+	movs	r3, r4, lshi #8		/* shift up a byte */
+	orrnes	r3, r3, r3, lshi #8	/* if non 0, copy up to next byte */
+	orrnes	r3, r3, r3, lshi #8	/* if non 0, copy up to last byte */
+	bics	r5, r5, r3		/* clear match bits */
+	beq	.Ldone			/*   no remaining matches, we're done */
+.Lfind_match:
+#ifdef __ARMEL__
+	rev	r5, r5			/* we want this 

CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-15 Thread Thomas Klausner
Module Name:othersrc
Committed By:   wiz
Date:   Tue Jan 15 09:05:57 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: netwdiff.1

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/netwdiff.1

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/netdiff/dist/netwdiff.1
diff -u othersrc/external/bsd/netdiff/dist/netwdiff.1:1.4 othersrc/external/bsd/netdiff/dist/netwdiff.1:1.5
--- othersrc/external/bsd/netdiff/dist/netwdiff.1:1.4	Tue Jan 15 08:26:16 2013
+++ othersrc/external/bsd/netdiff/dist/netwdiff.1	Tue Jan 15 09:05:57 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: netwdiff.1,v 1.4 2013/01/15 08:26:16 agc Exp $
+.\ $NetBSD: netwdiff.1,v 1.5 2013/01/15 09:05:57 wiz Exp $
 .\
 .\ Copyright (c) 2013 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -130,7 +130,7 @@ static int
 .Ed
 .Pp
 To use colors to highlight text which has been inserted and deleted,
-the 
+the
 .Fl w ,
 .Fl x ,
 .Fl y
@@ -139,7 +139,7 @@ and
 arguments can be used.
 In C shell, shell variables can be set in the following way:
 .Bd -literal
-% set ansi_red = `printf '\\e[31m'`   
+% set ansi_red = `printf '\\e[31m'`
 % set ansi_end = `printf '\\e[0m'`
 % set ansi_green = `printf '\\e[32m'`
 .Ed



CVS commit: src/sys/arch/vax/vax

2013-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 10:18:38 UTC 2013

Modified Files:
src/sys/arch/vax/vax: syscall.c

Log Message:
Make this compile with TRAPDEBUG enabled.
Pointed out by Holm Tiffe.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/vax/vax/syscall.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/vax/vax/syscall.c
diff -u src/sys/arch/vax/vax/syscall.c:1.21 src/sys/arch/vax/vax/syscall.c:1.22
--- src/sys/arch/vax/vax/syscall.c:1.21	Sun Feb 19 21:06:33 2012
+++ src/sys/arch/vax/vax/syscall.c	Tue Jan 15 10:18:38 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.21 2012/02/19 21:06:33 rmind Exp $ */
+/*	$NetBSD: syscall.c,v 1.22 2013/01/15 10:18:38 martin Exp $ */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -33,7 +33,7 @@
  /* All bugs are subject to removal without further notice */
 		
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.21 2012/02/19 21:06:33 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.22 2013/01/15 10:18:38 martin Exp $);
 
 #include opt_multiprocessor.h
 
@@ -77,7 +77,7 @@ syscall(struct trapframe *tf)
 
 	TDB((trap syscall %s pc %lx, psl %lx, sp %lx, pid %d, frame %p\n,
 	syscallnames[tf-tf_code], tf-tf_pc, tf-tf_psl,tf-tf_sp,
-	p-p_pid,frame));
+	p-p_pid,tf));
 
 	curcpu()-ci_data.cpu_nsyscall++;
  
@@ -111,7 +111,7 @@ syscall(struct trapframe *tf)
 
 	TDB((return %s pc %lx, psl %lx, sp %lx, pid %d, err %d r0 %d, r1 %d, 
 	tf %p\n, syscallnames[tf-tf_code], tf-tf_pc, tf-tf_psl,
-	tf-tf_sp, p-p_pid, error, rval[0], rval[1], exptr));
+	tf-tf_sp, p-p_pid, error, rval[0], rval[1], tf));
 bad:
 	switch (error) {
 	case 0:



CVS commit: src/sys/dev/usb

2013-01-15 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Tue Jan 15 10:41:57 UTC 2013

Modified Files:
src/sys/dev/usb: ehci.c

Log Message:
Fix a debug printf format.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/dev/usb/ehci.c

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

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.200 src/sys/dev/usb/ehci.c:1.201
--- src/sys/dev/usb/ehci.c:1.200	Tue Jan 15 04:02:56 2013
+++ src/sys/dev/usb/ehci.c	Tue Jan 15 10:41:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.200 2013/01/15 04:02:56 christos Exp $ */
+/*	$NetBSD: ehci.c,v 1.201 2013/01/15 10:41:57 mbalmer Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.200 2013/01/15 04:02:56 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.201 2013/01/15 10:41:57 mbalmer Exp $);
 
 #include ohci.h
 #include uhci.h
@@ -2783,8 +2783,8 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *
 panic(ehci_alloc_sqtd_chain: curlen == 0);
 #endif
 		}
-		DPRINTFN(4,(ehci_alloc_sqtd_chain: len=%d curlen=%zu 
-			curoffs=%d\n, len, curlen, (size_t)curoffs));
+		DPRINTFN(4,(ehci_alloc_sqtd_chain: len=%d curlen=%d 
+			curoffs=%ld\n, len, curlen, (size_t)curoffs));
 
 		/*
 		 * Allocate another transfer if there's more data left,



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

2013-01-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Jan 15 13:30:12 UTC 2013

Modified Files:
src/sys/arch/ia64/include: asm.h

Log Message:
Add macro _C_LABEL() for .S file.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/include/asm.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/ia64/include/asm.h
diff -u src/sys/arch/ia64/include/asm.h:1.5 src/sys/arch/ia64/include/asm.h:1.6
--- src/sys/arch/ia64/include/asm.h:1.5	Thu Dec 27 06:29:50 2012
+++ src/sys/arch/ia64/include/asm.h	Tue Jan 15 13:30:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.5 2012/12/27 06:29:50 martin Exp $	*/
+/*	$NetBSD: asm.h,v 1.6 2013/01/15 13:30:12 kiyohara Exp $	*/
 
 /* -
  * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@@ -34,6 +34,8 @@
  *	a debugger are also noted.
  */
 
+#define _C_LABEL(x)	x
+
 /*
  * Macro to make a local label name.
  */



CVS commit: src/sys/arch/ia64/ia64

2013-01-15 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Jan 15 13:43:27 UTC 2013

Modified Files:
src/sys/arch/ia64/ia64: context.S

Log Message:
cpu_switchto() returns argument oldlwp.  Not ci-ci_curlwp.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/ia64/ia64/context.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/ia64/ia64/context.S
diff -u src/sys/arch/ia64/ia64/context.S:1.3 src/sys/arch/ia64/ia64/context.S:1.4
--- src/sys/arch/ia64/ia64/context.S:1.3	Fri Nov 27 03:23:10 2009
+++ src/sys/arch/ia64/ia64/context.S	Tue Jan 15 13:43:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: context.S,v 1.3 2009/11/27 03:23:10 rmind Exp $	*/
+/*	$NetBSD: context.S,v 1.4 2013/01/15 13:43:27 kiyohara Exp $	*/
 	
 /*
  * Copyright (c) 2003 Marcel Moolenaar
@@ -28,7 +28,6 @@
  * $FreeBSD: src/sys/ia64/ia64/context.S,v 1.3 2003/07/02 12:57:07 ru Exp $
  */
 
-#include sys/cdefs.h
 #include machine/asm.h
 #include assym.h
 
@@ -831,13 +830,19 @@ ENTRY(cpu_switchto, 3)
 	mov		loc1=rp			// save rp (loc1 = rp)
 	;;
 }
+{	.mmi
+	st8		[r14]=in1		// ci-ci_curlwp = newlwp
+	mov		r9=in0			// r9 = oldlwp
+	nop		0
+	;;
+}
 {	.mmb
+	nop		0
 	/*
 	 * Switch to new context, if p6 == true.
 	 * We assum to return to restorectx_return_here for swapped context.
 	 */
-(p6)	ld8		out0=[r3]		// if (p6) out0 = pcb of newlwp
-	xchg8		r9=[r14],in1		// ci-ci_curlwp = newlwp
+(p6)	ld8		out0=[r3]		// out0 = pcb of newlwp
 (p6)	br.call.sptk.many rp=restorectx		// if (p6) restorectx(out0)
 	;;
 }



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

2013-01-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 15 13:52:27 UTC 2013

Modified Files:
src/sys/arch/evbarm/conf: BEAGLEBOARD

Log Message:
add kernfs and procfs, support BEAGLEBOARD.local


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/evbarm/conf/BEAGLEBOARD

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/conf/BEAGLEBOARD
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARD:1.41 src/sys/arch/evbarm/conf/BEAGLEBOARD:1.42
--- src/sys/arch/evbarm/conf/BEAGLEBOARD:1.41	Fri Jan 11 09:45:53 2013
+++ src/sys/arch/evbarm/conf/BEAGLEBOARD	Tue Jan 15 13:52:26 2013
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARD,v 1.41 2013/01/11 09:45:53 he Exp $
+#	$NetBSD: BEAGLEBOARD,v 1.42 2013/01/15 13:52:26 jmcneill Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -35,9 +35,9 @@ file-system	NFS		# Network file system
 #file-system	CD9660		# ISO 9660 + Rock Ridge file system
 file-system	MSDOSFS		# MS-DOS file system
 #file-system	FDESC		# /dev/fd
-#file-system	KERNFS		# /kern
+file-system	KERNFS		# /kern
 #file-system	NULLFS		# loopback file system
-#file-system	PROCFS		# /proc
+file-system	PROCFS		# /proc
 #file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g  sshfs)
 #file-system	UMAPFS		# NULLFS + uid and gid remapping
 #file-system	UNION		# union file system
@@ -325,3 +325,5 @@ pseudo-device	pty			# pseudo-terminals
 #pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device	ksyms			# /dev/ksyms
 pseudo-device	lockstat		# lock profiling
+
+cinclude arch/evbarm/conf/BEAGLEBOARD.local



CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-15 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jan 15 15:54:53 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: diffreg.c netdiff.1

Log Message:
Remove support for -l option which piped output through pr(1). Not really
useful in 2013, and gets rid of a fork()/exec() in a library function.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/netdiff.1

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/netdiff/dist/diffreg.c
diff -u othersrc/external/bsd/netdiff/dist/diffreg.c:1.9 othersrc/external/bsd/netdiff/dist/diffreg.c:1.10
--- othersrc/external/bsd/netdiff/dist/diffreg.c:1.9	Tue Jan 15 08:26:16 2013
+++ othersrc/external/bsd/netdiff/dist/diffreg.c	Tue Jan 15 15:54:52 2013
@@ -100,7 +100,6 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/stat.h
 #include sys/mman.h
-#include sys/wait.h
 
 #include ctype.h
 #include err.h
@@ -1772,12 +1771,10 @@ istextfile(diff_t *diff, file_t *f)
 
 /* common function to perform the diff, and display output */
 static int
-diffit(diff_t *diff, file_t *f, stone_t *s, int flags, int allow_pr)
+diffit(diff_t *diff, file_t *f, stone_t *s, int flags)
 {
 	size_t	 sz;
-	pid_t	 pid = -1;
 	int	 rval = D_SAME;
-	int	 ostdout = -1;
 	int	 i;
 
 	switch (files_differ(diff, f, flags)) {
@@ -1795,49 +1792,6 @@ diffit(diff_t *diff, file_t *f, stone_t 
 		diff-status |= 1;
 		goto closem;
 	}
-	if (allow_pr  DIFF_GET_FLAG(diff, 'l')) {
-		/* redirect stdout to pr */
-		int	 pfd[2];
-		char	*header;
-		const char	*prargv[] = { pr, -h, NULL, -f, NULL };
-
-		if (asprintf(header, %s %s %s, diff-diffargs, f[0].name, f[1].name)  0) {
-			warn(diffargs header %s, header);
-			diff-status |= 2;
-			goto closem;
-		}
-		prargv[2] = header;
-		fflush(stdout);
-		rewind(stdout);
-		pipe(pfd);
-		switch ((pid = fork())) {
-		case -1:
-			warnx(No more processes);
-			diff-status |= 2;
-			free(header);
-			return D_ERROR;
-		case 0:
-			/* child */
-			if (pfd[0] != STDIN_FILENO) {
-dup2(pfd[0], STDIN_FILENO);
-close(pfd[0]);
-			}
-			close(pfd[1]);
-			execv(_PATH_PR, __UNCONST(prargv));
-			_exit(127);
-			/*FALLTHROUGH*/
-		default:
-			/* parent */
-			if (pfd[1] != STDOUT_FILENO) {
-ostdout = dup(STDOUT_FILENO);
-dup2(pfd[1], STDOUT_FILENO);
-close(pfd[1]);
-			}
-			close(pfd[0]);
-			rewind(stdout);
-			free(header);
-		}
-	}
 	prepare(diff, f[0], diff-st[0].st_size);
 	prepare(diff, f[1], diff-st[1].st_size);
 	prune(s, f);
@@ -1897,19 +1851,6 @@ diffit(diff_t *diff, file_t *f, stone_t 
 	output(diff, s, f, (flags  D_HEADER));
 	free(f[0].offsets);
 	free(f[1].offsets);
-	if (ostdout != -1) {
-		int wstatus;
-
-		/* close the pipe to pr and restore stdout */
-		fflush(stdout);
-		rewind(stdout);
-		if (ostdout != STDOUT_FILENO) {
-			close(STDOUT_FILENO);
-			dup2(ostdout, STDOUT_FILENO);
-			close(ostdout);
-		}
-		waitpid(pid, wstatus, 0);
-	}
 closem:
 	if (s-changec) {
 		diff-status |= 1;
@@ -2229,7 +2170,7 @@ diff_file(diff_t *diff, const char *ofil
 		diff-status |= 2;
 		return D_MISMATCH1;
 	}
-	return diffit(diff, f, s, flags, 1);
+	return diffit(diff, f, s, flags);
 }
 
 /* compare two areas of memory */
@@ -2263,7 +2204,7 @@ diff_mem(diff_t *diff, const char *m1, s
 	s.context_vec_ptr = s.context_vec_start - 1;
 	setupmem(f[0], diff-st[0], m1, size1);
 	setupmem(f[1], diff-st[1], m2, size2);
-	return diffit(diff, f, s, flags, 0);
+	return diffit(diff, f, s, flags);
 }
 
 /* word diff two files */

Index: othersrc/external/bsd/netdiff/dist/netdiff.1
diff -u othersrc/external/bsd/netdiff/dist/netdiff.1:1.2 othersrc/external/bsd/netdiff/dist/netdiff.1:1.3
--- othersrc/external/bsd/netdiff/dist/netdiff.1:1.2	Thu Jan 10 08:51:28 2013
+++ othersrc/external/bsd/netdiff/dist/netdiff.1	Tue Jan 15 15:54:52 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: netdiff.1,v 1.2 2013/01/10 08:51:28 wiz Exp $
+.\	$NetBSD: netdiff.1,v 1.3 2013/01/15 15:54:52 agc Exp $
 .\	$FreeBSD$
 .\	$OpenBSD: diff.1,v 1.33 2007/05/31 19:20:09 jmc Exp $
 .\
@@ -31,7 +31,7 @@
 .\
 .\ @(#)diff.1	8.1 (Berkeley) 6/30/93
 .\
-.Dd April 7, 2008
+.Dd January 15, 2013
 .Dt DIFF 1
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Nd differential file and directory comparator
 .Sh SYNOPSIS
 .Nm diff
-.Op Fl abdilpqTtw
+.Op Fl abdipqTtw
 .Op Fl I Ar pattern
 .Oo
 .Fl c | e | f |
@@ -228,14 +228,6 @@ Print
 .Ar label
 instead of the first (and second, if this option is specified twice)
 file name and time in the context or unified diff header.
-.It Fl l , Fl Fl paginate
-Long output format; each text file
-.Nm diff Ns \'d
-is piped through
-.Xr pr 1
-to paginate it;
-other differences are remembered and summarized
-after all text file differences are reported.
 .It Fl p , Fl Fl show-c-function
 With unified and context diffs, show with each change
 the 

CVS commit: src/common/lib/libc/arch/arm/string

2013-01-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 15 16:52:35 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/string: strchr_arm.S

Log Message:
Fix case when searching for NUL.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/strchr_arm.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/string/strchr_arm.S
diff -u src/common/lib/libc/arch/arm/string/strchr_arm.S:1.1 src/common/lib/libc/arch/arm/string/strchr_arm.S:1.2
--- src/common/lib/libc/arch/arm/string/strchr_arm.S:1.1	Tue Jan 15 02:04:04 2013
+++ src/common/lib/libc/arch/arm/string/strchr_arm.S	Tue Jan 15 16:52:35 2013
@@ -29,7 +29,7 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: strchr_arm.S,v 1.1 2013/01/15 02:04:04 matt Exp $)
+RCSID($NetBSD: strchr_arm.S,v 1.2 2013/01/15 16:52:35 matt Exp $)
 
 #ifdef __ARMEL__
 #define	BYTE0	0x00ff
@@ -92,8 +92,6 @@ ENTRY(strchr)
 	 */
 	mvns	ip, ip			/* did we encounter a NUL? */
 	beq	.Lfind_match		/*   no, find the match */
-	eors	r3, r3, ip		/* remove NUL bit */
-	beq	.Lnomatch		/*   if no other bits, no match */
 	movs	ip, ip, lshi #8		/* replicate NUL bit to other bytes */
 	orrne	ip, ip, lshi #8		/* replicate NUL bit to other bytes */
 	orrne	ip, ip, lshi #8		/* replicate NUL bit to other bytes */
@@ -128,27 +126,30 @@ ENTRY(strchr)
 
 	sub	r2, r0, #4		/* un post-inc */
 	mov	r0, #0			/* assume no match */
-	tst	r3, #BYTE0		/* is this byte NUL? */
-	RETc(eq)			/*   yes, return NULL */
+
 	tst	ip, #BYTE0		/* does this byte match? */
 	moveq	r0, r2			/*   yes, point to it */
 	RETc(eq)			/*and return */
-	tst	r3, #BYTE1		/* is this byte NUL? */
+	tst	r3, #BYTE0		/* is this byte NUL? */
 	RETc(eq)			/*   yes, return NULL */
+
 	tst	ip, #BYTE1		/* does this byte match? */
 	addeq	r0, r2, #1		/*   yes, point to it */
 	RETc(eq)			/*and return */
-	tst	r3, #BYTE2		/* is this byte NUL? */
+	tst	r3, #BYTE1		/* is this byte NUL? */
 	RETc(eq)			/*   yes, return NULL */
+
 	tst	ip, #BYTE2		/* does this byte match? */
 	addeq	r0, r2, #2		/*   yes, point to it */
 	RETc(eq)			/*and return */
-	tst	r3, #BYTE3		/* is this byte NUL? */
+	tst	r3, #BYTE2		/* is this byte NUL? */
 	RETc(eq)			/*   yes, return NULL */
+
+	tst	ip, #BYTE3		/* does this byte match? */
+	addeq	r0, r2, #3		/*   yes, point to it */
 	/*
 	 * Since no NULs and no matches this must be the only case left.
 	 */
-	add	r0, r2, #3		/* point to it */
 	RET/* return */
 #endif /* _ARM_ARCH_6 */
 END(strchr)



CVS commit: src/sys/compat/netbsd32

2013-01-15 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Jan 15 17:14:11 UTC 2013

Modified Files:
src/sys/compat/netbsd32: netbsd32_execve.c

Log Message:
netbsd32_posix_spawn_fa_alloc: use the right length for path allocation.

This error lead to memory pool corruption when freeing kmem with wrong size.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/compat/netbsd32/netbsd32_execve.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/compat/netbsd32/netbsd32_execve.c
diff -u src/sys/compat/netbsd32/netbsd32_execve.c:1.36 src/sys/compat/netbsd32/netbsd32_execve.c:1.37
--- src/sys/compat/netbsd32/netbsd32_execve.c:1.36	Wed May  2 23:33:11 2012
+++ src/sys/compat/netbsd32/netbsd32_execve.c	Tue Jan 15 17:14:11 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_execve.c,v 1.36 2012/05/02 23:33:11 rmind Exp $	*/
+/*	$NetBSD: netbsd32_execve.c,v 1.37 2013/01/15 17:14:11 hannken Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: netbsd32_execve.c,v 1.36 2012/05/02 23:33:11 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_execve.c,v 1.37 2013/01/15 17:14:11 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -141,7 +141,7 @@ netbsd32_posix_spawn_fa_alloc(struct pos
 		MAXPATHLEN, slen);
 		if (error)
 			goto out;
-		fae-fae_path = kmem_alloc(fal, KM_SLEEP);
+		fae-fae_path = kmem_alloc(slen, KM_SLEEP);
 		memcpy(fae-fae_path, pbuf, slen);
 		fae-fae_oflag = f32-fae_oflag;
 		fae-fae_mode = f32-fae_mode;



CVS commit: src/sys/arch/luna68k/luna68k

2013-01-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 15 17:23:39 UTC 2013

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

Log Message:
Make the default disklabel (for disks without label) have saner value.
I.e. use d_secperunit for RAW_PART rather than 0x1fff for part a.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/luna68k/luna68k/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/luna68k/luna68k/disksubr.c
diff -u src/sys/arch/luna68k/luna68k/disksubr.c:1.29 src/sys/arch/luna68k/luna68k/disksubr.c:1.30
--- src/sys/arch/luna68k/luna68k/disksubr.c:1.29	Mon Oct 26 19:16:56 2009
+++ src/sys/arch/luna68k/luna68k/disksubr.c	Tue Jan 15 17:23:39 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.29 2009/10/26 19:16:56 cegger Exp $ */
+/* $NetBSD: disksubr.c,v 1.30 2013/01/15 17:23:39 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -103,7 +103,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.29 2009/10/26 19:16:56 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: disksubr.c,v 1.30 2013/01/15 17:23:39 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -180,14 +180,20 @@ readdisklabel(dev_t dev, void (*strat)(s
 	struct disklabel *dlp;
 	struct sun_disklabel *slp;
 	int error;
+	int i;
 
 	/* minimal requirements for archtypal disk label */
 	if (lp-d_secperunit == 0)
 		lp-d_secperunit = 0x1fff;
-	lp-d_npartitions = 1;
-	if (lp-d_partitions[0].p_size == 0)
-		lp-d_partitions[0].p_size = 0x1fff;
-	lp-d_partitions[0].p_offset = 0;
+	if (lp-d_npartitions  RAW_PART + 1)
+		lp-d_npartitions = RAW_PART + 1;
+	for (i = 0; i  RAW_PART; i++) {
+		lp-d_partitions[i].p_size = 0;
+		lp-d_partitions[i].p_offset = 0;
+	}
+	if (lp-d_partitions[RAW_PART].p_size == 0)
+		lp-d_partitions[RAW_PART].p_size = lp-d_secperunit;
+	lp-d_partitions[RAW_PART].p_offset = 0;
 
 	/* obtain buffer to probe drive with */
 	bp = geteblk((int)lp-d_secsize);



CVS commit: src/usr.bin/mail

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 17:25:42 UTC 2013

Modified Files:
src/usr.bin/mail: head.c

Log Message:
PR/47453: Martin Branderburg: Mail (mail, mailx) does not recognize messages
which have RFC 822 format dates.
XXX: Pullup 6


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/mail/head.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/mail/head.c
diff -u src/usr.bin/mail/head.c:1.22 src/usr.bin/mail/head.c:1.23
--- src/usr.bin/mail/head.c:1.22	Sat Dec  1 06:41:50 2012
+++ src/usr.bin/mail/head.c	Tue Jan 15 12:25:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: head.c,v 1.22 2012/12/01 11:41:50 mbalmer Exp $	*/
+/*	$NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)head.c	8.2 (Berkeley) 4/20/95;
 #else
-__RCSID($NetBSD: head.c,v 1.22 2012/12/01 11:41:50 mbalmer Exp $);
+__RCSID($NetBSD: head.c,v 1.23 2013/01/15 17:25:42 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -52,7 +52,7 @@ __RCSID($NetBSD: head.c,v 1.22 2012/12/
  * Return 1 if they match, 0 if they don't
  */
 static int
-cmatch(const char *cp, char *tp)
+cmatch(const char *cp, const char *tp)
 {
 
 	while (*cp  *tp)
@@ -86,6 +86,11 @@ cmatch(const char *cp, char *tp)
 			if (*cp++ != '\n')
 return 0;
 			break;
+		case '+':
+			if (*cp != '+'  *cp != '-')
+return 0;
+			cp++;
+			break;
 		}
 	if (*cp || *tp)
 		return 0;
@@ -108,19 +113,25 @@ cmatch(const char *cp, char *tp)
  * 'O'	An optional digit or space
  * ':'	A colon
  * 'N'	A new line
+ * '+'	A plus or minus sign
  */
-static char ctype[] = Aaa Aaa O0 00:00:00 ;
-static char SysV_ctype[] = Aaa Aaa O0 00:00 ;
-static char tmztype[] = Aaa Aaa O0 00:00:00 AAA ;
-static char SysV_tmztype[] = Aaa Aaa O0 00:00 AAA ;
+static const char *datetypes[] = {
+ 	Aaa Aaa O0 00:00:00 ,		/* BSD ctype */
+	Aaa Aaa O0 00:00 ,		/* SysV ctype */
+	Aaa Aaa O0 00:00:00 AAA ,		/* BSD tmztype */
+	Aaa Aaa O0 00:00 AAA ,		/* SysV tmztype */
+	Aaa Aaa O0 00:00:00  +,	/* RFC822 type */
+	Aaa Aaa O0 00:00:00  AAA,		/* RFC822 alttype */
+};
 
 static int
 isdate(const char date[])
 {
 
-	return cmatch(date, ctype) ||
-	   cmatch(date, tmztype) ||
-	   cmatch(date, SysV_tmztype) || cmatch(date, SysV_ctype);
+	for (size_t i = 0; i  __arraycount(datetypes); i++)
+		if (cmatch(date, datetypes[i]))
+			return 1;
+	return 0;
 }
 
 static void



CVS commit: src/sys/dev/usb

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 17:45:06 UTC 2013

Modified Files:
src/sys/dev/usb: ehci.c

Log Message:
fix the fix of the fix of the format string.


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/dev/usb/ehci.c

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

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.201 src/sys/dev/usb/ehci.c:1.202
--- src/sys/dev/usb/ehci.c:1.201	Tue Jan 15 05:41:57 2013
+++ src/sys/dev/usb/ehci.c	Tue Jan 15 12:45:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.201 2013/01/15 10:41:57 mbalmer Exp $ */
+/*	$NetBSD: ehci.c,v 1.202 2013/01/15 17:45:05 christos Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.201 2013/01/15 10:41:57 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.202 2013/01/15 17:45:05 christos Exp $);
 
 #include ohci.h
 #include uhci.h
@@ -2784,7 +2784,7 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *
 #endif
 		}
 		DPRINTFN(4,(ehci_alloc_sqtd_chain: len=%d curlen=%d 
-			curoffs=%ld\n, len, curlen, (size_t)curoffs));
+			curoffs=%zu\n, len, curlen, (size_t)curoffs));
 
 		/*
 		 * Allocate another transfer if there's more data left,



CVS commit: src/distrib/utils/embedded/conf

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 20:55:01 UTC 2013

Modified Files:
src/distrib/utils/embedded/conf: rpi.conf

Log Message:
now that we compute sizes correctly, reduce the extra to how much free space
we want.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/distrib/utils/embedded/conf/rpi.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/rpi.conf
diff -u src/distrib/utils/embedded/conf/rpi.conf:1.7 src/distrib/utils/embedded/conf/rpi.conf:1.8
--- src/distrib/utils/embedded/conf/rpi.conf:1.7	Mon Jan 14 22:56:20 2013
+++ src/distrib/utils/embedded/conf/rpi.conf	Tue Jan 15 15:55:00 2013
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.7 2013/01/15 03:56:20 christos Exp $
+# $NetBSD: rpi.conf,v 1.8 2013/01/15 20:55:00 christos Exp $
 # Raspberry PI customization script used by mkimage
 #
 image=$HOME/rpi.img
@@ -12,11 +12,11 @@ kerneldir=$src/sys/arch/evbarm/compile/R
 specialdirs=/kern /proc
 
 swap=256
-extra=$(( 150 + 8 ))	# cylinder groups ~150MB
+extra=8		# spare space
 boot=112
 init=8
 
-size=0
+size=0		# autocompute
 msdosid=12
 overhead=$(( ${swap} + ${extra} + ${init} + ${boot} ))
 
@@ -60,10 +60,10 @@ drivedata: 0 
 
 8 partitions:
 # size offsetfstype [fsize bsize cpg/sgs]
- a:   ${asize} ${aoffset}4.2BSD   2048 16384 0  # 
- b:   ${swapsize}  ${swapoffset} swap   #
- d:   ${totalsize} 0 unused  0 0#
- e:   ${bootsize}  ${bootoffset} MSDOS  #
+ a:   ${asize} ${aoffset}4.2BSD  ${fsize} ${bsize} 0  # 
+ b:   ${swapsize}  ${swapoffset} swap #
+ d:   ${totalsize} 0 unused  0 0  #
+ e:   ${bootsize}  ${bootoffset} MSDOS#
 EOF
 	${sudo} disklabel -R ${vnddev} ${tmp}
 	${sudo} fdisk -f -u -0 -s ${msdosid}/${bootoffset}/${bootsize} -F ${image}



CVS commit: src/distrib/utils/embedded

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 21:04:41 UTC 2013

Modified Files:
src/distrib/utils/embedded: mkimage

Log Message:
Make autosizing really work:
- Use newfs to compute the actual filesystem required size.
- Fix the computation of set sizes to account for blocks and fragments.
This results into a 95% full filesystem for my test (Total 566MB, 24MB free)
from which 8MB is my requested overhead. Not perfect, but good enough.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/utils/embedded/mkimage

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

Modified files:

Index: src/distrib/utils/embedded/mkimage
diff -u src/distrib/utils/embedded/mkimage:1.10 src/distrib/utils/embedded/mkimage:1.11
--- src/distrib/utils/embedded/mkimage:1.10	Mon Jan 14 22:26:27 2013
+++ src/distrib/utils/embedded/mkimage	Tue Jan 15 16:04:41 2013
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: mkimage,v 1.10 2013/01/15 03:26:27 christos Exp $
+# $NetBSD: mkimage,v 1.11 2013/01/15 21:04:41 christos Exp $
 
 # Copyright (c) 2012 Alistair Crooks a...@netbsd.org
 # All rights reserved.
@@ -69,6 +69,8 @@ next_avail ()
 }
 
 # find the size of the gzipped files in a .tgz archive
+# Directories appear as 0, so count them as one block
+# and round up files to a fragment.
 sizeone() {
 	if [ ! -f $1 ]
 	then
@@ -77,11 +79,18 @@ sizeone() {
 		return;
 	fi
 case $1 in 
-*.tgz|*.tar.gz)
-tar tvzf $1 | awk '{ tot += $5 } END { print tot }'
-;;
-*.tbz|*.tar.bz2)
-tar tvjf $1 | awk '{ tot += $5 } END { print tot }' 
+*.tgz|*.tar.gz|*.tbz|*.tar.bz2|*.txz|*.tar.xz)
+tar tvzf $1 |
+		awk -v fsize=${fsize} -v bsize=${bsize} '
+		{
+			if ($5 == 0)
+tot += bsize;
+			else
+tot += ((int)(($5 + fsize - 1) / fsize)) * fsize;
+		}
+		END {
+			printf(%d\n, tot);
+		}'
 ;;
 *)
 echo 0
@@ -96,12 +105,70 @@ EOF
 exit 1
 }
 
+# Return the usable filesystem size in bytes, given the total size in bytes,
+# and optionally block and fragment sizes
+getffssize() {
+	local bytes=$1
+	local barg
+	local farg
+	local overhead
+
+	if [ -n $2 ]
+	then
+		barg=-b $2
+		if [ -n $3 ]
+		then
+			farg=-f $3
+		fi
+	fi
+
+	overhead=$(newfs -N ${farg} ${barg} -s ${bytes}b -F /dev/null |
+	awk '/using/ {
+		printf(%d\n, substr($6, 1, length($6) - 3) * 1024 * 1024);
+	}'
+	)
+	echo $(( ${bytes} - ${overhead} ))
+}
+
+# Compute the size of an ffs filesystem that can fit x bytes.
+# Instead of duplicating the newfs calculations here we let
+# it do the job, using binary search.
+makeffssize() {
+	local bytes=$1
+	local bsize=$2
+	local fsize=$3
+	local max=$(( 2 * ${bytes} ))
+	local min=${bytes}
+	local cur
+	local res
+	while true; do
+		cur=$(( ( ${max} + ${min} ) / 2 ))
+		res=$(getffssize ${cur} ${bsize} ${fsize})
+#		echo ${min} ${cur} ${max} ${res} ${bytes} 12
+		if [ ${res} -eq ${bytes} ]
+		then
+		break
+		elif [ $(( ${min} + 1 )) -ge ${max} ]
+		then
+		break
+		elif [ ${res} -lt ${bytes} ]
+		then
+		min=${cur}
+		elif [ ${res} -gt ${bytes} ]
+		then
+		max=${cur}
+		fi
+	done
+	echo ${cur}
+}
+
 finish() {
 cleanup
 ${sudo} umount ${mnt}
 ${sudo} vnconfig -u ${vnddev}
 }
 
+
 DIR=$(dirname $0)
 PROG=$(basename $0)
 bar
@@ -110,6 +177,11 @@ mnt=${TMPDIR:-/tmp}/image.$$
 src=/usr/src
 obj=/usr/obj
 
+
+# Presumable block and fragment size.
+bsize=16384
+fsize=2048
+
 # First pass for options to get the host
 OPTS=S:c:h:s:x
 while getopts $OPTS f
@@ -155,17 +227,35 @@ if [ -n $1 ]; then
 	shift
 fi
 
-total=0
+# calculate the set bytes
+setbytes=0
+echo -n ${bar} computing set sizes (
 for s in ${sets}; do
 	one=$(sizeone ${setsdir}/${s}.tgz)
-	total=$(( ${total} +  ${one} ))
+	echo -n  $s=$(( ${one} / 1024 / 1024 ))MB
+	setbytes=$(( ${setbytes} +  ${one} ))
 done
+echo ): $(( ${setbytes} / 1024 / 1024 ))MB ${bar}
+
 # calculate size of custom files
-custsize=0
+custbytes=0
 if [ -d ${custom} ]; then
-	custsize=$(ls -lR ${custom} | awk 'NF == 9 { tot += $5 } END { print tot }')
+	custbytes=$(ls -lR ${custom} | 
+	awk 'NF == 9 { tot += $5 } END { print tot }')
 fi
-total=$(( ( ( ${total} + ${custsize} ) / 100 ) + ${overhead} ))
+echo ${bar} computing custom sizes: $(( ${custbytes} / 1024 / 1024 ))MB ${bar}
+
+# how many bytes
+rawbytes=$(( ${setbytes} + ${custbytes} ))
+echo -n ${bar} computing ffs filesystem size for $(( ${rawbytes} / 1024 / 1024 ))MB: 
+ffsbytes=$(makeffssize ${rawbytes})
+ffsmb=$(( ${ffsbytes} / 1024 / 1024 ))
+echo  ${ffsmb}MB ${bar}
+
+# total in MB
+total=$(( ${ffsmb} + ${overhead} ))
+echo ${bar} overhead: ${overhead}MB ${bar}
+
 if [ $size -eq 0 ]; then
 # auto-size the pkgs fs
 newsize=${total}



CVS commit: src/usr.sbin/syslogd

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 22:37:04 UTC 2013

Modified Files:
src/usr.sbin/syslogd: syslogd.c

Log Message:
PR/47449: David Holland: Don't log to terminals with mesg n, unless it is a
wall message.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/usr.sbin/syslogd/syslogd.c

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

Modified files:

Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.112 src/usr.sbin/syslogd/syslogd.c:1.113
--- src/usr.sbin/syslogd/syslogd.c:1.112	Tue Jun 19 21:39:34 2012
+++ src/usr.sbin/syslogd/syslogd.c	Tue Jan 15 17:37:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.112 2012/06/20 01:39:34 christos Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)syslogd.c	8.3 (Berkeley) 4/4/94;
 #else
-__RCSID($NetBSD: syslogd.c,v 1.112 2012/06/20 01:39:34 christos Exp $);
+__RCSID($NetBSD: syslogd.c,v 1.113 2013/01/15 22:37:04 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -2562,6 +2562,12 @@ wallmsg(struct filed *f, struct iovec *i
 			if (!f-f_un.f_uname[i][0])
 break;
 			if (strcmp(f-f_un.f_uname[i], ep-name) == 0) {
+struct stat st;
+
+if (stat(ep-line, st) != -1 
+(st.st_mode  S_IWGRP) == 0)
+	break;
+
 if ((p = ttymsg(iov, iovcnt, ep-line,
 TTYMSGTIME)) != NULL) {
 	errno = 0;	/* already in msg */



CVS commit: src/lib/libutil

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 22:42:14 UTC 2013

Modified Files:
src/lib/libutil: ttymsg.3

Log Message:
add some things to add next time we modify the function


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libutil/ttymsg.3

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

Modified files:

Index: src/lib/libutil/ttymsg.3
diff -u src/lib/libutil/ttymsg.3:1.11 src/lib/libutil/ttymsg.3:1.12
--- src/lib/libutil/ttymsg.3:1.11	Wed Apr 30 09:10:52 2008
+++ src/lib/libutil/ttymsg.3	Tue Jan 15 17:42:14 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: ttymsg.3,v 1.11 2008/04/30 13:10:52 martin Exp $
+.\ $NetBSD: ttymsg.3,v 1.12 2013/01/15 22:42:14 christos Exp $
 .\
 .\ Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -24,7 +24,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd June 29, 1997
+.Dd January 15, 2013
 .Dt TTYMSG 3
 .Os
 .Sh NAME
@@ -56,5 +56,13 @@ returns a pointer to an error string on 
 error; the string is not newline-terminated.
 Various normal errors are
 ignored (exclusive-use, lack of permission, etc.).
+.Sh BUGS
+.Nm
+could grow some flags and a username/uid who is the expected owner
+of the tty.
+If the flags say so then the owner should be checked against the tty
+owner, and the message should not be sent if there is a mismatch.
+Also another flag could say check against group writable, and don't
+send a message.
 .Sh SEE ALSO
 .Xr writev 2



CVS commit: src/sbin/disklabel

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 23:52:48 UTC 2013

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

Log Message:
- simplify getinput.
- add adjust command.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sbin/disklabel/interact.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/interact.c
diff -u src/sbin/disklabel/interact.c:1.35 src/sbin/disklabel/interact.c:1.36
--- src/sbin/disklabel/interact.c:1.35	Thu Jan  6 16:39:01 2011
+++ src/sbin/disklabel/interact.c	Tue Jan 15 18:52:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: interact.c,v 1.35 2011/01/06 21:39:01 apb Exp $	*/
+/*	$NetBSD: interact.c,v 1.36 2013/01/15 23:52:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: interact.c,v 1.35 2011/01/06 21:39:01 apb Exp $);
+__RCSID($NetBSD: interact.c,v 1.36 2013/01/15 23:52:48 christos Exp $);
 #endif /* lint */
 
 #include sys/param.h
@@ -40,7 +40,9 @@ __RCSID($NetBSD: interact.c,v 1.35 2011
 #include err.h
 #include stdio.h
 #include string.h
+#include stdarg.h
 #include stdlib.h
+#include sys/ioctl.h
 
 #if HAVE_NBTOOL_CONFIG_H
 #define	getmaxpartitions()	MAXPARTITIONS
@@ -53,6 +55,7 @@ __RCSID($NetBSD: interact.c,v 1.35 2011
 #include extern.h
 
 static void	cmd_help(struct disklabel *, char *, int);
+static void	cmd_adjust(struct disklabel *, char *, int);
 static void	cmd_chain(struct disklabel *, char *, int);
 static void	cmd_print(struct disklabel *, char *, int);
 static void	cmd_printall(struct disklabel *, char *, int);
@@ -63,7 +66,7 @@ static void	cmd_round(struct disklabel *
 static void	cmd_name(struct disklabel *, char *, int);
 static void	cmd_listfstypes(struct disklabel *, char *, int);
 static int	runcmd(struct disklabel *, char *, int);
-static int	getinput(const char *, const char *, const char *, char *);
+static int	getinput(char *, const char *, ...) __printflike(2, 3);
 static int	alphacmp(const void *, const void *);
 static void	defnum(struct disklabel *, char *, uint32_t);
 static void	dumpnames(const char *, const char * const *, size_t);
@@ -78,6 +81,7 @@ static struct cmds {
 	const char *help;
 } cmds[] = {
 	{ ?,	cmd_help,	print this menu },
+	{ A,	cmd_adjust,	adjust the label size to the max disk size },
 	{ C,	cmd_chain,	make partitions contiguous },
 	{ E,	cmd_printall,	print disk label and current partition table},
 	{ I,	cmd_info,	change label information },
@@ -91,7 +95,6 @@ static struct cmds {
 };
 	
 	
-
 static void
 cmd_help(struct disklabel *lp, char *s, int fd)
 {
@@ -105,13 +108,39 @@ cmd_help(struct disklabel *lp, char *s, 
 
 
 static void
+cmd_adjust(struct disklabel *lp, char *s, int fd)
+{
+	struct disklabel dl;
+
+	if (ioctl(fd, DIOCGDEFLABEL, dl) == -1) {
+		warn(Cannot get default label);
+		return;
+	}
+
+	if (dl.d_secperunit != lp-d_secperunit) {
+		char line[BUFSIZ];
+		int i = getinput(line, Adjust disklabel sector from % PRIu32
+		 to % PRIu32  [n]? , lp-d_secperunit, dl.d_secperunit);
+		if (i = 0)
+			return;
+		if (line[0] != 'Y'  line[0] != 'y')
+			return;
+		lp-d_secperunit = dl.d_secperunit;
+		return;
+	} 
+
+	printf(Already at % PRIu32  sectors\n, dl.d_secperunit);
+	return;
+}
+
+static void
 cmd_chain(struct disklabel *lp, char *s, int fd)
 {
 	int	i;
 	char	line[BUFSIZ];
 
-	i = getinput(:, Automatically adjust partitions,
-	chaining ? yes : no, line);
+	i = getinput(line, Automatically adjust partitions [%s]? ,
+	chaining ? yes : no);
 	if (i = 0)
 		return;
 
@@ -150,7 +179,6 @@ static void
 cmd_info(struct disklabel *lp, char *s, int fd)
 {
 	char	line[BUFSIZ];
-	char	def[BUFSIZ];
 	int	v, i;
 	u_int32_t u;
 
@@ -162,8 +190,7 @@ cmd_info(struct disklabel *lp, char *s, 
 		i = lp-d_type;
 		if (i  0 || i = DKMAXTYPES)
 			i = 0;
-		snprintf(def, sizeof(def), %s, dktypenames[i]);
-		i = getinput(:, Disk type [?], def, line);
+		i = getinput(line, Disk type [%s]: , dktypenames[i]);
 		if (i == -1)
 			return;
 		else if (i == 0)
@@ -190,9 +217,8 @@ cmd_info(struct disklabel *lp, char *s, 
 	}
 
 	/* d_typename */
-	snprintf(def, sizeof(def), %.*s,
+	i = getinput(line, Disk name [%.*s]: , 
 	(int) sizeof(lp-d_typename), lp-d_typename);
-	i = getinput(:, Disk name, def, line);
 	if (i == -1)
 		return;
 	else if (i == 1)
@@ -203,8 +229,8 @@ cmd_info(struct disklabel *lp, char *s, 
 
 	/* d_npartitions */
 	for (;;) {
-		snprintf(def, sizeof(def), % PRIu16, lp-d_npartitions);
-		i = getinput(:, Number of partitions, def, line);
+		i = getinput(line, Number of partitions [% PRIu16 ]: ,
+		lp-d_npartitions);
 		if (i == -1)
 			return;
 		else if (i == 0)
@@ -219,8 +245,8 @@ cmd_info(struct disklabel *lp, char *s, 
 
 	/* d_secsize */
 	for (;;) {
-		snprintf(def, sizeof(def), % PRIu32, lp-d_secsize);
-		i = getinput(:, Sector size (bytes), def, 

CVS commit: src/sys/dev/usb

2013-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 15 23:57:13 UTC 2013

Modified Files:
src/sys/dev/usb: usbdi.c

Log Message:
Don't do the xfer once, wait till it is done. I did not find this, someone
else did. Fixes slow devices such as scanners.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.142 src/sys/dev/usb/usbdi.c:1.143
--- src/sys/dev/usb/usbdi.c:1.142	Sat Jan  5 18:34:20 2013
+++ src/sys/dev/usb/usbdi.c	Tue Jan 15 18:57:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.142 2013/01/05 23:34:20 christos Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.143 2013/01/15 23:57:13 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.142 2013/01/05 23:34:20 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.143 2013/01/15 23:57:13 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -319,7 +319,7 @@ usbd_transfer(usbd_xfer_handle xfer)
 	if (err != USBD_IN_PROGRESS)
 		return (err);
 	usbd_lock_pipe(pipe);
-	if (!xfer-done) {
+	while (!xfer-done) {
 		if (pipe-device-bus-use_polling)
 			panic(usbd_transfer: not done);
 



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

2013-01-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 16 00:09:27 UTC 2013

Modified Files:
src/sys/arch/arm/omap: omapfb.c

Log Message:
implement right to left and bottom to top blits, now scrolling works right
in all directions.
while there, fix the xor mask for the cursor attribute - now it's actually
inverted


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/omap/omapfb.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/omap/omapfb.c
diff -u src/sys/arch/arm/omap/omapfb.c:1.10 src/sys/arch/arm/omap/omapfb.c:1.11
--- src/sys/arch/arm/omap/omapfb.c:1.10	Thu Jan 10 02:18:06 2013
+++ src/sys/arch/arm/omap/omapfb.c	Wed Jan 16 00:09:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: omapfb.c,v 1.10 2013/01/10 02:18:06 macallan Exp $	*/
+/*	$NetBSD: omapfb.c,v 1.11 2013/01/16 00:09:27 macallan Exp $	*/
 
 /*
  * Copyright (c) 2010 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: omapfb.c,v 1.10 2013/01/10 02:18:06 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: omapfb.c,v 1.11 2013/01/16 00:09:27 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -666,26 +666,43 @@ omapfb_bitblt(struct omapfb_softc *sc, i
 int wi, int he, int rop)
 {
 	int width_in_bytes = wi * (sc-sc_depth  3);
+	int hstep, vstep;
+	uint32_t saddr, daddr;
 
 	omapfb_wait_idle(sc);
 
-	/*
-	 * TODO:
-	 * handle overlaps ( as in, go backwards when needed )
-	 */
+	saddr = sc-sc_fbhwaddr + sc-sc_stride * ys + xs * (sc-sc_depth  3);
+	daddr = sc-sc_fbhwaddr + sc-sc_stride * yd + xd * (sc-sc_depth  3);
+	if (ys  yd) {
+		/* need to go vertically backwards */
+		vstep = 1 - (sc-sc_stride + width_in_bytes);
+		saddr += sc-sc_stride * (he - 1);
+		daddr += sc-sc_stride * (he - 1);
+	} else
+		vstep = (sc-sc_stride - width_in_bytes) + 1;
+	if ((xs  xd)  (ys == yd)) {
+		/*
+		 * need to go horizontally backwards, only needed if source
+		 * and destination pixels are on the same line
+		 */
+		hstep = 1 - (sc-sc_depth  2);
+		vstep = sc-sc_stride + (sc-sc_depth  3) * (wi - 1) + 1;
+		saddr += (sc-sc_depth  3) * (wi - 1);
+		daddr += (sc-sc_depth  3) * (wi - 1);
+	} else
+		hstep = 1;
+
 	omapdma_write_ch_reg(0, OMAPDMAC_CEN, wi);
 	omapdma_write_ch_reg(0, OMAPDMAC_CFN, he);
-	omapdma_write_ch_reg(0, OMAPDMAC_CSSA,
-	sc-sc_fbhwaddr + sc-sc_stride * ys + xs * (sc-sc_depth  3));
-	omapdma_write_ch_reg(0, OMAPDMAC_CDSA,
-	sc-sc_fbhwaddr + sc-sc_stride * yd + xd * (sc-sc_depth  3));
+	omapdma_write_ch_reg(0, OMAPDMAC_CSSA, saddr);
+	omapdma_write_ch_reg(0, OMAPDMAC_CDSA, daddr);
 	omapdma_write_ch_reg(0, OMAPDMAC_CCR,
 	CCR_DST_AMODE_DOUBLE_INDEX |
 	CCR_SRC_AMODE_DOUBLE_INDEX);
-	omapdma_write_ch_reg(0, OMAPDMAC_CSEI, 1);
-	omapdma_write_ch_reg(0, OMAPDMAC_CSFI, (sc-sc_stride - width_in_bytes) + 1);
-	omapdma_write_ch_reg(0, OMAPDMAC_CDEI, 1);
-	omapdma_write_ch_reg(0, OMAPDMAC_CDFI, (sc-sc_stride - width_in_bytes) + 1);
+	omapdma_write_ch_reg(0, OMAPDMAC_CSEI, hstep);
+	omapdma_write_ch_reg(0, OMAPDMAC_CSFI, vstep);
+	omapdma_write_ch_reg(0, OMAPDMAC_CDEI, hstep);
+	omapdma_write_ch_reg(0, OMAPDMAC_CDFI, vstep);
 	omapdma_write_ch_reg(0, OMAPDMAC_CCR,
 	CCR_DST_AMODE_DOUBLE_INDEX |
 	CCR_SRC_AMODE_DOUBLE_INDEX | CCR_ENABLE);
@@ -715,7 +732,7 @@ omapfb_cursor(void *cookie, int on, int 
 		ri-ri_ccol = col;
 		if (on) {
 			omapfb_putchar(cookie, row, col, scr-scr_chars[pos],
-			scr-scr_attrs[pos] ^ 0x000f0f00);
+			scr-scr_attrs[pos] ^ 0x0f0f);
 			ri-ri_flg |= RI_CURSOR;
 		}
 	} else {
@@ -723,7 +740,6 @@ omapfb_cursor(void *cookie, int on, int 
 		scr-scr_ri.ri_ccol = col;
 		scr-scr_ri.ri_flg = ~RI_CURSOR;
 	}
-
 }
 
 static void



CVS commit: othersrc/external/bsd/netdiff/dist

2013-01-15 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Wed Jan 16 01:50:20 UTC 2013

Modified Files:
othersrc/external/bsd/netdiff/dist: cmp.c diff.c diff_subr.c diffdir.c
diffreg.c mem.c netdiff.h netwdiff.c qdiff.c

Log Message:
Perform error message reporting differently, using an error buffer in
the diff_t structure.

Don't violate abstractions by accessing the status field in the
structure directly, use an accessor function to get the exit status
from the struct.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/netdiff/dist/cmp.c \
othersrc/external/bsd/netdiff/dist/diffdir.c \
othersrc/external/bsd/netdiff/dist/qdiff.c
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/netdiff/dist/diff.c
cvs rdiff -u -r1.7 -r1.8 othersrc/external/bsd/netdiff/dist/diff_subr.c
cvs rdiff -u -r1.10 -r1.11 othersrc/external/bsd/netdiff/dist/diffreg.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/netdiff/dist/mem.c
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/netdiff/dist/netdiff.h
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/netdiff/dist/netwdiff.c

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/netdiff/dist/cmp.c
diff -u othersrc/external/bsd/netdiff/dist/cmp.c:1.2 othersrc/external/bsd/netdiff/dist/cmp.c:1.3
--- othersrc/external/bsd/netdiff/dist/cmp.c:1.2	Tue Jan 15 01:57:56 2013
+++ othersrc/external/bsd/netdiff/dist/cmp.c	Wed Jan 16 01:50:19 2013
@@ -55,5 +55,5 @@ main(int argc, char **argv)
 	if (diff_get_diffs(diff, s, cc)) {
 		printf(%.*s, (int)cc, s);
 	}
-	exit(diff.status);
+	exit(diff_get_var(diff, (int)status, NULL, 0));
 }
Index: othersrc/external/bsd/netdiff/dist/diffdir.c
diff -u othersrc/external/bsd/netdiff/dist/diffdir.c:1.2 othersrc/external/bsd/netdiff/dist/diffdir.c:1.3
--- othersrc/external/bsd/netdiff/dist/diffdir.c:1.2	Fri Jan 11 05:19:46 2013
+++ othersrc/external/bsd/netdiff/dist/diffdir.c	Wed Jan 16 01:50:19 2013
@@ -59,7 +59,6 @@ __FBSDID($FreeBSD$);
 #include sys/stat.h
 
 #include dirent.h
-#include err.h
 #include errno.h
 #include fcntl.h
 #include fnmatch.h
@@ -133,7 +132,7 @@ slurpdir(diff_t *diff, char *path, size_
 
 	USE_ARG(enoentok);
 	if ((dirp = opendir(path)) == NULL) {
-		warn(can't open directory '%s', path);
+		snprintf(diff-errbuf, sizeof(diff-errbuf), can't open directory '%s' (%s), path, strerror(errno));
 		return NULL;
 	}
 	dv = NULL;
@@ -165,7 +164,7 @@ diffit(diff_t *diff, struct dirent *dp, 
 	strlcpy(path1 + plen1, dp-d_name, MAXPATHLEN - plen1);
 	if (stat(path1, diff-st[0]) != 0) {
 		if (!(DIFF_GET_FLAG(diff, 'N') || DIFF_GET_FLAG(diff, 'P')) || errno != ENOENT) {
-			warn(%s, path1);
+			snprintf(diff-errbuf, sizeof(diff-errbuf), %s (%s), path1, strerror(errno));
 			return 0;
 		}
 		flags |= D_EMPTY1;
@@ -175,7 +174,7 @@ diffit(diff_t *diff, struct dirent *dp, 
 	strlcpy(path2 + plen2, dp-d_name, MAXPATHLEN - plen2);
 	if (stat(path2, diff-st[1]) != 0) {
 		if (!DIFF_GET_FLAG(diff, 'N') || errno != ENOENT) {
-			warn(%s, path2);
+			snprintf(diff-errbuf, sizeof(diff-errbuf), %s (%s), path2, strerror(errno));
 			return 0;
 		}
 		flags |= D_EMPTY2;
@@ -239,7 +238,7 @@ diff_dir(diff_t *diff, char *p1, char *p
 	}
 	dirlen1 = strlcpy(path1, *p1 ? p1 : ., sizeof(path1));
 	if (dirlen1 = sizeof(path1) - 1) {
-		warnx(%s: %s, p1, strerror(ENAMETOOLONG));
+		snprintf(diff-errbuf, sizeof(diff-errbuf), %s: %s, p1, strerror(ENAMETOOLONG));
 		diff-status = 2;
 		return 0;
 	}
@@ -249,7 +248,7 @@ diff_dir(diff_t *diff, char *p1, char *p
 	}
 	dirlen2 = strlcpy(path2, *p2 ? p2 : ., sizeof(path2));
 	if (dirlen2 = sizeof(path2) - 1) {
-		warnx(%s: %s, p2, strerror(ENAMETOOLONG));
+		snprintf(diff-errbuf, sizeof(diff-errbuf), %s: %s, p2, strerror(ENAMETOOLONG));
 		diff-status = 2;
 		return 0;
 	}
Index: othersrc/external/bsd/netdiff/dist/qdiff.c
diff -u othersrc/external/bsd/netdiff/dist/qdiff.c:1.2 othersrc/external/bsd/netdiff/dist/qdiff.c:1.3
--- othersrc/external/bsd/netdiff/dist/qdiff.c:1.2	Sat Jan 12 01:31:21 2013
+++ othersrc/external/bsd/netdiff/dist/qdiff.c	Wed Jan 16 01:50:20 2013
@@ -526,5 +526,5 @@ main(int argc, char **argv)
 		fprintf(stdout, %.*s, (int)cc, s);
 	}
 	diff_fini(diff);
-	exit(diff.status);
+	exit(diff_get_var(diff, (int)status, NULL, 0));
 }

Index: othersrc/external/bsd/netdiff/dist/diff.c
diff -u othersrc/external/bsd/netdiff/dist/diff.c:1.4 othersrc/external/bsd/netdiff/dist/diff.c:1.5
--- othersrc/external/bsd/netdiff/dist/diff.c:1.4	Sun Jan 13 22:17:22 2013
+++ othersrc/external/bsd/netdiff/dist/diff.c	Wed Jan 16 01:50:19 2013
@@ -528,5 +528,5 @@ main(int argc, char **argv)
 	set_argstr(diff, oargv, argv);
 	difference(diff, argv[0], argv[1]);
 	diff_fini(diff);
-	exit(diff.status);
+	exit(diff_get_var(diff, (int)status, NULL, 0));
 }

Index: othersrc/external/bsd/netdiff/dist/diff_subr.c
diff -u othersrc/external/bsd/netdiff/dist/diff_subr.c:1.7 

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

2013-01-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan 16 03:30:48 UTC 2013

Modified Files:
src/sys/arch/arm/omap: obio_mputmr.c

Log Message:
MPU_* registers are not valid for OMAP3, so restrict access to them to
OMAP2 boards.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/obio_mputmr.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/omap/obio_mputmr.c
diff -u src/sys/arch/arm/omap/obio_mputmr.c:1.6 src/sys/arch/arm/omap/obio_mputmr.c:1.7
--- src/sys/arch/arm/omap/obio_mputmr.c:1.6	Thu Aug 23 01:27:24 2012
+++ src/sys/arch/arm/omap/obio_mputmr.c	Wed Jan 16 03:30:48 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: obio_mputmr.c,v 1.6 2012/08/23 01:27:24 matt Exp $ */
+/* $NetBSD: obio_mputmr.c,v 1.7 2013/01/16 03:30:48 jmcneill Exp $ */
 
 /*
  * Based on omap_mputmr.c
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: obio_mputmr.c,v 1.6 2012/08/23 01:27:24 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: obio_mputmr.c,v 1.7 2013/01/16 03:30:48 jmcneill Exp $);
 
 #include opt_omap.h
 #include opt_cpuoptions.h
@@ -121,8 +121,10 @@ __KERNEL_RCSID(0, $NetBSD: obio_mputmr.
 #include arm/omap/omap2_obiovar.h
 
 #include arm/omap/omap2_mputmrvar.h
-#include arm/omap/omap2_mputmrreg.h
 
+#if defined(OMAP_2430) || defined(OMAP_2420)
+#include arm/omap/omap2_mputmrreg.h
+#endif
 
 #include arm/omap/omap2_reg.h
 
@@ -233,9 +235,11 @@ obiomputmr_attach(device_t parent, devic
 	aprint_normal(\n);
 	aprint_naive(\n);
 
+#if defined(OMAP_2430) || defined(OMAP_2420)
 	/* Stop the timer from counting, but keep the timer module working. */
 	bus_space_write_4(sc-sc_iot, sc-sc_ioh, MPU_CNTL_TIMER,
 			  MPU_CLOCK_ENABLE);
+#endif
 
 	timer_factors tf;
 	calc_timer_factors(ints_per_sec, tf);
@@ -261,6 +265,7 @@ obiomputmr_attach(device_t parent, devic
 		break;
 	}
 
+#if defined(OMAP_2430) || defined(OMAP_2420)
 	/* Set the reload value. */
 	bus_space_write_4(sc-sc_iot, sc-sc_ioh, MPU_LOAD_TIMER, tf.reload);
 	/* Set the PTV and the other required bits and pieces. */
@@ -270,6 +275,7 @@ obiomputmr_attach(device_t parent, devic
 			| MPU_AR
 			| MPU_ST));
 	/* The clock is now running, but is not generating interrupts. */
+#endif
 }
 
 static const gptimer_instance_t *



CVS commit: src/lib/libutil

2013-01-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jan 16 06:44:28 UTC 2013

Modified Files:
src/lib/libutil: ttymsg.3

Log Message:
Sort sections.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libutil/ttymsg.3

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

Modified files:

Index: src/lib/libutil/ttymsg.3
diff -u src/lib/libutil/ttymsg.3:1.12 src/lib/libutil/ttymsg.3:1.13
--- src/lib/libutil/ttymsg.3:1.12	Tue Jan 15 22:42:14 2013
+++ src/lib/libutil/ttymsg.3	Wed Jan 16 06:44:27 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: ttymsg.3,v 1.12 2013/01/15 22:42:14 christos Exp $
+.\ $NetBSD: ttymsg.3,v 1.13 2013/01/16 06:44:27 wiz Exp $
 .\
 .\ Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -56,6 +56,8 @@ returns a pointer to an error string on 
 error; the string is not newline-terminated.
 Various normal errors are
 ignored (exclusive-use, lack of permission, etc.).
+.Sh SEE ALSO
+.Xr writev 2
 .Sh BUGS
 .Nm
 could grow some flags and a username/uid who is the expected owner
@@ -64,5 +66,3 @@ If the flags say so then the owner shoul
 owner, and the message should not be sent if there is a mismatch.
 Also another flag could say check against group writable, and don't
 send a message.
-.Sh SEE ALSO
-.Xr writev 2



CVS commit: src/sys/kern

2013-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 16 06:45:25 UTC 2013

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

Log Message:
 Set resource limit. The rnd_process_events() function is called every tick
and process the sample queue. Without limitation, if a lot of rnd_add_*()
are called, all kernel memory may be eaten up.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/kern_rndq.c

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

Modified files:

Index: src/sys/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.6 src/sys/kern/kern_rndq.c:1.7
--- src/sys/kern/kern_rndq.c:1.6	Sat Oct 27 01:29:02 2012
+++ src/sys/kern/kern_rndq.c	Wed Jan 16 06:45:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.6 2012/10/27 01:29:02 tls Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.7 2013/01/16 06:45:24 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_rndq.c,v 1.6 2012/10/27 01:29:02 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_rndq.c,v 1.7 2013/01/16 06:45:24 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/ioctl.h
@@ -405,7 +405,17 @@ rnd_init(void)
 	rnd_mempc = pool_cache_init(sizeof(rnd_sample_t), 0, 0, 0,
 rndsample, NULL, IPL_VM,
 NULL, NULL, NULL);
-	/* Mix *something*, *anything* into the pool to help it get started.
+
+	/*
+	 * Set resource limit. The rnd_process_events() function
+	 * is called every tick and process the sample queue.
+	 * Without limitation, if a lot of rnd_add_*() are called,
+	 * all kernel memory may be eaten up.
+	 */
+	pool_cache_sethardlimit(rnd_mempc, RND_POOLBITS, NULL, 0);
+
+	/*
+	 * Mix *something*, *anything* into the pool to help it get started.
 	 * However, it's not safe for rnd_counter() to call microtime() yet,
 	 * so on some platforms we might just end up with zeros anyway.
 	 * XXX more things to add would be nice.