CVS commit: src/usr.bin/wc

2010-02-18 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Thu Feb 18 10:43:50 UTC 2010

Modified Files:
src/usr.bin/wc: wc.1 wc.c

Log Message:
Add support for -L option (longest line) as present in the GNU and
FreeBSD version of wc.

No objections on tech-userlevel mailing list.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/wc/wc.1
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/wc/wc.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/wc/wc.1
diff -u src/usr.bin/wc/wc.1:1.13 src/usr.bin/wc/wc.1:1.14
--- src/usr.bin/wc/wc.1:1.13	Thu Aug  7 11:17:15 2003
+++ src/usr.bin/wc/wc.1	Thu Feb 18 10:43:50 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: wc.1,v 1.13 2003/08/07 11:17:15 agc Exp $
+.\	$NetBSD: wc.1,v 1.14 2010/02/18 10:43:50 tron Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\
 .\ from: @(#)wc.1	8.2 (Berkeley) 4/19/94
 .\
-.Dd April 19, 1994
+.Dd February 18, 2010
 .Dt WC 1
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl c | Fl m
-.Op Fl lw
+.Op Fl Llw
 .Op Ar file ...
 .Sh DESCRIPTION
 The
@@ -66,6 +66,9 @@
 .It Fl c
 The number of bytes in each input file
 is written to the standard output.
+.It Fl L
+The number of characters in the longest line of each input file
+is written to the standard output.
 .It Fl l
 The number of lines in each input file
 is written to the standard output.
@@ -125,6 +128,13 @@
 .Xr iswspace 3
 function, as required by
 .St -p1003.2 .
+.Pp
+The
+.Fl L
+option is a non-standard extension, compatible with the
+.Fl L
+option of the GNU and
+.Fx wc utility.
 .Sh STANDARDS
 The
 .Nm

Index: src/usr.bin/wc/wc.c
diff -u src/usr.bin/wc/wc.c:1.32 src/usr.bin/wc/wc.c:1.33
--- src/usr.bin/wc/wc.c:1.32	Tue Apr 14 07:58:38 2009
+++ src/usr.bin/wc/wc.c	Thu Feb 18 10:43:50 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wc.c,v 1.32 2009/04/14 07:58:38 lukem Exp $	*/
+/*	$NetBSD: wc.c,v 1.33 2010/02/18 10:43:50 tron Exp $	*/
 
 /*
  * Copyright (c) 1980, 1987, 1991, 1993
@@ -39,11 +39,11 @@
 #if 0
 static char sccsid[] = @(#)wc.c	8.2 (Berkeley) 5/2/95;
 #else
-__RCSID($NetBSD: wc.c,v 1.32 2009/04/14 07:58:38 lukem Exp $);
+__RCSID($NetBSD: wc.c,v 1.33 2010/02/18 10:43:50 tron Exp $);
 #endif
 #endif /* not lint */
 
-/* wc line, word and char count */
+/* wc line, word, char count and optionally longest line. */
 
 #include sys/param.h
 #include sys/file.h
@@ -54,6 +54,7 @@
 #include err.h
 #include errno.h
 #include locale.h
+#include stdbool.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -71,12 +72,13 @@
 # define WCCAST	unsigned long long
 #endif
 
-static wc_count_t	tlinect, twordct, tcharct;
-static int		doline, doword, dobyte, dochar;
+static wc_count_t	tlinect, twordct, tcharct, tlongest;
+static bool		doline, doword, dobyte, dochar, dolongest;
 static int 		rval = 0;
 
 static void	cnt(const char *);
-static void	print_counts(wc_count_t, wc_count_t, wc_count_t, const char *);
+static void	print_counts(wc_count_t, wc_count_t, wc_count_t, wc_count_t,
+		const char *);
 static void	usage(void);
 static size_t	do_mb(wchar_t *, const char *, size_t, mbstate_t *,
 		size_t *, const char *);
@@ -89,21 +91,24 @@
 
 	setlocale(LC_ALL, );
 
-	while ((ch = getopt(argc, argv, lwcm)) != -1)
+	while ((ch = getopt(argc, argv, lwcmL)) != -1)
 		switch (ch) {
 		case 'l':
-			doline = 1;
+			doline = true;
 			break;
 		case 'w':
-			doword = 1;
+			doword = true;
 			break;
 		case 'm':
-			dochar = 1;
+			dochar = true;
 			dobyte = 0;
 			break;
 		case 'c':
 			dochar = 0;
-			dobyte = 1;
+			dobyte = true;
+			break;
+		case 'L':
+			dolongest = true;
 			break;
 		case '?':
 		default:
@@ -113,20 +118,22 @@
 	argc -= optind;
 
 	/* Wc's flags are on by default. */
-	if (doline + doword + dobyte + dochar == 0)
-		doline = doword = dobyte = 1;
+	if (!(doline || doword || dobyte || dochar || dolongest))
+		doline = doword = dobyte = true;
 
-	if (!*argv) {
+	if (*argv == NULL) {
 		cnt(NULL);
 	} else {
-		int dototal = (argc  1);
+		bool dototal = (argc  1);
 
 		do {
 			cnt(*argv);
 		} while(*++argv);
 
-		if (dototal)
-			print_counts(tlinect, twordct, tcharct, total);
+		if (dototal) {
+			print_counts(tlinect, twordct, tcharct, tlongest,
+			total);
+		}
 	}
 
 	exit(rval);
@@ -172,7 +179,7 @@
 	u_char buf[MAXBSIZE];
 	wchar_t wbuf[MAXBSIZE];
 	struct stat sb;
-	wc_count_t charct, linect, wordct;
+	wc_count_t charct, linect, wordct, longest;
 	mbstate_t st;
 	u_char *C;
 	wchar_t *WC;
@@ -180,8 +187,8 @@
 	size_t r = 0;
 	int fd, gotsp, len = 0;
 
-	linect = wordct = charct = 0;
-	if (file) {
+	linect = wordct = charct = longest = 0;
+	if (file != NULL) {
 		if ((fd = open(file, O_RDONLY, 0))  0) {
 			warn(%s, file);
 			rval = 1;
@@ -202,7 +209,8 @@
 		 * faster to get lines than to get words, since
 		 * the word count requires some logic.
 		 */
-		if (doline || 

CVS commit: src/sys/rump/librump/rumpuser

2010-02-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb 18 12:21:28 UTC 2010

Modified Files:
src/sys/rump/librump/rumpuser: rumpuser.c

Log Message:
Allow NULL as size and file type pointers.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/rump/librump/rumpuser/rumpuser.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/rump/librump/rumpuser/rumpuser.c
diff -u src/sys/rump/librump/rumpuser/rumpuser.c:1.47 src/sys/rump/librump/rumpuser/rumpuser.c:1.48
--- src/sys/rump/librump/rumpuser/rumpuser.c:1.47	Tue Dec  8 08:18:24 2009
+++ src/sys/rump/librump/rumpuser/rumpuser.c	Thu Feb 18 12:21:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.c,v 1.47 2009/12/08 08:18:24 stacktic Exp $	*/
+/*	$NetBSD: rumpuser.c,v 1.48 2010/02/18 12:21:28 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: rumpuser.c,v 1.47 2009/12/08 08:18:24 stacktic Exp $);
+__RCSID($NetBSD: rumpuser.c,v 1.48 2010/02/18 12:21:28 pooka Exp $);
 #endif /* !lint */
 
 /* thank the maker for this */
@@ -69,10 +69,11 @@
 #include rumpuser_int.h
 
 int
-rumpuser_getfileinfo(const char *path, uint64_t *size, int *ft, int *error)
+rumpuser_getfileinfo(const char *path, uint64_t *sizep, int *ftp, int *error)
 {
 	struct stat sb;
-	int needsdev = 0;
+	uint64_t size;
+	int needsdev = 0, rv = 0, ft;
 
 	if (stat(path, sb) == -1) {
 		*error = errno;
@@ -81,26 +82,26 @@
 
 	switch (sb.st_mode  S_IFMT) {
 	case S_IFDIR:
-		*ft = RUMPUSER_FT_DIR;
+		ft = RUMPUSER_FT_DIR;
 		break;
 	case S_IFREG:
-		*ft = RUMPUSER_FT_REG;
+		ft = RUMPUSER_FT_REG;
 		break;
 	case S_IFBLK:
-		*ft = RUMPUSER_FT_BLK;
+		ft = RUMPUSER_FT_BLK;
 		needsdev = 1;
 		break;
 	case S_IFCHR:
-		*ft = RUMPUSER_FT_CHR;
+		ft = RUMPUSER_FT_CHR;
 		needsdev = 1;
 		break;
 	default:
-		*ft = RUMPUSER_FT_OTHER;
+		ft = RUMPUSER_FT_OTHER;
 		break;
 	}
 
 	if (!needsdev) {
-		*size = sb.st_size;
+		size = sb.st_size;
 	} else {
 		/*
 		 * Welcome to the jungle.  Of course querying the kernel
@@ -123,19 +124,21 @@
 		fd = open(path, O_RDONLY);
 		if (fd == -1) {
 			*error = errno;
-			return -1;
+			rv = -1;
+			goto out;
 		}
 
 		off = lseek(fd, 0, SEEK_END);
 		close(fd);
 		if (off != 0) {
-			*size = off;
-			return 0;
+			size = off;
+			goto out;
 		}
 		fprintf(stderr, error: device size query not implemented on 
 		this platform\n);
 		*error = EOPNOTSUPP;
-		return -1;
+		rv = -1;
+		goto out;
 #else
 		struct disklabel lab;
 		struct partition *parta;
@@ -144,21 +147,29 @@
 		fd = open(path, O_RDONLY);
 		if (fd == -1) {
 			*error = errno;
-			return -1;
+			rv = -1;
+			goto out;
 		}
 
 		if (ioctl(fd, DIOCGDINFO, lab) == -1) {
 			*error = errno;
-			return -1;
+			rv = -1;
+			goto out;
 		}
 		close(fd);
 
 		parta = lab.d_partitions[DISKPART(sb.st_rdev)];
-		*size = (uint64_t)lab.d_secsize * parta-p_size;
+		size = (uint64_t)lab.d_secsize * parta-p_size;
 #endif /* __NetBSD__ */
 	}
 
-	return 0;
+ out:
+	if (rv == 0  sizep)
+		*sizep = size;
+	if (rv == 0  ftp)
+		*ftp = ft;
+
+	return rv;
 }
 
 int



CVS commit: src/distrib/utils/sysinst

2010-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 18 12:21:52 UTC 2010

Modified Files:
src/distrib/utils/sysinst: bsddisklabel.c

Log Message:
Since we call /usr and /var with absolute paths, lets do that for /tmp
as well.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/distrib/utils/sysinst/bsddisklabel.c

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

Modified files:

Index: src/distrib/utils/sysinst/bsddisklabel.c
diff -u src/distrib/utils/sysinst/bsddisklabel.c:1.53 src/distrib/utils/sysinst/bsddisklabel.c:1.54
--- src/distrib/utils/sysinst/bsddisklabel.c:1.53	Sun Oct 18 12:09:48 2009
+++ src/distrib/utils/sysinst/bsddisklabel.c	Thu Feb 18 12:21:52 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.53 2009/10/18 12:09:48 ahoka Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.54 2010/02/18 12:21:52 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -359,9 +359,9 @@
 	 	  DEFSWAPSIZE,	DEFSWAPSIZE, 0, 0 },
 		{ PART_TMP_RAMDISK,
 #ifdef HAVE_TMPFS
-		  { 't', 'm', 'p', ' ', '(', 't', 'm', 'p', 'f', 's', ')', '\0' },
+		  { '/', 't', 'm', 'p', ' ', '(', 't', 'm', 'p', 'f', 's', ')', '\0' },
 #else
-		  { 't', 'm', 'p', ' ', '(', 'm', 'f', 's', ')', '\0' },
+		  { '/', 't', 'm', 'p', ' ', '(', 'm', 'f', 's', ')', '\0' },
 #endif
 		  64, 0, 0, 0 },
 #define PI_USR 3



CVS commit: src/sys/dev/sysmon

2010-02-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Feb 18 12:30:53 UTC 2010

Modified Files:
src/sys/dev/sysmon: sysmon_envsys_events.c

Log Message:
If we're going to valdate things, at least do it correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/sysmon/sysmon_envsys_events.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/sysmon/sysmon_envsys_events.c
diff -u src/sys/dev/sysmon/sysmon_envsys_events.c:1.84 src/sys/dev/sysmon/sysmon_envsys_events.c:1.85
--- src/sys/dev/sysmon/sysmon_envsys_events.c:1.84	Mon Feb 15 22:32:04 2010
+++ src/sys/dev/sysmon/sysmon_envsys_events.c	Thu Feb 18 12:30:53 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys_events.c,v 1.84 2010/02/15 22:32:04 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys_events.c,v 1.85 2010/02/18 12:30:53 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sysmon_envsys_events.c,v 1.84 2010/02/15 22:32:04 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: sysmon_envsys_events.c,v 1.85 2010/02/18 12:30:53 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -101,21 +101,32 @@
 	/*
 	 * Some validation first for limit-checking events
 	 *
-	 * Capacity limits are permitted only if the sensor has the
-	 * ENVSYS_FPERCENT flag set.
-	 * Value limits are permitted only if the ENVSYS_FPERCENT
-	 * flag is not set and the units is not ENVSYS_INDICATOR.
+	 * 1. Limits are not permitted if the units is ENVSYS_INDICATOR.
+	 *
+	 * 2. Capacity limits are permitted only if the sensor has the
+	 *ENVSYS_FPERCENT flag set and value_max is set.
+	 *
+	 * 3. It is not permissible for both capacity and value limits
+	 *to coexist.
+	 *
+	 * Note that it permissible for a sensor to have value limits
+	 * even if its ENVSYS_FPERCENT flag and value_max are set.
 	 */
 
 	DPRINTF((%s: units %d props 0x%04x edata-flags 0x%04x\n,
 		__func__, edata-units, props, edata-flags));
 
-	if ((props  PROP_VAL_LIMITS) 
-	((edata-flags  ENVSYS_FPERCENT) ||
-	 (edata-units == ENVSYS_INDICATOR)))
+	if (props  edata-units == ENVSYS_INDICATOR)
 		return ENOTSUP;
+
 	if ((props  PROP_CAP_LIMITS) 
-	!(edata-flags  ENVSYS_FPERCENT))
+	((edata-value_max == 0) ||
+	 !(edata-flags  ENVSYS_FPERCENT) ||
+	 (props  PROP_VAL_LIMITS) ||
+	 (edata-upropset  PROP_VAL_LIMITS)))
+		return ENOTSUP;
+
+	if ((props  PROP_VAL_LIMITS)  (edata-upropset  PROP_CAP_LIMITS))
 		return ENOTSUP;
 
 	/* 



CVS commit: src/sys/rump/librump/rumpuser

2010-02-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb 18 12:32:30 UTC 2010

Modified Files:
src/sys/rump/librump/rumpuser: rumpuser.c

Log Message:
Also, don't try to figure out the size of devices if size matters not.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/rump/librump/rumpuser/rumpuser.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/rump/librump/rumpuser/rumpuser.c
diff -u src/sys/rump/librump/rumpuser/rumpuser.c:1.48 src/sys/rump/librump/rumpuser/rumpuser.c:1.49
--- src/sys/rump/librump/rumpuser/rumpuser.c:1.48	Thu Feb 18 12:21:28 2010
+++ src/sys/rump/librump/rumpuser/rumpuser.c	Thu Feb 18 12:32:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.c,v 1.48 2010/02/18 12:21:28 pooka Exp $	*/
+/*	$NetBSD: rumpuser.c,v 1.49 2010/02/18 12:32:30 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: rumpuser.c,v 1.48 2010/02/18 12:21:28 pooka Exp $);
+__RCSID($NetBSD: rumpuser.c,v 1.49 2010/02/18 12:32:30 pooka Exp $);
 #endif /* !lint */
 
 /* thank the maker for this */
@@ -102,7 +102,7 @@
 
 	if (!needsdev) {
 		size = sb.st_size;
-	} else {
+	} else if (sizep) {
 		/*
 		 * Welcome to the jungle.  Of course querying the kernel
 		 * for a device partition size is supposed to be far from



CVS commit: src/usr.bin/wc

2010-02-18 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 18 13:14:52 UTC 2010

Modified Files:
src/usr.bin/wc: wc.1

Log Message:
New sentence, new line. Add EXIT STATUS section and use .Ex.
Fix macro argument abuse.
Use Aq instead of \*[Lt]\*[Gt].


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/wc/wc.1

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/wc/wc.1
diff -u src/usr.bin/wc/wc.1:1.14 src/usr.bin/wc/wc.1:1.15
--- src/usr.bin/wc/wc.1:1.14	Thu Feb 18 10:43:50 2010
+++ src/usr.bin/wc/wc.1	Thu Feb 18 13:14:51 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: wc.1,v 1.14 2010/02/18 10:43:50 tron Exp $
+.\	$NetBSD: wc.1,v 1.15 2010/02/18 13:14:51 wiz Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -84,9 +84,8 @@
 .Nm
 only
 reports the
-information requested by that option. The
-default action is equivalent to all the
-flags
+information requested by that option.
+The default action is equivalent to all the flags
 .Fl clw
 having been specified.
 .Pp
@@ -105,17 +104,20 @@
 .Bd -literal -offset indent
 lines	 words	bytes	file_name
 .Ed
-.Pp
-The
-.Nm
-utility exits 0 on success, and \*[Gt]0 if an error occurs.
+.Sh EXIT STATUS
+.Ex -std wc
 .Sh SEE ALSO
 .Xr iswspace 3
 .Sh COMPATIBILITY
 Historically, the
 .Nm
 utility was documented to define a word as a ``maximal string of
-characters delimited by \*[Lt]space\*[Gt], \*[Lt]tab\*[Gt] or \*[Lt]newline\*[Gt] characters''.
+characters delimited by
+.Aq space ,
+.Aq tab
+or
+.Aq newline
+characters''.
 The implementation, however, didn't handle non-printing characters
 correctly so that ``  ^D^E  '' counted as 6 spaces, while ``foo^D^Ebar''
 counted as 8 characters.
@@ -134,7 +136,9 @@
 option is a non-standard extension, compatible with the
 .Fl L
 option of the GNU and
-.Fx wc utility.
+.Fx
+.Nm
+utilities.
 .Sh STANDARDS
 The
 .Nm



CVS commit: src/sbin/newfs_ext2fs

2010-02-18 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 18 13:49:19 UTC 2010

Modified Files:
src/sbin/newfs_ext2fs: newfs_ext2fs.8

Log Message:
Fix pasto noted by tsutsui.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/newfs_ext2fs/newfs_ext2fs.8

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

Modified files:

Index: src/sbin/newfs_ext2fs/newfs_ext2fs.8
diff -u src/sbin/newfs_ext2fs/newfs_ext2fs.8:1.8 src/sbin/newfs_ext2fs/newfs_ext2fs.8:1.9
--- src/sbin/newfs_ext2fs/newfs_ext2fs.8:1.8	Wed Feb 17 21:39:14 2010
+++ src/sbin/newfs_ext2fs/newfs_ext2fs.8	Thu Feb 18 13:49:19 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: newfs_ext2fs.8,v 1.8 2010/02/17 21:39:14 wiz Exp $
+.\	$NetBSD: newfs_ext2fs.8,v 1.9 2010/02/18 13:49:19 wiz Exp $
 .\
 .\ Copyright (c) 1983, 1987, 1991, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -231,7 +231,7 @@
 .El
 .Sh NOTES
 There is no option to specify the metadata byte order on the file system
-to be created the because native ext2 file system is always little endian
+to be created because the native ext2 file system is always little endian
 even on big endian hosts.
 .Pp
 The file system is created with



CVS commit: src/sbin/newfs

2010-02-18 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 18 13:51:45 UTC 2010

Modified Files:
src/sbin/newfs: newfs.8

Log Message:
Pull over some of Jason McIntyre's fixes for newfs_ext2fs.
Suggested by tsutsui.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sbin/newfs/newfs.8

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

Modified files:

Index: src/sbin/newfs/newfs.8
diff -u src/sbin/newfs/newfs.8:1.75 src/sbin/newfs/newfs.8:1.76
--- src/sbin/newfs/newfs.8:1.75	Tue Dec  1 10:56:33 2009
+++ src/sbin/newfs/newfs.8	Thu Feb 18 13:51:45 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: newfs.8,v 1.75 2009/12/01 10:56:33 pooka Exp $
+.\	$NetBSD: newfs.8,v 1.76 2010/02/18 13:51:45 wiz Exp $
 .\
 .\ Copyright (c) 1983, 1987, 1991, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -78,13 +78,13 @@
 Bytes; causes no modification.
 (Default)
 .It k
-Kilo; multiply the argument by 1024
+Kilo; multiply the argument by 1024.
 .It m
-Mega; multiply the argument by 1048576
+Mega; multiply the argument by 1048576.
 .It g
-Giga; multiply the argument by 1073741824
+Giga; multiply the argument by 1073741824.
 .It t
-Tera; multiply the argument by 1099511627776
+Tera; multiply the argument by 1099511627776.
 .El
 .Pp
 The following options define the general layout policies.
@@ -202,7 +202,7 @@
 .Fl n
 takes precedence.
 .It Fl O Ar filesystem-format
-Select the filesystem-format
+Select the filesystem-format.
 .Bl -tag -width 3n -offset indent -compact
 .It 0
 4.3BSD; This option is primarily used to build root file systems that can be
@@ -271,7 +271,7 @@
 This controls the amount of information written to stdout:
 .Bl -tag -width 3n -offset indent -compact
 .It 0
-No output
+No output.
 .It 1
 Overall size and cylinder group details.
 .It 2
@@ -285,7 +285,7 @@
 The default is 3.
 If
 .Fl N
-is specifed
+is specified
 .Nm
 stops before outputting the progress bar.
 .It Fl Z
@@ -318,8 +318,8 @@
 .Sq random
 inode generation numbers to improve NFS security.
 .Pp
-The owner and group ids of the root node of the new file system
-are set to the effective uid and gid of the user initializing
+The owner and group IDs of the root node of the new file system
+are set to the effective UID and GID of the user initializing
 the file system.
 .Pp
 For the
@@ -341,9 +341,9 @@
 utility.
 .Pp
 The partition size is found using
-.Xr fstat 2
-not by inspecting the disklabel.
-The block size and fragment size will be written back to the disklabel
+.Xr fstat 2 ,
+not by inspecting the disk label.
+The block size and fragment size will be written back to the disk label
 only if the last character of
 .Ar special
 references the same partition as the minor device number.



CVS commit: src/sys/dev/acpi

2010-02-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Feb 18 13:52:33 UTC 2010

Modified Files:
src/sys/dev/acpi: aiboost.c

Log Message:
Enhance DPRINTF to use AcpiFormatException as suggested in PR kern/40130


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/acpi/aiboost.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/acpi/aiboost.c
diff -u src/sys/dev/acpi/aiboost.c:1.27 src/sys/dev/acpi/aiboost.c:1.28
--- src/sys/dev/acpi/aiboost.c:1.27	Wed Sep 16 10:47:54 2009
+++ src/sys/dev/acpi/aiboost.c	Thu Feb 18 13:52:33 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: aiboost.c,v 1.27 2009/09/16 10:47:54 mlelstv Exp $ */
+/* $NetBSD: aiboost.c,v 1.28 2010/02/18 13:52:33 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aiboost.c,v 1.27 2009/09/16 10:47:54 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: aiboost.c,v 1.28 2010/02/18 13:52:33 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -320,13 +320,15 @@
 
 	status = AcpiGetHandle(h, name, h1);
 	if (ACPI_FAILURE(status)) {
-		DPRINTF((%s: AcpiGetHandle\n, __func__));
+		DPRINTF((%s: AcpiGetHandle: %s\n, __func__,
+			AcpiFormatException(status) ));
 		return status;
 	}
 
 	status = acpi_eval_struct(h1, NULL, buf);
 	if (ACPI_FAILURE(status)) {
-		DPRINTF((%s: acpi_eval_struct\n, __func__));
+		DPRINTF((%s: acpi_eval_struct: %s\n, __func__,
+			AcpiFormatException(status) ));
 		return status;
 	}
 
@@ -378,8 +380,8 @@
 			c-elem[i].h = elem-Reference.Handle;
 			status = acpi_eval_struct(c-elem[i].h, NULL, buf2);
 			if (ACPI_FAILURE(status)) {
-DPRINTF((%s: fetching object in buf2\n,
-__func__));
+DPRINTF((%s: fetching object in buf2: %s\n,
+__func__, AcpiFormatException(status) ));
 goto error;
 			}
 			subobj = buf2.Pointer;



CVS commit: src

2010-02-18 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 18 14:00:40 UTC 2010

Modified Files:
src/common/lib/libprop: prop_ingest.3
src/crypto/external/bsd/openssl/dist/doc/apps: tsget.pod
src/crypto/external/bsd/openssl/lib/libcrypto/man: openssl_tsget.1
src/dist/libpcap: gencode.c
src/external/gpl2/lvm2/dist/man: pvmove.8 pvmove.8.in
src/gnu/dist/groff/contrib/mm: groff_mm.man
src/gnu/dist/texinfo/doc: texinfo.txi
src/gnu/dist/texinfo/info: info.c
src/sbin/newfs: mount_mfs.8
src/usr.bin/sdpquery: sdpquery.1

Log Message:
Fix typo (specifed - specified).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libprop/prop_ingest.3
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/openssl/dist/doc/apps/tsget.pod
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_tsget.1
cvs rdiff -u -r1.4 -r1.5 src/dist/libpcap/gencode.c
cvs rdiff -u -r1.2 -r1.3 src/external/gpl2/lvm2/dist/man/pvmove.8
cvs rdiff -u -r1.1.1.3 -r1.2 src/external/gpl2/lvm2/dist/man/pvmove.8.in
cvs rdiff -u -r1.1.1.3 -r1.2 src/gnu/dist/groff/contrib/mm/groff_mm.man
cvs rdiff -u -r1.1.1.7 -r1.2 src/gnu/dist/texinfo/doc/texinfo.txi
cvs rdiff -u -r1.11 -r1.12 src/gnu/dist/texinfo/info/info.c
cvs rdiff -u -r1.15 -r1.16 src/sbin/newfs/mount_mfs.8
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/sdpquery/sdpquery.1

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/libprop/prop_ingest.3
diff -u src/common/lib/libprop/prop_ingest.3:1.5 src/common/lib/libprop/prop_ingest.3:1.6
--- src/common/lib/libprop/prop_ingest.3:1.5	Wed Apr 30 13:10:46 2008
+++ src/common/lib/libprop/prop_ingest.3	Thu Feb 18 14:00:39 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: prop_ingest.3,v 1.5 2008/04/30 13:10:46 martin Exp $
+.\	$NetBSD: prop_ingest.3,v 1.6 2010/02/18 14:00:39 wiz Exp $
 .\
 .\ Copyright (c) 2006 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -153,7 +153,7 @@
 .It Dv PROP_INGEST_ERROR_NO_KEY
 A non-optional key was not found in the dictionary.
 .It Dv PROP_INGEST_ERROR_WRONG_TYPE
-An object in the dictionary was not the same type specifed in the rules.
+An object in the dictionary was not the same type specified in the rules.
 .It Dv PROP_INGEST_ERROR_HANDLER_FAILED
 An object's handler returned
 .Dv false .

Index: src/crypto/external/bsd/openssl/dist/doc/apps/tsget.pod
diff -u src/crypto/external/bsd/openssl/dist/doc/apps/tsget.pod:1.1.1.1 src/crypto/external/bsd/openssl/dist/doc/apps/tsget.pod:1.2
--- src/crypto/external/bsd/openssl/dist/doc/apps/tsget.pod:1.1.1.1	Sun Jul 19 23:01:54 2009
+++ src/crypto/external/bsd/openssl/dist/doc/apps/tsget.pod	Thu Feb 18 14:00:39 2010
@@ -124,7 +124,7 @@
 =item [request]...
 
 List of files containing BRFC 3161 DER-encoded time stamp requests. If no
-requests are specifed only one request will be sent to the server and it will be
+requests are specified only one request will be sent to the server and it will be
 read from the standard input. (Optional)
 
 =back

Index: src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_tsget.1
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_tsget.1:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_tsget.1:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_tsget.1:1.2	Sun Jan 24 21:20:03 2010
+++ src/crypto/external/bsd/openssl/lib/libcrypto/man/openssl_tsget.1	Thu Feb 18 14:00:39 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: openssl_tsget.1,v 1.2 2010/01/24 21:20:03 joerg Exp $
+.\	$NetBSD: openssl_tsget.1,v 1.3 2010/02/18 14:00:39 wiz Exp $
 .\
 .\ Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
 .\
@@ -249,7 +249,7 @@
 .IP [request]... 4
 .IX Item [request]...
 List of files containing \fB\s-1RFC\s0 3161\fR DER-encoded time stamp requests. If no
-requests are specifed only one request will be sent to the server and it will be
+requests are specified only one request will be sent to the server and it will be
 read from the standard input. (Optional)
 .SH ENVIRONMENT VARIABLES
 .IX Header ENVIRONMENT VARIABLES

Index: src/dist/libpcap/gencode.c
diff -u src/dist/libpcap/gencode.c:1.4 src/dist/libpcap/gencode.c:1.5
--- src/dist/libpcap/gencode.c:1.4	Sun Oct 15 19:27:21 2006
+++ src/dist/libpcap/gencode.c	Thu Feb 18 14:00:39 2010
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-@(#) $Header: /cvsroot/src/dist/libpcap/gencode.c,v 1.4 2006/10/15 19:27:21 christos Exp $ (LBL);
+@(#) $Header: /cvsroot/src/dist/libpcap/gencode.c,v 1.5 2010/02/18 14:00:39 wiz Exp $ (LBL);
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -5292,7 +5292,7 @@
 
 		/*
 		 * Load into the X register the offset computed into the
-		 * register specifed by index.
+		 * register specified by index.
 		 */
 		s = xfer_to_x(inst);
 

Index: src/external/gpl2/lvm2/dist/man/pvmove.8
diff -u 

CVS commit: src/sys/dev/acpi

2010-02-18 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Feb 18 14:10:15 UTC 2010

Modified Files:
src/sys/dev/acpi: acpi_tz.c

Log Message:
Print correct temperature value, and properly display negative temperatures.

Resolves PR kern/36615


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/acpi/acpi_tz.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/acpi/acpi_tz.c
diff -u src/sys/dev/acpi/acpi_tz.c:1.58 src/sys/dev/acpi/acpi_tz.c:1.59
--- src/sys/dev/acpi/acpi_tz.c:1.58	Sun Feb 14 23:06:58 2010
+++ src/sys/dev/acpi/acpi_tz.c	Thu Feb 18 14:10:15 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.58 2010/02/14 23:06:58 pgoyette Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.59 2010/02/18 14:10:15 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2003 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: acpi_tz.c,v 1.58 2010/02/14 23:06:58 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: acpi_tz.c,v 1.59 2010/02/18 14:10:15 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -355,9 +355,11 @@
 acpitz_celcius_string(int dk)
 {
 	static char buf[10];
+	int dc;
 
-	snprintf(buf, sizeof(buf), %d.%d, (dk - ATZ_ZEROC) / 10,
-	(dk - ATZ_ZEROC) % 10);
+	dc = abs(dk - ATZ_ZEROC);
+	snprintf(buf, sizeof(buf), %s%d.%d, (dk = ATZ_ZEROC)?:-,
+		dc / 10, dc % 10);
 
 	return buf;
 }
@@ -526,7 +528,7 @@
 			acpitz_celcius_string(sc-sc_zone.hot));
 		if (sc-sc_zone.psv != ATZ_TMP_INVALID)
 			aprint_normal( passive %sC,
-			acpitz_celcius_string(sc-sc_zone.tmp));
+			acpitz_celcius_string(sc-sc_zone.psv));
 	}
 
 	if (valid_levels == 0) {



CVS commit: src/sys/uvm

2010-02-18 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Thu Feb 18 14:57:01 UTC 2010

Modified Files:
src/sys/uvm: files.uvm uvm_map.c

Log Message:
Disable mapping of virtual address 0 by user programs per default.
This blocks an easy exploit of kernel bugs leading to dereference
of a NULL pointer on some architectures (eg i386).
The check can be disabled in various ways:
-by CPP definitions in machine/types.h (portmaster's choice)
-by a kernel config option USER_VA0_DISABLED_DEFAULT=0
-at runtime by sysctl vm.user_va0_disabled (cannot be cleared
 at securelevel0)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/uvm/files.uvm
cvs rdiff -u -r1.287 -r1.288 src/sys/uvm/uvm_map.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/uvm/files.uvm
diff -u src/sys/uvm/files.uvm:1.16 src/sys/uvm/files.uvm:1.17
--- src/sys/uvm/files.uvm:1.16	Wed Oct 21 21:12:07 2009
+++ src/sys/uvm/files.uvm	Thu Feb 18 14:57:01 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.uvm,v 1.16 2009/10/21 21:12:07 rmind Exp $
+#	$NetBSD: files.uvm,v 1.17 2010/02/18 14:57:01 drochner Exp $
 
 #
 # UVM options
@@ -10,6 +10,7 @@
 defflag opt_ubc.h		UBC_STATS
 defparam opt_pagermap.h		PAGER_MAP_SIZE
 defflagPDPOLICY_CLOCKPRO
+defparam			USER_VA0_DISABLED_DEFAULT
 
 file	uvm/uvm_amap.c
 file	uvm/uvm_anon.c

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.287 src/sys/uvm/uvm_map.c:1.288
--- src/sys/uvm/uvm_map.c:1.287	Mon Feb  8 19:02:33 2010
+++ src/sys/uvm/uvm_map.c	Thu Feb 18 14:57:01 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.287 2010/02/08 19:02:33 joerg Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.288 2010/02/18 14:57:01 drochner Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.287 2010/02/08 19:02:33 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.288 2010/02/18 14:57:01 drochner Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -89,6 +89,11 @@
 #include sys/vnode.h
 #include sys/lockdebug.h
 #include sys/atomic.h
+#ifndef __USER_VA0_IS_SAFE
+#include sys/sysctl.h
+#include sys/kauth.h
+#include opt_user_va0_disabled_default.h
+#endif
 
 #ifdef SYSVSHM
 #include sys/shm.h
@@ -168,6 +173,17 @@
 vaddr_t uvm_maxkaddr;
 #endif
 
+#ifndef __USER_VA0_IS_SAFE
+#ifndef __USER_VA0_DISABLED_DEFAULT
+#define __USER_VA0_DISABLED_DEFAULT 1
+#endif
+#ifdef USER_VA0_DISABLED_DEFAULT /* kernel config option overrides */
+#undef __USER_VA0_DISABLED_DEFAULT
+#define __USER_VA0_DISABLED_DEFAULT USER_VA0_DISABLED_DEFAULT
+#endif
+static int user_va0_disabled = __USER_VA0_DISABLED_DEFAULT;
+#endif
+
 /*
  * macros
  */
@@ -1174,6 +1190,12 @@
 	KASSERT((flags  UVM_FLAG_QUANTUM) == 0 || VM_MAP_IS_KERNEL(map));
 	KASSERT((size  PAGE_MASK) == 0);
 
+#ifndef __USER_VA0_IS_SAFE
+	if ((flags  UVM_FLAG_FIXED)  *startp == 0 
+	!VM_MAP_IS_KERNEL(map)  user_va0_disabled)
+		return EACCES;
+#endif
+
 	/*
 	 * for pager_map, allocate the new entry first to avoid sleeping
 	 * for memory while we have the map locked.
@@ -5215,3 +5237,40 @@
 }
 
 #endif /* DDB || DEBUGPRINT */
+
+#ifndef __USER_VA0_IS_SAFE
+static int
+sysctl_user_va0_disabled(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node;
+	int t, error;
+
+	node = *rnode;
+	node.sysctl_data = t;
+	t = user_va0_disabled;
+	error = sysctl_lookup(SYSCTLFN_CALL(node));
+	if (error || newp == NULL)
+		return (error);
+
+	/* lower only at securelevel  1 */
+	if (!t  user_va0_disabled 
+	kauth_authorize_system(l-l_cred,
+   KAUTH_SYSTEM_CHSYSFLAGS /* XXX */, 0,
+   NULL, NULL, NULL))
+		return EPERM;
+
+	user_va0_disabled = !!t;
+	return 0;
+}
+
+SYSCTL_SETUP(sysctl_uvmmap_setup, sysctl uvmmap setup)
+{
+
+sysctl_createv(clog, 0, NULL, NULL,
+   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+   CTLTYPE_INT, user_va0_disabled,
+   SYSCTL_DESCR(Disable VA 0),
+   sysctl_user_va0_disabled, 0, user_va0_disabled, 0,
+   CTL_VM, CTL_CREATE, CTL_EOL);
+}
+#endif



CVS commit: src/sys/rump/dev/lib/libugenhc

2010-02-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb 18 15:25:13 UTC 2010

Modified Files:
src/sys/rump/dev/lib/libugenhc: ugenhc.c

Log Message:
Change match to be based on the existence of the ugen device node
and signal the root hub interrupt only once we are succesfully able
to open the device node.  This makes it possible to insert a device
after the rump kernel was booted and have it succesfully attach
(does not make detach possible yet, though, as there are some
ugen and host kernel uhci/ohci/ehci evil crashies with that).

XXX: optimally, match would fail if there is a permanent error in
opening.  However, it is difficult to figure out the difference
between the device backing ugen not being present, a transient
error in opening and a permanent error in opening.  For example,
which of the latter two would EPERM be?  And, ugen returns ENXIO
if the device is not present, but how would be know that's really
the case and not some other ENXIO from elsewhere in the stack?


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/lib/libugenhc/ugenhc.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/rump/dev/lib/libugenhc/ugenhc.c
diff -u src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.2 src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.3
--- src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.2	Wed Feb 17 20:39:53 2010
+++ src/sys/rump/dev/lib/libugenhc/ugenhc.c	Thu Feb 18 15:25:13 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugenhc.c,v 1.2 2010/02/17 20:39:53 pooka Exp $	*/
+/*	$NetBSD: ugenhc.c,v 1.3 2010/02/18 15:25:13 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.2 2010/02/17 20:39:53 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.3 2010/02/18 15:25:13 pooka Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -98,6 +98,9 @@
 	int sc_port_change;
 	int sc_addr;
 	int sc_conf;
+
+	struct lwp *sc_rhintr;
+	usbd_xfer_handle sc_intrxfer;
 };
 
 static int	ugenhc_probe(struct device *, struct cfdata *, void *);
@@ -382,8 +385,10 @@
 			totlen = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
 			memset(buf, 0, totlen);
 			if (rumpuser_ioctl(sc-sc_ugenfd[UGEN_EPT_CTRL],
-			USB_GET_DEVICE_DESC, uddesc, ru_error) == -1)
-panic(%d, ru_error);
+			USB_GET_DEVICE_DESC, uddesc, ru_error) == -1) {
+err = EIO;
+goto ret;
+			}
 			memcpy(buf, uddesc, totlen);
 			}
 
@@ -570,39 +575,49 @@
 	.done =		rumpusb_device_ctrl_done,
 };
 
-struct intrent {
-	usbd_xfer_handle xfer;
-	LIST_ENTRY(intrent) entries;
-};
-
-static LIST_HEAD(, intrent) intrlist = LIST_HEAD_INITIALIZER(intrlist);
-
 static void
-rhscintr(void)
+rhscintr(void *arg)
 {
-	struct intrent *ie, *ie_next;
+	char buf[UGENDEV_BUFSIZE];
+	struct ugenhc_softc *sc = arg;
 	usbd_xfer_handle xfer;
+	int fd, error;
 
-	for (ie = LIST_FIRST(intrlist); ie; ie = ie_next) {
-		xfer = ie-xfer;
-		xfer-actlen = xfer-length;
-		xfer-status = USBD_NORMAL_COMPLETION;
-		usb_transfer_complete(xfer);
-
-		ie_next = LIST_NEXT(ie, entries);
-		LIST_REMOVE(ie, entries);
-		kmem_free(ie, sizeof(*ie));
+	makeugendevstr(sc-sc_devnum, 0, buf);
+	for (;;) {
+		fd = rumpuser_open(buf, O_RDWR, error);
+		if (fd != -1)
+			break;
+		kpause(ugwait, false, hz/4, NULL);
 	}
+
+	sc-sc_ugenfd[UGEN_EPT_CTRL] = fd;
+
+	sc-sc_port_status = UPS_CURRENT_CONNECT_STATUS
+	| UPS_PORT_ENABLED | UPS_PORT_POWER;
+	sc-sc_port_change = UPS_C_CONNECT_STATUS;
+
+	xfer = sc-sc_intrxfer;;
+	xfer-actlen = 0;
+	xfer-status = USBD_NORMAL_COMPLETION;
+	usb_transfer_complete(xfer);
+
+	kthread_exit(0);
 }
 
 static usbd_status
 rumpusb_root_intr_start(usbd_xfer_handle xfer)
 {
-	struct intrent *ie;
+	struct ugenhc_softc *sc = xfer-pipe-device-bus-hci_private;
+	int error;
 
-	ie = kmem_alloc(sizeof(*ie), KM_SLEEP);
-	ie-xfer = xfer;
-	LIST_INSERT_HEAD(intrlist, ie, entries);
+	sc-sc_intrxfer = xfer;
+	if (!sc-sc_rhintr) {
+		error = kthread_create(PRI_NONE, 0, NULL,
+		rhscintr, sc, sc-sc_rhintr, ugenrhi);
+		if (error)
+			xfer-status = error;
+	}
 
 	return (USBD_IN_PROGRESS);
 }
@@ -831,10 +846,6 @@
 	int endpt, oflags, error;
 	int fd, val;
 
-	sc-sc_port_status = UPS_CURRENT_CONNECT_STATUS
-	| UPS_PORT_ENABLED | UPS_PORT_POWER;
-	sc-sc_port_change = UPS_C_CONNECT_STATUS;
-
 	if (addr == sc-sc_addr) {
 		switch (xfertype) {
 		case UE_CONTROL:
@@ -955,14 +966,14 @@
 ugenhc_probe(struct device *parent, struct cfdata *match, void *aux)
 {
 	char buf[UGENDEV_BUFSIZE];
-	int fd, error;
+	int error;
 
 	makeugendevstr(match-cf_unit, 0, buf);
-	fd = rumpuser_open(buf, O_RDWR, error);
-	if (fd == -1)
+	if (rumpuser_getfileinfo(buf, NULL, NULL, error) == -1) {
+		printf(match error %d\n, error);
 		return 0;
+	}
 
-	rumpuser_close(fd, error);
 	return 1;
 }
 
@@ -971,8 +982,6 @@
 {
 	struct mainbus_attach_args *maa = aux;
 	struct ugenhc_softc *sc = 

CVS commit: src/usr.bin/unzip

2010-02-18 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Feb 18 15:51:57 UTC 2010

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

Log Message:
Only print the Archive: xxx header if not in extract-to-stdout mode.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/unzip/unzip.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/unzip/unzip.c
diff -u src/usr.bin/unzip/unzip.c:1.11 src/usr.bin/unzip/unzip.c:1.12
--- src/usr.bin/unzip/unzip.c:1.11	Sat Jan  9 09:27:42 2010
+++ src/usr.bin/unzip/unzip.c	Thu Feb 18 15:51:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: unzip.c,v 1.11 2010/01/09 09:27:42 mbalmer Exp $ */
+/* $NetBSD: unzip.c,v 1.12 2010/02/18 15:51:57 joerg Exp $ */
 
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger jo...@netbsd.org
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: unzip.c,v 1.11 2010/01/09 09:27:42 mbalmer Exp $);
+__RCSID($NetBSD: unzip.c,v 1.12 2010/02/18 15:51:57 joerg Exp $);
 
 #include sys/queue.h
 #include sys/stat.h
@@ -865,7 +865,7 @@
 	ac(archive_read_support_format_zip(a));
 	ac(archive_read_open_fd(a, fd, 8192));
 
-	if (!q_opt)
+	if (!q_opt  !p_opt)
 	printf(Archive:  %s\n, fn);
 
 	if (v_opt == 1) {



CVS commit: src/sys/rump/dev/lib/libugenhc

2010-02-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb 18 16:13:30 UTC 2010

Modified Files:
src/sys/rump/dev/lib/libugenhc: ugenhc.c

Log Message:
Actually, detach is possible enough if the device isn't in use.
So just support it.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/dev/lib/libugenhc/ugenhc.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/rump/dev/lib/libugenhc/ugenhc.c
diff -u src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.3 src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.4
--- src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.3	Thu Feb 18 15:25:13 2010
+++ src/sys/rump/dev/lib/libugenhc/ugenhc.c	Thu Feb 18 16:13:30 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugenhc.c,v 1.3 2010/02/18 15:25:13 pooka Exp $	*/
+/*	$NetBSD: ugenhc.c,v 1.4 2010/02/18 16:13:30 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.3 2010/02/18 15:25:13 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.4 2010/02/18 16:13:30 pooka Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -584,23 +584,52 @@
 	int fd, error;
 
 	makeugendevstr(sc-sc_devnum, 0, buf);
+
 	for (;;) {
-		fd = rumpuser_open(buf, O_RDWR, error);
-		if (fd != -1)
-			break;
-		kpause(ugwait, false, hz/4, NULL);
-	}
+		/*
+		 * Detect device attach.
+		 */
+
+		for (;;) {
+			fd = rumpuser_open(buf, O_RDWR, error);
+			if (fd != -1)
+break;
+			kpause(ugwait, false, hz/4, NULL);
+		}
 
-	sc-sc_ugenfd[UGEN_EPT_CTRL] = fd;
+		sc-sc_ugenfd[UGEN_EPT_CTRL] = fd;
+		sc-sc_port_status = UPS_CURRENT_CONNECT_STATUS
+		| UPS_PORT_ENABLED | UPS_PORT_POWER;
+		sc-sc_port_change = UPS_C_CONNECT_STATUS;
 
-	sc-sc_port_status = UPS_CURRENT_CONNECT_STATUS
-	| UPS_PORT_ENABLED | UPS_PORT_POWER;
-	sc-sc_port_change = UPS_C_CONNECT_STATUS;
-
-	xfer = sc-sc_intrxfer;;
-	xfer-actlen = 0;
-	xfer-status = USBD_NORMAL_COMPLETION;
-	usb_transfer_complete(xfer);
+		xfer = sc-sc_intrxfer;
+		xfer-actlen = 0;
+		xfer-status = USBD_NORMAL_COMPLETION;
+		usb_transfer_complete(xfer);
+
+		/*
+		 * Detect device detach.
+		 */
+
+		for (;;) {
+			fd = rumpuser_open(buf, O_RDWR, error);
+			if (fd == -1)
+break;
+			
+			rumpuser_close(fd, error);
+			kpause(ugwait2, false, hz/4, NULL);
+		}
+
+		sc-sc_port_status = ~(UPS_CURRENT_CONNECT_STATUS
+		| UPS_PORT_ENABLED | UPS_PORT_POWER);
+		sc-sc_port_change = UPS_C_CONNECT_STATUS;
+		sc-sc_ugenfd[UGEN_EPT_CTRL] = -1;
+
+		xfer = sc-sc_intrxfer;
+		xfer-actlen = 0;
+		xfer-status = USBD_NORMAL_COMPLETION;
+		usb_transfer_complete(xfer);
+	}
 
 	kthread_exit(0);
 }



CVS commit: src/share/examples/rump/tipsy

2010-02-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb 18 16:14:55 UTC 2010

Modified Files:
src/share/examples/rump/tipsy: tipsy.c

Log Message:
In probeonly, pause after bootstrap to make monkey plug and
unplug device, monkey see fancy dmesg info possible.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/tipsy/tipsy.c

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

Modified files:

Index: src/share/examples/rump/tipsy/tipsy.c
diff -u src/share/examples/rump/tipsy/tipsy.c:1.1 src/share/examples/rump/tipsy/tipsy.c:1.2
--- src/share/examples/rump/tipsy/tipsy.c:1.1	Sun Dec 20 19:50:29 2009
+++ src/share/examples/rump/tipsy/tipsy.c	Thu Feb 18 16:14:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tipsy.c,v 1.1 2009/12/20 19:50:29 pooka Exp $	*/
+/*	$NetBSD: tipsy.c,v 1.2 2010/02/18 16:14:55 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -100,8 +100,10 @@
 	if (probeonly)
 		rump_boot_sethowto(RUMP_AB_VERBOSE);
 	rump_init();
-	if (probeonly)
+	if (probeonly) {
+		pause();
 		exit(0);
+	}
 
 	com = rump_sys_open(/dev/dtyU0, O_RDWR);
 	if (com == -1)



CVS commit: src/sys/rump/dev/lib/libugenhc

2010-02-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Feb 18 16:24:19 UTC 2010

Modified Files:
src/sys/rump/dev/lib/libugenhc: ugenhc.c

Log Message:
Don't leak control endpoint descriptors.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/dev/lib/libugenhc/ugenhc.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/rump/dev/lib/libugenhc/ugenhc.c
diff -u src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.4 src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.5
--- src/sys/rump/dev/lib/libugenhc/ugenhc.c:1.4	Thu Feb 18 16:13:30 2010
+++ src/sys/rump/dev/lib/libugenhc/ugenhc.c	Thu Feb 18 16:24:19 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugenhc.c,v 1.4 2010/02/18 16:13:30 pooka Exp $	*/
+/*	$NetBSD: ugenhc.c,v 1.5 2010/02/18 16:24:19 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.4 2010/02/18 16:13:30 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: ugenhc.c,v 1.5 2010/02/18 16:24:19 pooka Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -623,6 +623,8 @@
 		sc-sc_port_status = ~(UPS_CURRENT_CONNECT_STATUS
 		| UPS_PORT_ENABLED | UPS_PORT_POWER);
 		sc-sc_port_change = UPS_C_CONNECT_STATUS;
+
+		rumpuser_close(sc-sc_ugenfd[UGEN_EPT_CTRL], error);
 		sc-sc_ugenfd[UGEN_EPT_CTRL] = -1;
 
 		xfer = sc-sc_intrxfer;



CVS commit: src/sys/kern

2010-02-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 18 20:58:23 UTC 2010

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

Log Message:
Fix comment(s).

OK'ed by rmind


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/sys/kern/kern_synch.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_synch.c
diff -u src/sys/kern/kern_synch.c:1.274 src/sys/kern/kern_synch.c:1.275
--- src/sys/kern/kern_synch.c:1.274	Wed Dec 30 23:54:30 2009
+++ src/sys/kern/kern_synch.c	Thu Feb 18 20:58:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.274 2009/12/30 23:54:30 rmind Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.275 2010/02/18 20:58:23 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.274 2009/12/30 23:54:30 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_synch.c,v 1.275 2010/02/18 20:58:23 skrll Exp $);
 
 #include opt_kstack.h
 #include opt_perfctrs.h
@@ -752,7 +752,7 @@
 			pmap_deactivate(l);
 
 		/*
-		 * We may need to spin-wait for if 'newl' is still
+		 * We may need to spin-wait if 'newl' is still
 		 * context switching on another CPU.
 		 */
 		if (__predict_false(newl-l_ctxswtch != 0)) {
@@ -893,7 +893,7 @@
 		l-l_lwpctl-lc_curcpu = LWPCTL_CPU_EXITED;
 
 	/*
-	 * We may need to spin-wait for if 'newl' is still
+	 * We may need to spin-wait if 'newl' is still
 	 * context switching on another CPU.
 	 */
 	if (__predict_false(newl-l_ctxswtch != 0)) {



CVS commit: src/sys/arch/hp700/hp700

2010-02-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 18 21:30:00 UTC 2010

Modified Files:
src/sys/arch/hp700/hp700: locore.S

Log Message:
Fix up some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/hp700/hp700/locore.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/hp700/hp700/locore.S
diff -u src/sys/arch/hp700/hp700/locore.S:1.39 src/sys/arch/hp700/hp700/locore.S:1.40
--- src/sys/arch/hp700/hp700/locore.S:1.39	Thu Dec 10 05:10:01 2009
+++ src/sys/arch/hp700/hp700/locore.S	Thu Feb 18 21:30:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.39 2009/12/10 05:10:01 rmind Exp $	*/
+/*	$NetBSD: locore.S,v 1.40 2010/02/18 21:30:00 skrll Exp $	*/
 /*	$OpenBSD: locore.S,v 1.158 2008/07/28 19:08:46 miod Exp $	*/
 
 /*
@@ -765,7 +765,7 @@
 
 /*
  * struct lwp *
- * cpu_switchto(struct lwp *curl, struct lwp *newl)
+ * cpu_switchto(struct lwp *oldl, struct lwp *newl, bool returning)
  */
 	.align	32
 ENTRY(cpu_switchto,128)
@@ -803,7 +803,7 @@
 
 	/*
 	 * cpu_lwp_fork sets the initial stack to a page above uarea address.
-	 * Check that the stack is above this value for curl.
+	 * Check that the stack is above this value for oldl.
 	 */
 	ldw	L_PCB(%arg1), %arg2
 	ldw	PCB_KSP(%arg2), %t1		/* t1 for switch_error */
@@ -826,13 +826,13 @@
 	/*
 	 * save old LWP context
 	 *
-	 * arg0: old LWP (curl)
+	 * arg0: old LWP (oldl)
 	 * arg1: new LWP (newl)
 	 */
 
-	ldw	L_PCB(%arg0), %t3	/* curl pcb */
+	ldw	L_PCB(%arg0), %t3	/* oldl pcb */
 	stw	%sp, PCB_KSP(%t3)
-	fdc	%r0(%t3)		/* flush curl pcb  - surely fdc PCB_KSP(%t3) */
+	fdc	%r0(%t3)		/* flush oldl pcb  - surely fdc PCB_KSP(%t3) */
 
 	/*
 	 * Save the callee-save registers. We don't need to do
@@ -857,7 +857,7 @@
 	/*
 	 * restore new LWP context
 	 *
-	 * arg0: old LWP (curl)
+	 * arg0: old LWP (oldl)
 	 * arg1: new LWP (newl)
 	 */
 switch_exited:
@@ -909,12 +909,12 @@
 	/*
 	 * Save some caller-saves we want to preserve.
 	 *
-	 * We save curl (%arg0) and newl (%arg1) for the benefit of
+	 * We save oldl (%arg0) and newl (%arg1) for the benefit of
 	 * lwp_trampoline() for when it calls lwp_startup().
 	 *
-	 * curl (%arg0) is saved as it's the return value
+	 * oldl (%arg0) is saved as it's the return value
 	 */
-	stw	%arg0, HPPA_FRAME_ARG(0)(%r3)		/* curl */
+	stw	%arg0, HPPA_FRAME_ARG(0)(%r3)		/* oldl */
 	stw	%arg1, HPPA_FRAME_ARG(1)(%r3)		/* newl */
 
 	copy	%arg1, %arg0
@@ -969,7 +969,7 @@
  * the first kernel function to call, and its argument.
  *
  * cpu_switchto() also makes sure that %arg0 and %arg1 are (still)
- * curl and newl respectively.
+ * oldl and newl respectively.
  */
 ENTRY_NOPROFILE(lwp_trampoline,HPPA_FRAME_SIZE)
 	/* no return point */



CVS commit: src/sys/arch/hp700/hp700

2010-02-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 18 21:38:32 UTC 2010

Modified Files:
src/sys/arch/hp700/hp700: locore.S

Log Message:
Improve a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/hp700/hp700/locore.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/hp700/hp700/locore.S
diff -u src/sys/arch/hp700/hp700/locore.S:1.40 src/sys/arch/hp700/hp700/locore.S:1.41
--- src/sys/arch/hp700/hp700/locore.S:1.40	Thu Feb 18 21:30:00 2010
+++ src/sys/arch/hp700/hp700/locore.S	Thu Feb 18 21:38:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.40 2010/02/18 21:30:00 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.41 2010/02/18 21:38:32 skrll Exp $	*/
 /*	$OpenBSD: locore.S,v 1.158 2008/07/28 19:08:46 miod Exp $	*/
 
 /*
@@ -820,7 +820,7 @@
 kstack_ok:
 #endif
 
-	/* If old LWP exited, don't bother. */
+	/* If old LWP exited, don't bother saving anything. */
 	comb,=,n %r0, %arg0, switch_exited
 
 	/*