Re: CVS commit: src/external/bsd/cron/dist

2012-12-25 Thread Christos Zoulas
In article 15993.1356420...@splode.eterna.com.au,
matthew green  m...@eterna.com.au wrote:

 On Mon, Dec 24, 2012 at 02:30:46PM -0500, Christos Zoulas wrote:
   Modified Files:
 src/external/bsd/cron/dist: database.c
   
   Log Message:
   PR/47362: Brian Marcotte: cron is too restrictive on file permissions
   Allow file being writable by owner.
   XXX: pullup to 6.

wasn't the problem that mode 0400 files were rejected?  ie, read-only
not writable files.

Yes, it was allowing 0600 and not allowing 0400. Now it allows both.

christos



Re: CVS commit: src/external/bsd/cron/dist

2012-12-25 Thread Bernd Ernesti
On Tue, Dec 25, 2012 at 02:13:57PM +, Christos Zoulas wrote:
 In article 15993.1356420...@splode.eterna.com.au,
 matthew green  m...@eterna.com.au wrote:
 
  On Mon, Dec 24, 2012 at 02:30:46PM -0500, Christos Zoulas wrote:
Modified Files:
src/external/bsd/cron/dist: database.c

Log Message:
PR/47362: Brian Marcotte: cron is too restrictive on file permissions
Allow file being writable by owner.
XXX: pullup to 6.
 
 wasn't the problem that mode 0400 files were rejected?  ie, read-only
 not writable files.
 
 Yes, it was allowing 0600 and not allowing 0400. Now it allows both.

The commit message suggested something differently: Allow file being writable 
by owner.

I haven't checked the source but when does this happen and what is the
result of this change now?
Can you now change a read only file in /var/cron/tabs with crontab -e?

Bernd



Re: CVS commit: src/external/bsd/cron/dist

2012-12-25 Thread Christos Zoulas
In article 20121225142253.ge2...@arresum.veego.de,
Bernd Ernesti  net...@lists.veego.de wrote:

The commit message suggested something differently: Allow file being
writable by owner.

It should say not writable. I've fixed it.

I haven't checked the source but when does this happen and what is the
result of this change now?
Can you now change a read only file in /var/cron/tabs with crontab -e?

Writing should behave exactly like before.

christos



re: CVS commit: src/external/bsd/cron/dist

2012-12-25 Thread matthew green

  On Mon, Dec 24, 2012 at 02:30:46PM -0500, Christos Zoulas wrote:
Modified Files:
src/external/bsd/cron/dist: database.c

Log Message:
PR/47362: Brian Marcotte: cron is too restrictive on file permissions
Allow file being writable by owner.
XXX: pullup to 6.
 
 wasn't the problem that mode 0400 files were rejected?  ie, read-only
 not writable files.

could you please fix the commit log?  it says the opposite.


.mrg.


CVS commit: src/sbin/savecore

2012-12-25 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Tue Dec 25 09:24:45 UTC 2012

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

Log Message:
Consistent use of return.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/savecore/zopen.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/zopen.c
diff -u src/sbin/savecore/zopen.c:1.2 src/sbin/savecore/zopen.c:1.3
--- src/sbin/savecore/zopen.c:1.2	Mon Jun 27 01:00:06 2005
+++ src/sbin/savecore/zopen.c	Tue Dec 25 09:24:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: zopen.c,v 1.2 2005/06/27 01:00:06 christos Exp $	*/
+/*	$NetBSD: zopen.c,v 1.3 2012/12/25 09:24:45 mbalmer Exp $	*/
 
 /*
  * Public domain stdio wrapper for libz, written by Johan Danielsson.
@@ -6,7 +6,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: zopen.c,v 1.2 2005/06/27 01:00:06 christos Exp $);
+__RCSID($NetBSD: zopen.c,v 1.3 2012/12/25 09:24:45 mbalmer Exp $);
 #endif
 
 #include stdio.h
@@ -35,7 +35,7 @@ zopen(const char *fname, const char *mod
 	return NULL;
 
 if(*mode == 'r')
-	return (funopen(gz, xgzread, NULL, NULL, gzclose));
+	return funopen(gz, xgzread, NULL, NULL, gzclose);
 else
-	return (funopen(gz, NULL, xgzwrite, NULL, gzclose));
+	return funopen(gz, NULL, xgzwrite, NULL, gzclose);
 }



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

2012-12-25 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Tue Dec 25 10:51:04 UTC 2012

Modified Files:
src/sys/arch/i386/conf: GENERIC files.i386

Log Message:
Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.1085 -r1.1086 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.369 -r1.370 src/sys/arch/i386/conf/files.i386

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

Modified files:

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1085 src/sys/arch/i386/conf/GENERIC:1.1086
--- src/sys/arch/i386/conf/GENERIC:1.1085	Mon Dec 17 20:38:00 2012
+++ src/sys/arch/i386/conf/GENERIC	Tue Dec 25 10:51:03 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1085 2012/12/17 20:38:00 mbalmer Exp $
+# $NetBSD: GENERIC,v 1.1086 2012/12/25 10:51:03 mbalmer Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	arch/i386/conf/std.i386
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.1085 $
+#ident 		GENERIC-$Revision: 1.1086 $
 
 maxusers	64		# estimated number of users
 
@@ -1530,8 +1530,8 @@ ubsec*	at pci? dev ? function ?	# Broadc
 # Trusted Platform Module
 tpm*   at isa? iomem 0xfed4 irq 7
 #tpm*  at isa? port 0x02e
-#tpm*  at isa? port 0x04e 
-#tpm*  at isa? port 0x07e 
+#tpm*  at isa? port 0x04e
+#tpm*  at isa? port 0x07e
 #tpm*  at isa? port 0x0ee
 
 # Joysticks

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.369 src/sys/arch/i386/conf/files.i386:1.370
--- src/sys/arch/i386/conf/files.i386:1.369	Sun Dec 16 13:09:20 2012
+++ src/sys/arch/i386/conf/files.i386	Tue Dec 25 10:51:03 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.369 2012/12/16 13:09:20 mbalmer Exp $
+#	$NetBSD: files.i386,v 1.370 2012/12/25 10:51:03 mbalmer Exp $
 #
 # new style config file for i386 architecture
 #
@@ -462,7 +462,7 @@ obsolete	defflag	opt_vesafb.h	VESAFB_PM
 
 # AMD Geode LX Security Block
 device	glxsb: opencrypto
-attach	glxsb at pci
+attach	glxsb at pci
 file	arch/i386/pci/glxsb.c		glxsb
 
 include arch/i386/conf/majors.i386



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:02:35 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Add a DEBUG function to search the Flash for byte-streams, as U-Boot usually
doesn't offer a search function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sandpoint/stand/altboot/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/sys/arch/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.21 src/sys/arch/sandpoint/stand/altboot/main.c:1.22
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.21	Mon May 21 21:34:16 2012
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Tue Dec 25 17:02:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.21 2012/05/21 21:34:16 dsl Exp $ */
+/* $NetBSD: main.c,v 1.22 2012/12/25 17:02:35 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -111,6 +111,7 @@ static int parse_cmdline(char **, int, c
 static int is_space(char);
 #ifdef DEBUG
 static void sat_test(void);
+static void findflash(void);
 #endif
 
 #define	BNAME_DEFAULT wd0:
@@ -236,12 +237,21 @@ main(int argc, char *argv[], char *boota
 			n / 100);
 		if (tstchar()) {
 #ifdef DEBUG
-			if (toupper(getchar()) == 'C') {
+			unsigned c;
+
+			c = toupper(getchar());
+			if (c == 'C') {
 /* controller test terminal */
 sat_test();
 n = 200;
 continue;
 			}
+			else if (c == 'F') {
+/* find strings in Flash ROM */
+findflash();
+n = 200;
+continue;
+			}
 #else
 			(void)getchar();
 #endif
@@ -665,6 +675,40 @@ is_space(char c)
 
 #ifdef DEBUG
 static void
+findflash(void)
+{
+	char buf[256];
+	int i, n;
+	unsigned char c, *p;
+
+	for (;;) {
+		printf(\nfind );
+		gets(buf);
+		if (tolower((unsigned)buf[0]) == 'x')
+			break;
+		for (i = 0, n = 0, c = 0; buf[i]; i++) {
+			c = 4;
+			c |= hex2nibble(buf[i]);
+			if (i  1)
+buf[n++] = c;
+		}
+		printf(Searching for:);
+		for (i = 0; i  n; i++)
+			printf( %02x, buf[i]);
+		printf(\n);
+		for (p = (unsigned char *)0xff00;
+		 p = (unsigned char *)(0x-n); p++) {
+			for (i = 0; i  n; i++) {
+if (p[i] != buf[i])
+	break;
+			}
+			if (i = n)
+printf(Found at %08x\n, (unsigned)p);
+		}
+	}
+}
+
+static void
 sat_test(void)
 {
 	char buf[1024];



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:07:07 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c rge.c

Log Message:
QNAP V200 boards have no EEPROM for the MAC address, so all devices default
to the same address (00:e0:4c:69:20:01).
Now we read the real MAC address from the flash ROM. It is stored at the
beginning of a 512-byte block in ASCII format. Some QNAP's have a broken
ext2 file system, so we cannot look for the file ETH0.MAC_ADDR therein,
but have to search the whole flash in 512-byte steps for candidates...


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/rge.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/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.31 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.32
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.31	Mon Apr 16 16:55:29 2012
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Tue Dec 25 17:07:06 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.31 2012/04/16 16:55:29 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.32 2012/12/25 17:07:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -1254,6 +1254,41 @@ read_mac_string(uint8_t *mac, char *p)
 }
 
 /*
+ * Scan through the Flash memory and look for a string starting at 512 bytes
+ * block boundaries, matching the format: xx:xx:xx:xx:xx:xxNUL, where x
+ * are hexadecimal digits.
+ * Read the first match as our MAC address.
+ * The start address of the search, p, *must* be dividable by 512!
+ * Return false when no suitable MAC string was found.
+ */
+static int
+find_mac_string(uint8_t *mac, char *p)
+{
+	int i;
+
+	for (;;) {
+		for (i = 0; i  3 * 6; i += 3) {
+			if (!isxdigit((unsigned)p[i]) ||
+			!isxdigit((unsigned)p[i + 1]))
+break;
+			if ((i  5  p[i + 2] != ':') ||
+			(i = 5  p[i + 2] != '\0'))
+break;
+		}
+		if (i = 6) {
+			/* found a valid MAC address */
+			read_mac_string(mac, p);
+			return 1;
+		}
+		if (p = (char *)0xfe00)
+			break;
+		p += 0x200;
+	}
+	return 0;
+}
+
+
+/*
  * For cost saving reasons some NAS boxes lack SEEPROM for NIC's
  * ethernet address and keep it in their Flash memory instead.
  */
@@ -1272,6 +1307,10 @@ read_mac_from_flash(uint8_t *mac)
 	case BRD_DLINKDSM:
 		read_mac_string(mac, (char *)0xfff0ff80);
 		return;
+	case BRD_QNAPTS:
+		if (find_mac_string(mac, (char *)0xfff0))
+			return;
+		break;
 	default:
 		printf(Warning: This board has no known method defined 
 		to determine its MAC address!\n);

Index: src/sys/arch/sandpoint/stand/altboot/rge.c
diff -u src/sys/arch/sandpoint/stand/altboot/rge.c:1.6 src/sys/arch/sandpoint/stand/altboot/rge.c:1.7
--- src/sys/arch/sandpoint/stand/altboot/rge.c:1.6	Sun Oct 30 21:08:33 2011
+++ src/sys/arch/sandpoint/stand/altboot/rge.c	Tue Dec 25 17:07:06 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: rge.c,v 1.6 2011/10/30 21:08:33 phx Exp $ */
+/* $NetBSD: rge.c,v 1.7 2012/12/25 17:07:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -102,6 +102,9 @@ struct desc {
 #define	 RCR_AM		(1U  2)	/* accept multicast frame */
 #define	 RCR_APM	(1U  1)	/* accept unicast frame */
 #define	 RCR_AAP	(1U  0)	/* promiscuous */
+#define RGE_EECMD	0x50		/* EEPROM command register */
+#define  EECMD_LOCK	0x00
+#define  EECMD_UNLOCK	0xc0
 #define RGE_PHYAR	0x60		/* PHY access */
 #define RGE_PHYSR	0x6c		/* PHY status */
 #define RGE_RMS		0xda		/* Rx maximum frame size */
@@ -146,7 +149,8 @@ rge_init(unsigned tag, void *data)
 	unsigned val;
 	struct local *l;
 	struct desc *txd, *rxd;
-	uint8_t *en = data;
+	uint32_t reg;
+	uint8_t *en;
 
 	l = ALLOC(struct local, 256);	/* desc alignment */
 	memset(l, 0, sizeof(struct local));
@@ -158,14 +162,27 @@ rge_init(unsigned tag, void *data)
 	} while (val  CR_RESET);
 
 	mii_initphy(l);
-
 	en = data;
-	en[0] = CSR_READ_1(l, RGE_IDR0);
-	en[1] = CSR_READ_1(l, RGE_IDR1);
-	en[2] = CSR_READ_1(l, RGE_IDR2);
-	en[3] = CSR_READ_1(l, RGE_IDR3);
-	en[4] = CSR_READ_1(l, RGE_IDR4);
-	en[5] = CSR_READ_1(l, RGE_IDR5);
+
+	if (brdtype == BRD_QNAPTS) {
+		/* read the MAC from flash and write it into the ID-Regs */
+		read_mac_from_flash(en);
+
+		CSR_WRITE_1(l, RGE_EECMD, EECMD_UNLOCK);
+		reg = en[0] | (en[1]  8) | (en[2]  16) | (en[3]  24);
+		CSR_WRITE_4(l, RGE_IDR0, reg);
+		reg = en[4] | (en[5]  8);
+		CSR_WRITE_4(l, RGE_IDR4, reg);
+		CSR_WRITE_1(l, RGE_EECMD, EECMD_LOCK);
+	} else {
+		/* pretent the ID-Regs have the correct address */
+		en[0] = CSR_READ_1(l, RGE_IDR0);
+		en[1] = CSR_READ_1(l, RGE_IDR1);
+		en[2] = CSR_READ_1(l, RGE_IDR2);
+		en[3] = CSR_READ_1(l, RGE_IDR3);
+		en[4] = CSR_READ_1(l, RGE_IDR4);
+		en[5] = CSR_READ_1(l, RGE_IDR5);
+	}
 
 	printf(MAC address 

CVS commit: src/usr.sbin/puffs/mount_psshfs

2012-12-25 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Tue Dec 25 20:31:04 UTC 2012

Modified Files:
src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8

Log Message:
fix spelling typo


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8

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/puffs/mount_psshfs/mount_psshfs.8
diff -u src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.25 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.26
--- src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8:1.25	Thu Sep 15 11:52:09 2011
+++ src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8	Tue Dec 25 20:31:03 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: mount_psshfs.8,v 1.25 2011/09/15 11:52:09 wiz Exp $
+.\	$NetBSD: mount_psshfs.8,v 1.26 2012/12/25 20:31:03 reed Exp $
 .\
 .\ Copyright (c) 2007-2009 Antti Kantee.  All rights reserved.
 .\
@@ -202,4 +202,4 @@ stavfs protocol extension,
 free disk space may be displayed for the mount by
 .Xr df 1 .
 This information reflects the status at the server's mountpoint
-and may differ for subdiretories under the mount root.
+and may differ for subdirectories under the mount root.



CVS commit: [netbsd-6] src/sbin/sysctl

2012-12-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 25 21:01:14 UTC 2012

Modified Files:
src/sbin/sysctl [netbsd-6]: sysctl.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #757):
sbin/sysctl/sysctl.c: revision 1.149
Add missing free() in error path.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.140.2.1 src/sbin/sysctl/sysctl.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/sysctl/sysctl.c
diff -u src/sbin/sysctl/sysctl.c:1.140 src/sbin/sysctl/sysctl.c:1.140.2.1
--- src/sbin/sysctl/sysctl.c:1.140	Sun Feb 12 20:54:07 2012
+++ src/sbin/sysctl/sysctl.c	Tue Dec 25 21:01:14 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.c,v 1.140 2012/02/12 20:54:07 christos Exp $ */
+/*	$NetBSD: sysctl.c,v 1.140.2.1 2012/12/25 21:01:14 snj Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@ __COPYRIGHT(@(#) Copyright (c) 1993\
 #if 0
 static char sccsid[] = @(#)sysctl.c	8.1 (Berkeley) 6/6/93;
 #else
-__RCSID($NetBSD: sysctl.c,v 1.140 2012/02/12 20:54:07 christos Exp $);
+__RCSID($NetBSD: sysctl.c,v 1.140.2.1 2012/12/25 21:01:14 snj Exp $);
 #endif
 #endif /* not lint */
 
@@ -2337,6 +2337,7 @@ kern_drivers(HANDLER_ARGS)
 	rc = prog_sysctl(name, namelen, kd, sz, NULL, 0);
 	if (rc == -1) {
 		sysctlerror(1);
+		free(kd);
 		return;
 	}
 



CVS commit: [netbsd-6] src/usr.bin/netstat

2012-12-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 25 21:07:05 UTC 2012

Modified Files:
src/usr.bin/netstat [netbsd-6]: bpf.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #763):
usr.bin/netstat/bpf.c: revision 1.11
Fix memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.8.1 src/usr.bin/netstat/bpf.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/netstat/bpf.c
diff -u src/usr.bin/netstat/bpf.c:1.10 src/usr.bin/netstat/bpf.c:1.10.8.1
--- src/usr.bin/netstat/bpf.c:1.10	Mon Dec 13 21:15:30 2010
+++ src/usr.bin/netstat/bpf.c	Tue Dec 25 21:07:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.10 2010/12/13 21:15:30 pooka Exp $	*/
+/*	$NetBSD: bpf.c,v 1.10.8.1 2012/12/25 21:07:04 snj Exp $	*/
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -167,6 +167,7 @@ bpf_dump(const char *bpfif)
 printf(%s\n, p.p_comm);
 #undef BPFEXT
 		}
+		free(v);
 	} else {
 /* XXX */
 errx(1, bpf_dump not implemented using kvm);



CVS commit: [netbsd-6] src/usr.bin/sed

2012-12-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 25 21:10:35 UTC 2012

Modified Files:
src/usr.bin/sed [netbsd-6]: compile.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #764):
usr.bin/sed/compile.c: revision 1.38
Fix memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.37.8.1 src/usr.bin/sed/compile.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/sed/compile.c
diff -u src/usr.bin/sed/compile.c:1.37 src/usr.bin/sed/compile.c:1.37.8.1
--- src/usr.bin/sed/compile.c:1.37	Fri Feb 19 16:35:27 2010
+++ src/usr.bin/sed/compile.c	Tue Dec 25 21:10:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: compile.c,v 1.37 2010/02/19 16:35:27 tnn Exp $	*/
+/*	$NetBSD: compile.c,v 1.37.8.1 2012/12/25 21:10:35 snj Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -76,7 +76,7 @@
 #if 0
 static char sccsid[] = @(#)compile.c	8.2 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: compile.c,v 1.37 2010/02/19 16:35:27 tnn Exp $);
+__RCSID($NetBSD: compile.c,v 1.37.8.1 2012/12/25 21:10:35 snj Exp $);
 #endif
 #endif /* not lint */
 
@@ -474,6 +474,7 @@ compile_re(char *p, regex_t **repp)
 		err(COMPILE, RE error: %s, strregerror(eval, *repp));
 	if (maxnsub  (*repp)-re_nsub)
 		maxnsub = (*repp)-re_nsub;
+	free(re);
 	return (p);
 }
 



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

2012-12-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 25 21:17:41 UTC 2012

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

Log Message:
Change the way rx are consumed.  Only consume a 1/4 of the receive buffers
before refilling with new buffers.  Don't stop until there are no packets
left to receive.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/broadcom/bcm53xx_eth.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.19 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.20
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.19	Wed Dec 19 02:44:39 2012
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Tue Dec 25 21:17:40 2012
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: bcm53xx_eth.c,v 1.19 2012/12/19 02:44:39 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: bcm53xx_eth.c,v 1.20 2012/12/25 21:17:40 matt Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -1009,29 +1009,27 @@ bcmeth_rx_input(
 #endif
 }
 
-static void
+static bool
 bcmeth_rxq_consume(
 	struct bcmeth_softc *sc,
-	struct bcmeth_rxqueue *rxq)
+	struct bcmeth_rxqueue *rxq,
+	size_t atmost)
 {
 	struct ifnet * const ifp = sc-sc_if;
 	struct gmac_rxdb *consumer = rxq-rxq_consumer;
 	size_t rxconsumed = 0;
+	bool didconsume = false;
 
-	for (;;) {
+	while (atmost--  0) {
 		if (consumer == rxq-rxq_producer) {
-			rxq-rxq_consumer = consumer;
-			rxq-rxq_inuse -= rxconsumed;
 			KASSERT(rxq-rxq_inuse == 0);
-			return;
+			break;
 		}
 		
 		uint32_t rcvsts0 = bcmeth_read_4(sc, rxq-rxq_reg_rcvsts0);
 		uint32_t currdscr = __SHIFTOUT(rcvsts0, RCV_CURRDSCR);
 		if (consumer == rxq-rxq_first + currdscr) {
-			rxq-rxq_consumer = consumer;
-			rxq-rxq_inuse -= rxconsumed;
-			return;
+			break;
 		}
 		bcmeth_rxq_desc_postsync(sc, rxq, consumer, 1);
 
@@ -1039,6 +1037,7 @@ bcmeth_rxq_consume(
 		 * We own this packet again.  Copy the rxsts word from it.
 		 */
 		rxconsumed++;
+		didconsume = true;
 		uint32_t rxsts;
 		KASSERT(rxq-rxq_mhead != NULL);
 		bus_dmamap_t map = M_GETCTX(rxq-rxq_mhead, bus_dmamap_t);
@@ -1152,6 +1151,17 @@ bcmeth_rxq_consume(
 			consumer = rxq-rxq_first;
 		}
 	}
+
+	/*
+	 * Update queue info.
+	 */
+	rxq-rxq_consumer = consumer;
+	rxq-rxq_inuse -= rxconsumed;
+
+	/*
+	 * Did we consume anything?
+	 */
+	return didconsume;
 }
 
 static void
@@ -1896,7 +1906,14 @@ bcmeth_soft_intr(void *arg)
 		/*
 		 * Let's consume 
 		 */
-		bcmeth_rxq_consume(sc, sc-sc_rxq);
+		while (bcmeth_rxq_consume(sc, sc-sc_rxq,
+		sc-sc_rxq.rxq_threshold / 4)) {
+			/*
+			 * We've consumed a quarter of the ring and still have
+			 * more to do.  Refill the ring.
+			 */
+			bcmeth_rxq_produce(sc, sc-sc_rxq);
+		}
 		intmask |= RCVINT;
 	}
 
@@ -1949,7 +1966,14 @@ bcmeth_worker(struct work *wk, void *arg
 		/*
 		 * Let's consume 
 		 */
-		bcmeth_rxq_consume(sc, sc-sc_rxq);
+		while (bcmeth_rxq_consume(sc, sc-sc_rxq,
+		sc-sc_rxq.rxq_threshold / 4)) {
+			/*
+			 * We've consumed a quarter of the ring and still have
+			 * more to do.  Refill the ring.
+			 */
+			bcmeth_rxq_produce(sc, sc-sc_rxq);
+		}
 		intmask |= RCVINT;
 	}
 



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

2012-12-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 25 22:33:39 UTC 2012

Modified Files:
src/sys/arch/arm/include: armreg.h

Log Message:
Add CP15 Generic Timer definitions.
Add cortex PMUSERENR inlines


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/arm/include/armreg.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/arm/include/armreg.h
diff -u src/sys/arch/arm/include/armreg.h:1.70 src/sys/arch/arm/include/armreg.h:1.71
--- src/sys/arch/arm/include/armreg.h:1.70	Thu Nov 29 18:15:33 2012
+++ src/sys/arch/arm/include/armreg.h	Tue Dec 25 22:33:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: armreg.h,v 1.70 2012/11/29 18:15:33 matt Exp $	*/
+/*	$NetBSD: armreg.h,v 1.71 2012/12/25 22:33:39 matt Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -446,6 +446,19 @@
 #define	CPU_CSSR_L1		0x
 #define	CPU_CSSR_InD		0x0001
 
+/* ARMv7A CP15 Global Timer definitions */
+#define	CNTKCTL_PL0PTEN		0x0200	/* PL0 Physical Timer Enable */
+#define	CNTKCTL_PL0VTEN		0x0100	/* PL0 Virtual Timer Enable */
+#define	CNTKCTL_EVNTI		0x00f0	/* CNTVCT Event Bit Select */
+#define	CNTKCTL_EVNTDIR		0x0008	/* CNTVCT Event Dir (1-0) */
+#define	CNTKCTL_EVNTEN		0x0004	/* CNTVCT Event Enable */
+#define	CNTKCTL_PL0PCTEN	0x0200	/* PL0 Physical Counter Enable */
+#define	CNTKCTL_PL0VCTEN	0x0100	/* PL0 Virtual Counter Enable */
+
+#define	CNT_CTL_ISTATUS		0x0004	/* Timer is asserted */
+#define	CNT_CTL_IMASK		0x0002	/* Timer output is masked */
+#define	CNT_CTL_ENABLE		0x0001	/* Timer is enabled */
+
 /* Fault status register definitions */
 
 #define FAULT_TYPE_MASK 0x0f
@@ -559,6 +572,20 @@ static inline void armreg_##name##_write
 	__asm __volatile(mcr  __insnstring :: r(__val));	\
 }
 
+#define	ARMREG_READ64_INLINE(name, __insnstring)		\
+static inline uint64_t armreg_##name##_read(void)		\
+{\
+	uint64_t __rv;		\
+	__asm __volatile(mrrc  __insnstring : =r(__rv));	\
+	return __rv;		\
+}
+
+#define	ARMREG_WRITE64_INLINE(name, __insnstring)		\
+static inline void armreg_##name##_write(uint64_t __val)	\
+{\
+	__asm __volatile(mcrr  __insnstring :: r(__val));	\
+}
+
 /* c0 registers */
 ARMREG_READ_INLINE(midr, p15,0,%0,c0,c0,0) /* Main ID Register */
 ARMREG_READ_INLINE(ctr, p15,0,%0,c0,c0,1) /* Cache Type Register */
@@ -628,11 +655,37 @@ ARMREG_READ_INLINE(pmovsr, p15,0,%0,c9,
 ARMREG_WRITE_INLINE(pmovsr, p15,0,%0,c9,c12,3) /* PMC Overflow Flag Status */
 ARMREG_READ_INLINE(pmccntr, p15,0,%0,c9,c13,0) /* PMC Cycle Counter */
 ARMREG_WRITE_INLINE(pmccntr, p15,0,%0,c9,c13,0) /* PMC Cycle Counter */
+ARMREG_READ_INLINE(pmuserenr, p15,0,%0,c9,c14,0) /* PMC User Enable */
+ARMREG_WRITE_INLINE(pmuserenr, p15,0,%0,c9,c14,0) /* PMC User Enable */
 /* c13 registers */
+ARMREG_READ_INLINE(contextidr, p15,0,%0,c13,c0,1) /* Context ID Register */
+ARMREG_WRITE_INLINE(contextidr, p15,0,%0,c13,c0,1) /* Context ID Register */
 ARMREG_READ_INLINE(tpidrprw, p15,0,%0,c13,c0,4) /* PL1 only Thread ID Register */
 ARMREG_WRITE_INLINE(tpidrprw, p15,0,%0,c13,c0,4) /* PL1 only Thread ID Register */
 ARMREG_READ_INLINE(cbar, p15,4,%0,c15,c0,0)	/* Configuration Base Address Register */
-/* c13 registers */
+/* c14 registers */
+/* Global Timer Registers */
+ARMREG_READ_INLINE(cntfrq, p15,0,%0,c14,c0,0) /* Counter Frequency Register */
+ARMREG_WRITE_INLINE(cntfrq, p15,0,%0,c14,c0,0) /* Counter Frequency Register */
+ARMREG_READ_INLINE(cntkctl, p15,0,%0,c14,c1,0) /* Timer PL1 Control Register */
+ARMREG_WRITE_INLINE(cntkctl, p15,0,%0,c14,c1,0) /* Timer PL1 Control Register */
+ARMREG_READ_INLINE(cntp_tval, p15,0,%0,c14,c2,0) /* PL1 Physical TimerValue Register */
+ARMREG_WRITE_INLINE(cntp_tval, p15,0,%0,c14,c2,0) /* PL1 Physical TimerValue Register */
+ARMREG_READ_INLINE(cntp_ctl, p15,0,%0,c14,c2,1) /* PL1 Physical Timer Control Register */
+ARMREG_WRITE_INLINE(cntp_ctl, p15,0,%0,c14,c2,1) /* PL1 Physical Timer Control Register */
+ARMREG_READ_INLINE(cntv_tval, p15,0,%0,c14,c3,0) /* Virtual TimerValue Register */
+ARMREG_WRITE_INLINE(cntv_tval, p15,0,%0,c14,c3,0) /* Virtual TimerValue Register */
+ARMREG_READ_INLINE(cntv_ctl, p15,0,%0,c14,c3,1) /* Virtual Timer Control Register */
+ARMREG_WRITE_INLINE(cntv_ctl, p15,0,%0,c14,c3,1) /* Virtual Timer Control Register */
+ARMREG_READ64_INLINE(cntpct, p15,0,%Q0,%R0,c14) /* Physical Count Register */
+ARMREG_WRITE64_INLINE(cntpct, p15,0,%Q0,%R0,c14) /* Physical Count Register */
+ARMREG_READ64_INLINE(cntvct, p15,1,%Q0,%R0,c14) /* Virtual Count Register */
+ARMREG_WRITE64_INLINE(cntvct, p15,1,%Q0,%R0,c14) /* Virtual Count Register */
+ARMREG_READ64_INLINE(cntp_cval, p15,2,%Q0,%R0,c14) /* PL1 Physical Timer CompareValue Register */
+ARMREG_WRITE64_INLINE(cntp_cval, p15,2,%Q0,%R0,c14) /* PL1 Physical Timer CompareValue Register */
+ARMREG_READ64_INLINE(cntv_cval, p15,3,%Q0,%R0,c14) /* PL1 Virtual Timer 

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

2012-12-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 25 22:34:36 UTC 2012

Modified Files:
src/sys/arch/arm/include: proc.h

Log Message:
Fix comment.  Add MDLWP_VFPINTR


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/include/proc.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/arm/include/proc.h
diff -u src/sys/arch/arm/include/proc.h:1.12 src/sys/arch/arm/include/proc.h:1.13
--- src/sys/arch/arm/include/proc.h:1.12	Thu Aug 16 17:35:01 2012
+++ src/sys/arch/arm/include/proc.h	Tue Dec 25 22:34:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.12 2012/08/16 17:35:01 matt Exp $	*/
+/*	$NetBSD: proc.h,v 1.13 2012/12/25 22:34:36 matt Exp $	*/
 
 /*
  * Copyright (c) 1994 Mark Brinicombe.
@@ -48,8 +48,9 @@ struct mdlwp {
 };
 
 /* Flags setttings for md_flags */
-#define MDLWP_VFPUSED		0x0001	/* Process used the VFP */
+#define MDLWP_VFPUSED		0x0001	/* LWP used the VFP */
 #define MDLWP_NOALIGNFLT	0x0002	/* For EXEC_AOUT */
+#define MDLWP_VFPINTR		0x0004	/* VFP used in intr */
 
 
 struct mdproc {



CVS commit: src/sbin/savecore

2012-12-25 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Tue Dec 25 09:24:45 UTC 2012

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

Log Message:
Consistent use of return.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/savecore/zopen.c

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



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

2012-12-25 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Tue Dec 25 10:51:04 UTC 2012

Modified Files:
src/sys/arch/i386/conf: GENERIC files.i386

Log Message:
Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.1085 -r1.1086 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.369 -r1.370 src/sys/arch/i386/conf/files.i386

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:02:35 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Add a DEBUG function to search the Flash for byte-streams, as U-Boot usually
doesn't offer a search function.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sandpoint/stand/altboot/main.c

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



CVS commit: src/sys/arch/sandpoint/stand/altboot

2012-12-25 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Dec 25 17:07:07 UTC 2012

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c rge.c

Log Message:
QNAP V200 boards have no EEPROM for the MAC address, so all devices default
to the same address (00:e0:4c:69:20:01).
Now we read the real MAC address from the flash ROM. It is stored at the
beginning of a 512-byte block in ASCII format. Some QNAP's have a broken
ext2 file system, so we cannot look for the file ETH0.MAC_ADDR therein,
but have to search the whole flash in 512-byte steps for candidates...


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sandpoint/stand/altboot/brdsetup.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/altboot/rge.c

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



CVS commit: src/usr.sbin/puffs/mount_psshfs

2012-12-25 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Tue Dec 25 20:31:04 UTC 2012

Modified Files:
src/usr.sbin/puffs/mount_psshfs: mount_psshfs.8

Log Message:
fix spelling typo


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/puffs/mount_psshfs/mount_psshfs.8

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



CVS commit: [netbsd-6] src/sbin/sysctl

2012-12-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 25 21:01:14 UTC 2012

Modified Files:
src/sbin/sysctl [netbsd-6]: sysctl.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #757):
sbin/sysctl/sysctl.c: revision 1.149
Add missing free() in error path.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.140.2.1 src/sbin/sysctl/sysctl.c

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



CVS commit: [netbsd-6] src/usr.bin/netstat

2012-12-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 25 21:07:05 UTC 2012

Modified Files:
src/usr.bin/netstat [netbsd-6]: bpf.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #763):
usr.bin/netstat/bpf.c: revision 1.11
Fix memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.8.1 src/usr.bin/netstat/bpf.c

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



CVS commit: [netbsd-6] src/usr.bin/sed

2012-12-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Dec 25 21:10:35 UTC 2012

Modified Files:
src/usr.bin/sed [netbsd-6]: compile.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #764):
usr.bin/sed/compile.c: revision 1.38
Fix memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.37.8.1 src/usr.bin/sed/compile.c

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



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

2012-12-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 25 22:33:39 UTC 2012

Modified Files:
src/sys/arch/arm/include: armreg.h

Log Message:
Add CP15 Generic Timer definitions.
Add cortex PMUSERENR inlines


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/arm/include/armreg.h

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



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

2012-12-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec 25 22:34:36 UTC 2012

Modified Files:
src/sys/arch/arm/include: proc.h

Log Message:
Fix comment.  Add MDLWP_VFPINTR


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/include/proc.h

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