CVS commit: src

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 19 06:28:53 UTC 2010

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man3: Makefile
Added Files:
src/share/man/man3: sigevent.3

Log Message:
Add sigevent(3), a manual page that describes the struct sigevent used by
the POSIX real time functions and timers.

XXX:(a) Needs to be modified once real time signals are supported.
(b) Could use an example.


To generate a diff of this commit:
cvs rdiff -u -r1.1450 -r1.1451 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.53 -r1.54 src/share/man/man3/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man3/sigevent.3

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1450 src/distrib/sets/lists/comp/mi:1.1451
--- src/distrib/sets/lists/comp/mi:1.1450	Tue May 18 09:07:37 2010
+++ src/distrib/sets/lists/comp/mi	Wed May 19 06:28:53 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1450 2010/05/18 09:07:37 jruoho Exp $
+#	$NetBSD: mi,v 1.1451 2010/05/19 06:28:53 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -7951,6 +7951,7 @@
 ./usr/share/man/cat3/sigblock.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sigdelset.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sigemptyset.0		comp-c-catman		.cat
+./usr/share/man/cat3/sigevent.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sigfillset.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sighold.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sigignore.0		comp-c-catman		.cat
@@ -13747,6 +13748,7 @@
 ./usr/share/man/html3/sigblock.html		comp-c-htmlman		html
 ./usr/share/man/html3/sigdelset.html		comp-c-htmlman		html
 ./usr/share/man/html3/sigemptyset.html		comp-c-htmlman		html
+./usr/share/man/html3/sigevent.html		comp-c-htmlman		html
 ./usr/share/man/html3/sigfillset.html		comp-c-htmlman		html
 ./usr/share/man/html3/sighold.html		comp-c-htmlman		html
 ./usr/share/man/html3/sigignore.html		comp-c-htmlman		html
@@ -19559,6 +19561,7 @@
 ./usr/share/man/man3/sigblock.3			comp-c-man		.man
 ./usr/share/man/man3/sigdelset.3		comp-c-man		.man
 ./usr/share/man/man3/sigemptyset.3		comp-c-man		.man
+./usr/share/man/man3/sigevent.3			comp-c-man		.man
 ./usr/share/man/man3/sigfillset.3		comp-c-man		.man
 ./usr/share/man/man3/sighold.3			comp-c-man		.man
 ./usr/share/man/man3/sigignore.3		comp-c-man		.man

Index: src/share/man/man3/Makefile
diff -u src/share/man/man3/Makefile:1.53 src/share/man/man3/Makefile:1.54
--- src/share/man/man3/Makefile:1.53	Tue May 18 09:07:38 2010
+++ src/share/man/man3/Makefile	Wed May 19 06:28:53 2010
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile,v 1.53 2010/05/18 09:07:38 jruoho Exp $
+#	$NetBSD: Makefile,v 1.54 2010/05/19 06:28:53 jruoho Exp $
 #	@(#)Makefile	8.2 (Berkeley) 12/13/93
 
 MAN=	_DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \
 	__arraycount.3 assert.3 bits.3 bitstring.3 dirent.3 dlfcn.3 end.3 \
 	fast_divide32.3 ffs32.3 gcq.3 intro.3 inttypes.3 iso646.3 offsetof.3 \
-	queue.3 rb.3 stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \
+	queue.3 rb.3 sigevent.3 \
+	stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \
 	tgmath.3 timeradd.3 timeval.3 tree.3 types.3 varargs.3
 
 USETBL=	# used by queue.3

Added files:

Index: src/share/man/man3/sigevent.3
diff -u /dev/null src/share/man/man3/sigevent.3:1.1
--- /dev/null	Wed May 19 06:28:54 2010
+++ src/share/man/man3/sigevent.3	Wed May 19 06:28:53 2010
@@ -0,0 +1,164 @@
+.\ $NetBSD: sigevent.3,v 1.1 2010/05/19 06:28:53 jruoho Exp $
+.\
+.\ Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
+.\
+.\ 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 

CVS commit: src/lib/librt

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 19 06:35:20 UTC 2010

Modified Files:
src/lib/librt: aio.3

Log Message:
Remove the paragraph about the used notification mechanism. Instead,
reference sigevent(3). Clarify the file offset discussion.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/librt/aio.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/librt/aio.3
diff -u src/lib/librt/aio.3:1.4 src/lib/librt/aio.3:1.5
--- src/lib/librt/aio.3:1.4	Mon May 17 19:22:31 2010
+++ src/lib/librt/aio.3	Wed May 19 06:35:20 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: aio.3,v 1.4 2010/05/17 19:22:31 jruoho Exp $ $
+.\ $NetBSD: aio.3,v 1.5 2010/05/19 06:35:20 jruoho Exp $ $
 .\
 .\ Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
 .\ All rights reserved.
@@ -24,7 +24,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd May 17, 2010
+.Dd May 19, 2010
 .Dt AIO 3
 .Os
 .Sh NAME
@@ -184,10 +184,21 @@
 operations are not strictly sequential;
 operations are carried out in arbitrary order and more than one
 operation for one file descriptor can be started.
-Each operation must specify an offset, but the actual file offset
-is never updated as a result of an
+The requested read or write operation starts
+from the absolute position specified by
+.Va aio_offset ,
+as if
+.Xr lseek 2
+would have been called with
+.Dv SEEK_SET
+immediately prior to the operation.
+The
+.Tn POSIX
+standard does not specify what happens after an
 .Nm
-operation.
+operation has been successfully completed.
+Depending on the implementation,
+the actual file offset may or may not be updated.
 .Ss Errors and Completion
 Asynchronous
 .Tn I/O
@@ -244,37 +255,8 @@
 The notification model is implemented by using the
 .Va aio_sigevent
 member of the Asynchronous I/O Control Block.
-The structure
-.Em sigevent
-is defined in
-.In signal.h .
-The relevant fields for
-.Nm
-are
-.Va sigev_notify ,
-.Va sigev_signo ,
-and the function pointer
-.Va sigev_notify_function .
-The
-.Va sigev_notify
-member determines the type of the action:
-.Bl -enum -offset indent
-.It
-If it is
-.Dv SIGEV_NONE ,
-no notification is sent.
-.It
-If it is
-.Dv SIGEV_SIGNAL ,
-the signal determined by
-.Va sigev_signo
-is sent when the operation completes.
-.It
-If it is
-.Dv SIGEV_THREAD ,
-a thread is created which starts executing the function specified by
-.Va sigev_notify_function .
-.El
+The operational model and the used structure are described in
+.Xr sigevent 3 .
 .Pp
 The
 .Fn aio_suspend
@@ -351,9 +333,16 @@
 interface first appeared in
 .Nx 5.0 .
 .Sh CAVEATS
+Few limitations can be mentioned:
+.Bl -bullet
+.It
+Undefined behavior results if simultaneous asynchronous operations
+use the same Asynchronous I/O Control Block.
+.It
 When an asynchronous read operation is outstanding,
 undefined behavior may follow if the contents of
 .Va aiocb
 are altered, or if memory associated with the structure, or the
 .Va aio_buf
 buffer, is deallocated.
+.El



CVS commit: src/lib/libc/sys

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 19 06:44:52 UTC 2010

Modified Files:
src/lib/libc/sys: timer_create.2

Log Message:
Refer to sigevent(3).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/sys/timer_create.2

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

Modified files:

Index: src/lib/libc/sys/timer_create.2
diff -u src/lib/libc/sys/timer_create.2:1.10 src/lib/libc/sys/timer_create.2:1.11
--- src/lib/libc/sys/timer_create.2:1.10	Mon Mar 22 19:30:55 2010
+++ src/lib/libc/sys/timer_create.2	Wed May 19 06:44:51 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: timer_create.2,v 1.10 2010/03/22 19:30:55 joerg Exp $
+.\	$NetBSD: timer_create.2,v 1.11 2010/05/19 06:44:51 jruoho Exp $
 .\
 .\ Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd September 13, 2003
+.Dd May 19, 2010
 .Dt TIMER_CREATE 2
 .Os
 .Sh NAME
@@ -60,24 +60,25 @@
 .Pp
 An optional
 .Pq non- Ns Dv NULL
-sigevent argument can be specified by the
+.Em struct sigevent
+argument can be specified by the
 .Ar evp
 argument.
 If the
 .Ar evp
 argument is
 .Dv NULL ,
-then it defaults to
-.Fa sigev_notify
-set to
+then
+.Fa evp-\*[Gt]sigev_notify
+defaults to
 .Dv SIGEV_SIGNAL
 and
-.Fa sigev_value
-set to
+.Fa evp-\*[Gt]sigev_value
+is set to
 .Ar timerid .
-See
-.Xr siginfo 2
-for accessing those values from a signal handler.
+Refer to
+.Xr sigevent 3
+for more details.
 .Sh NOTES
 Timers are not inherited after a
 .Xr fork 2



CVS commit: src/share/man/man3

2010-05-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed May 19 06:59:44 UTC 2010

Modified Files:
src/share/man/man3: sigevent.3

Log Message:
Sort sections.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man3/sigevent.3

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

Modified files:

Index: src/share/man/man3/sigevent.3
diff -u src/share/man/man3/sigevent.3:1.1 src/share/man/man3/sigevent.3:1.2
--- src/share/man/man3/sigevent.3:1.1	Wed May 19 06:28:53 2010
+++ src/share/man/man3/sigevent.3	Wed May 19 06:59:44 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: sigevent.3,v 1.1 2010/05/19 06:28:53 jruoho Exp $
+.\ $NetBSD: sigevent.3,v 1.2 2010/05/19 06:59:44 wiz Exp $
 .\
 .\ Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
 .\
@@ -147,16 +147,16 @@
 .\
 .\ XXX: Add one.
 .\
-.Sh HISTORY
-The
-.Va sigevent
-structure first appeared in
-.Nx 1.6 .
 .Sh SEE ALSO
 .Xr siginfo 2 ,
 .Xr aio 3 ,
 .Xr mq_notify 3 ,
 .Xr timer_create 3
+.Sh HISTORY
+The
+.Va sigevent
+structure first appeared in
+.Nx 1.6 .
 .\
 .\ XXX: Remove the paragraph once RT signals are supported.
 .\



CVS commit: src/share/man/man3

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 19 08:02:46 UTC 2010

Modified Files:
src/share/man/man3: sigevent.3

Log Message:
Continue the discussion w.r.t. SIGEV_THREAD by nothing that pthread_join(3)
should be out of the question and that thread stack cannot be recovered.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man3/sigevent.3

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

Modified files:

Index: src/share/man/man3/sigevent.3
diff -u src/share/man/man3/sigevent.3:1.2 src/share/man/man3/sigevent.3:1.3
--- src/share/man/man3/sigevent.3:1.2	Wed May 19 06:59:44 2010
+++ src/share/man/man3/sigevent.3	Wed May 19 08:02:46 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: sigevent.3,v 1.2 2010/05/19 06:59:44 wiz Exp $
+.\ $NetBSD: sigevent.3,v 1.3 2010/05/19 08:02:46 jruoho Exp $
 .\
 .\ Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi
 .\
@@ -141,6 +141,23 @@
 the type is
 .Va pthread_attr_t
 in practice.)
+.Pp
+The threads are created as detached,
+or in an unspecified way if
+.Xr pthread_attr_setdetachstate 3
+is used with
+.Va sigev_notify_attributes
+to set
+.Dv PTHREAD_CREATE_JOINABLE .
+It is not valid to call
+.Xr pthread_join 3
+in either case.
+Hence, it is also impossible to determine the lifetime of the created thread.
+This in turn means that it is neither possibly to recovery the memory nor
+the address of the memory possibly dedicated as thread stack via
+.Fn pthread_attr_setstack
+or
+.Fn pthread_attr_setstackaddr .
 .El
 .\
 .\ .Sh EXAMPLES



CVS commit: src/lib/libpuffs

2010-05-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed May 19 12:16:45 UTC 2010

Modified Files:
src/lib/libpuffs: puffs.c

Log Message:
remove three years out-of-date comment


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/lib/libpuffs/puffs.c

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

Modified files:

Index: src/lib/libpuffs/puffs.c
diff -u src/lib/libpuffs/puffs.c:1.105 src/lib/libpuffs/puffs.c:1.106
--- src/lib/libpuffs/puffs.c:1.105	Tue Jan 12 18:42:38 2010
+++ src/lib/libpuffs/puffs.c	Wed May 19 12:16:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.c,v 1.105 2010/01/12 18:42:38 pooka Exp $	*/
+/*	$NetBSD: puffs.c,v 1.106 2010/05/19 12:16:45 pooka Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: puffs.c,v 1.105 2010/01/12 18:42:38 pooka Exp $);
+__RCSID($NetBSD: puffs.c,v 1.106 2010/05/19 12:16:45 pooka Exp $);
 #endif /* !lint */
 
 #include sys/param.h
@@ -82,7 +82,7 @@
 	FILLOP(access,   ACCESS);
 	FILLOP(getattr,  GETATTR);
 	FILLOP(setattr,  SETATTR);
-	FILLOP(poll, POLL); /* XXX: not ready in kernel */
+	FILLOP(poll, POLL);
 	FILLOP(mmap, MMAP);
 	FILLOP(fsync,FSYNC);
 	FILLOP(seek, SEEK);



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

2010-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 19 12:50:49 UTC 2010

Modified Files:
src/external/bsd/cron/dist: pathnames.h

Log Message:
rename the allow and deny files to match the documentation.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/cron/dist/pathnames.h

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

Modified files:

Index: src/external/bsd/cron/dist/pathnames.h
diff -u src/external/bsd/cron/dist/pathnames.h:1.2 src/external/bsd/cron/dist/pathnames.h:1.3
--- src/external/bsd/cron/dist/pathnames.h:1.2	Thu May  6 14:53:17 2010
+++ src/external/bsd/cron/dist/pathnames.h	Wed May 19 08:50:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pathnames.h,v 1.2 2010/05/06 18:53:17 christos Exp $	*/
+/*	$NetBSD: pathnames.h,v 1.3 2010/05/19 12:50:49 christos Exp $	*/
 
 /* Copyright 1993,1994 by Paul Vixie
  * All rights reserved
@@ -56,8 +56,8 @@
 			/* cron allow/deny file.  At least cron.deny must
 			 * exist for ordinary users to run crontab.
 			 */
-#define	CRON_ALLOW	cron.allow
-#define	CRON_DENY	cron.deny
+#define	CRON_ALLOW	allow
+#define	CRON_DENY	deny
 
 			/* undefining this turns off logging to a file.  If
 			 * neither LOG_FILE or SYSLOG is defined, we don't log.



CVS commit: src/share/man/man9

2010-05-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed May 19 13:20:32 UTC 2010

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

Log Message:
* document VOP_DELETEEXTATTR
* remove vector element from summary table:
   1) deleteextattr caused problems for 80col rendering
   2) it's not correct on NetBSD, we use the VOFFSET instead (!)


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/share/man/man9/vnodeops.9

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

Modified files:

Index: src/share/man/man9/vnodeops.9
diff -u src/share/man/man9/vnodeops.9:1.77 src/share/man/man9/vnodeops.9:1.78
--- src/share/man/man9/vnodeops.9:1.77	Mon May  4 20:08:07 2009
+++ src/share/man/man9/vnodeops.9	Wed May 19 13:20:32 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: vnodeops.9,v 1.77 2009/05/04 20:08:07 wiz Exp $
+.\ $NetBSD: vnodeops.9,v 1.78 2010/05/19 13:20:32 pooka Exp $
 .\
 .\ Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 5, 2008
+.Dd May 19, 2010
 .Dt VNODEOPS 9
 .Os
 .Sh NAME
@@ -76,7 +76,8 @@
 .Nm VOP_BWRITE ,
 .Nm VOP_GETEXTATTR ,
 .Nm VOP_SETEXTATTR ,
-.Nm VOP_LISTEXTATTR
+.Nm VOP_LISTEXTATTR ,
+.Nm VOP_DELETEEXTATTR
 .Nd vnode operations
 .Sh SYNOPSIS
 .In sys/param.h
@@ -206,6 +207,9 @@
 .Ft int
 .Fn VOP_LISTEXTATTR struct vnode *vp int attrnamespace struct uio *uio \
 size_t *size kauth_cred_t cred
+.Ft int
+.Fn VOP_DELETEEXTATTR struct vnode *vp int attrnamespace \
+const char *name kauth_cred_t cred
 .Pp
 Not all header files are required for each function.
 .Sh DESCRIPTION
@@ -222,56 +226,56 @@
 .Pp
 Functions in the vnode operations vector are invoked using specialized
 macros.
-The following table lists the elements of the vnode operations vector,
-the corresponding invocation macro, and a description of the element.
+The following table gives a summary of the operations.
 .Pp
-.Bl -column int (*vop_strategy)() VOP_LISTEXTATTR Wake up process sleeping on lock -compact
-.It Sy Vector element Ta Sy Macro Ta Sy Description
-.It int (*vop_lookup)()	VOP_LOOKUP	Lookup file name in name cache
-.It int (*vop_create)()	VOP_CREATE	Create a new file
-.It int (*vop_mknod)()	VOP_MKNOD	Make a new device
-.It int (*vop_open)()	VOP_OPEN	Open a file
-.It int (*vop_close)()	VOP_CLOSE	Close a file
-.It int (*vop_access)()	VOP_ACCESS	Determine file accessibility
-.It int (*vop_getattr)()	VOP_GETATTR	Get file attributes
-.It int (*vop_setattr)()	VOP_SETATTR	Set file attributes
-.It int (*vop_read)()	VOP_READ	Read from a file
-.It int (*vop_write)()	VOP_WRITE	Write to a file
-.It int (*vop_ioctl)()	VOP_IOCTL	Perform device-specific I/O
-.It int (*vop_fcntl)()	VOP_FCNTL	Perform file control
-.It int (*vop_poll)()	VOP_POLL	Test if poll event has occurred
-.It int (*vop_kqfilter)()	VOP_KQFILTER	Register a knote
-.It int (*vop_revoke)()	VOP_REVOKE	Eliminate vode activity
-.It int (*vop_mmap)()	VOP_MMAP	Map file into user address space
-.It int (*vop_fsync)()	VOP_FSYNC	Flush pending data to disk
-.It int (*vop_seek)()	VOP_SEEK	Test if file is seekable
-.It int (*vop_remove)()	VOP_REMOVE	Remove a file
-.It int (*vop_link)()	VOP_LINK	Link a file
-.It int (*vop_rename)()	VOP_RENAME	Rename a file
-.It int (*vop_mkdir)()	VOP_MKDIR	Make a new directory
-.It int (*vop_rmdir)()	VOP_RMDIR	Remove a directory
-.It int (*vop_symlink)()	VOP_SYMLINK	Create a symbolic link
-.It int (*vop_readdir)()	VOP_READDIR	Read directory entry
-.It int (*vop_readlink)()	VOP_READLINK	Read contents of a symlink
-.It int (*vop_abortop)()	VOP_ABORTOP	Abort pending operation
-.It int (*vop_inactive)()	VOP_INACTIVE	Release the inactive vnode
-.It int (*vop_reclaim)()	VOP_RECLAIM	Reclaim vnode for another file
-.It int (*vop_lock)()	VOP_LOCK	Sleep until vnode lock is free
-.It int (*vop_unlock)()	VOP_UNLOCK	Wake up process sleeping on lock
-.It int (*vop_islocked)()	VOP_ISLOCKED	Test if vnode is locked
-.It int (*vop_bmap)()	VOP_BMAP	Logical block number conversion
-.It int (*vop_print)()	VOP_PRINT	Print debugging information
-.It int (*vop_pathconf)()	VOP_PATHCONF	Return POSIX pathconf data
-.It int (*vop_advlock)()	VOP_ADVLOCK	Advisory record locking
-.It int (*vop_lease)()	VOP_LEASE	Validate vnode credentials
-.It int (*vop_whiteout)()	VOP_WHITEOUT	Whiteout vnode
-.It int (*vop_getpages)()	VOP_GETPAGES	Read VM pages from file
-.It int (*vop_putpages)()	VOP_PUTPAGES	Write VM pages to file
-.It int (*vop_strategy)()	VOP_STRATEGY	Read/write a file system buffer
-.It int (*vop_bwrite)()	VOP_BWRITE	Write a file system buffer
-.It int (*vop_getextattr)()	VOP_GETEXTATTR	Get extended attribute
-.It int (*vop_setextattr)()	VOP_SETEXTATTR	Set extended attribute
-.It int (*vop_listextattr)()	VOP_LISTEXTATTR	List extended attributes
+.Bl -column VOP_DELETEEXTATTR Wake up process sleeping on lock -compact

CVS commit: src/share/man/man3

2010-05-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed May 19 13:41:39 UTC 2010

Modified Files:
src/share/man/man3: timeval.3

Log Message:
microtime(9) stores struct timeval.  bintime(9) stores struct bintime.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man3/timeval.3

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

Modified files:

Index: src/share/man/man3/timeval.3
diff -u src/share/man/man3/timeval.3:1.8 src/share/man/man3/timeval.3:1.9
--- src/share/man/man3/timeval.3:1.8	Tue May 18 07:31:15 2010
+++ src/share/man/man3/timeval.3	Wed May 19 13:41:39 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: timeval.3,v 1.8 2010/05/18 07:31:15 jruoho Exp $
+.\ $NetBSD: timeval.3,v 1.9 2010/05/19 13:41:39 tsutsui Exp $
 .\
 .\ Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd May 18, 2010
+.Dd May 19, 2010
 .Dt TIMEVAL 3
 .Os
 .Sh NAME
@@ -132,7 +132,7 @@
 A value zero implies that the timer is disabled.
 .It
 The following structure is used by
-.Xr microtime 9 ,
+.Xr bintime 9 ,
 among others:
 .Bd -literal -offset indent
 struct bintime {



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

2010-05-19 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed May 19 15:04:51 UTC 2010

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

Log Message:
Updated Synology extclk from latest Linux/Synology source.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/netboot/brdsetup.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/netboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/netboot/brdsetup.c:1.17 src/sys/arch/sandpoint/stand/netboot/brdsetup.c:1.18
--- src/sys/arch/sandpoint/stand/netboot/brdsetup.c:1.17	Tue May 18 14:32:38 2010
+++ src/sys/arch/sandpoint/stand/netboot/brdsetup.c	Wed May 19 15:04:51 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.17 2010/05/18 14:32:38 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.18 2010/05/19 15:04:51 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -168,7 +168,8 @@
 		consname = eumb;
 		consport = 0x4500;
 		consspeed = 115200;
-		extclk = 33164526;
+		extclk = 33164691;	/* from Synology/Linux source */
+		/* extclk = 33168000;	XXX better precision? */
 	}
 	else if (PCI_VENDOR(pcicfgread(pcimaketag(0, 15, 0), PCI_ID_REG)) ==
 	0x8086) {/* PCI_VENDOR_INTEL */



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

2010-05-19 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed May 19 15:05:58 UTC 2010

Modified Files:
src/sys/arch/sandpoint/stand/netboot: Makefile entry.S main.c

Log Message:
Implemented support for boot arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sandpoint/stand/netboot/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sandpoint/stand/netboot/entry.S
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/stand/netboot/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/netboot/Makefile
diff -u src/sys/arch/sandpoint/stand/netboot/Makefile:1.17 src/sys/arch/sandpoint/stand/netboot/Makefile:1.18
--- src/sys/arch/sandpoint/stand/netboot/Makefile:1.17	Mon May 17 17:50:08 2010
+++ src/sys/arch/sandpoint/stand/netboot/Makefile	Wed May 19 15:05:58 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2010/05/17 17:50:08 phx Exp $
+#	$NetBSD: Makefile,v 1.18 2010/05/19 15:05:58 phx Exp $
 
 S=		${.CURDIR}/../../../..
 
@@ -11,7 +11,6 @@
 CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP
 #CPPFLAGS+=	-DCONSNAME=\com\ -DCONSPORT=0x3f8 -DCONSSPEED=115200
 #CPPFLAGS+=	-DCONSNAME=\eumb\ -DCONSPORT=0x4600 -DCONSSPEED=57600
-#CPPFLAGS+=	-DSTART_DDB_SESSION
 CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I${S}
 DBG=		-Os
 

Index: src/sys/arch/sandpoint/stand/netboot/entry.S
diff -u src/sys/arch/sandpoint/stand/netboot/entry.S:1.6 src/sys/arch/sandpoint/stand/netboot/entry.S:1.7
--- src/sys/arch/sandpoint/stand/netboot/entry.S:1.6	Thu May 13 10:40:02 2010
+++ src/sys/arch/sandpoint/stand/netboot/entry.S	Wed May 19 15:05:58 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: entry.S,v 1.6 2010/05/13 10:40:02 phx Exp $ */
+/* $NetBSD: entry.S,v 1.7 2010/05/19 15:05:58 phx Exp $ */
 
 #include powerpc/psl.h
 #include powerpc/spr.h
@@ -9,6 +9,8 @@
 	.text
 	.globl _start
 _start:
+	mr	30,3
+	mr	31,4
 	mfspr	11,SPR_HID0
 	andi.	0,11,HID0_DCE
 	ori	11,11,HID0_ICE
@@ -89,6 +91,8 @@
 	addi	1,1,-4
 
 	bl	brdsetup
+	mr	3,30
+	mr	4,31
 	bl	main
 
 hang:	b	hang

Index: src/sys/arch/sandpoint/stand/netboot/main.c
diff -u src/sys/arch/sandpoint/stand/netboot/main.c:1.30 src/sys/arch/sandpoint/stand/netboot/main.c:1.31
--- src/sys/arch/sandpoint/stand/netboot/main.c:1.30	Tue May 18 15:07:50 2010
+++ src/sys/arch/sandpoint/stand/netboot/main.c	Wed May 19 15:05:58 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.30 2010/05/18 15:07:50 phx Exp $ */
+/* $NetBSD: main.c,v 1.31 2010/05/19 15:05:58 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -40,6 +40,23 @@
 
 #include globals.h
 
+static const struct bootarg {
+	const char *name;
+	int value;
+} bootargs[] = {
+	{ multi,	RB_AUTOBOOT },
+	{ auto,	RB_AUTOBOOT },
+	{ ask,	RB_ASKNAME },
+	{ single,	RB_SINGLE },
+	{ ddb,	RB_KDB },
+	{ userconf,	RB_USERCONF },
+	{ norm,	AB_NORMAL },
+	{ quiet,	AB_QUIET },
+	{ verb,	AB_VERBOSE },
+	{ silent,	AB_SILENT },
+	{ debug,	AB_DEBUG }
+};
+
 void *bootinfo; /* low memory reserved to pass bootinfo structures */
 int bi_size;	/* BOOTINFO_MAXSIZE */
 char *bi_next;
@@ -48,7 +65,7 @@
 char rootdev[4];	/* NIF nickname, filled by netif_init() */
 uint8_t en[6];		/* NIC macaddr, fill by netif_init() */
 
-void main(void);
+void main(int, char **);
 void bi_init(void *);
 void bi_add(void *, int, int);
 
@@ -62,7 +79,7 @@
 uint32_t busclock, cpuclock;
 
 void
-main(void)
+main(int argc, char *argv[])
 {
 	struct btinfo_memory bi_mem;
 	struct btinfo_console bi_cons;
@@ -73,7 +90,7 @@
 	unsigned long marks[MARK_MAX];
 	unsigned lata[1][2], lnif[1][2];
 	unsigned memsize, tag;
-	int b, d, f, fd, howto, n;
+	int b, d, f, fd, howto, i, n;
 
 	/* determine SDRAM size */
 	memsize = mpc107memsize();
@@ -143,10 +160,19 @@
 	if (fdloadfile(fd, marks, LOAD_KERNEL)  0)
 		goto loadfail;
 
-	howto = RB_SINGLE | AB_VERBOSE;
-#ifdef START_DDB_SESSION
-	howto |= RB_KDB;
-#endif
+	/* get boot mode and boot options */
+	howto = RB_AUTOBOOT;
+	for (n = 1; n  argc; n++) {
+		for (i = 0; i  sizeof(bootargs) / sizeof(bootargs[0]); i++) {
+			if (strncasecmp(argv[n], bootargs[i].name,
+			strlen(bootargs[i].name)) == 0) {
+howto |= bootargs[i].value;
+break;
+			}
+		}
+		if (i = sizeof(bootargs) / sizeof(bootargs[0]))
+			break;	/* break on first garbage argument */
+	}
 
 	bootinfo = (void *)0x4000;
 	bi_init(bootinfo);



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2010-05-19 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Wed May 19 17:51:00 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: space_map.c

Log Message:
Do not initialize space map cv twice.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/space_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/external/cddl/osnet/dist/uts/common/fs/zfs/space_map.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/space_map.c:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/space_map.c:1.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/space_map.c:1.3	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/space_map.c	Wed May 19 17:50:59 2010
@@ -62,8 +62,6 @@
 
 	avl_create(sm-sm_root, space_map_seg_compare,
 	sizeof (space_seg_t), offsetof(struct space_seg, ss_node));
-	
-	cv_init(sm-sm_load_cv, NULL, CV_DEFAULT, NULL);
 
 	sm-sm_start = start;
 	sm-sm_size = size;



CVS commit: src/external/cddl/osnet

2010-05-19 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Wed May 19 18:01:26 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ioctl.c
src/external/cddl/osnet/sys/sys: sunddi.h

Log Message:
Use ddi_copyin and ddi_copyout as solaris does, change them to
ioctl_copyin/ioctl_copyout in kernel and to bcopy in user space.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/sys/sunddi.h

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.5 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.6
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.5	Wed May 19 17:57:42 2010
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Wed May 19 18:01:26 2010
@@ -4454,16 +4454,8 @@
 
 	zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
 
-	/* XXX is this still needed ? */
-	error = xcopyin((void *)arg, zc, sizeof (zfs_cmd_t));
-	printf(zfsdev_ioct zc_value %s, zc_string\n, zc-zc_value, zc-zc_string);
-	printf(zfsdev_ioctl - calling zfs_ioc_vec secpolicy function on %d\n, vec);
-	if (error == 0)
-#if 0	
 	error = ddi_copyin((void *)arg, zc, sizeof (zfs_cmd_t), flag);
-
 	if ((error == 0)  !(flag  FKIOCTL))
-#endif
 		error = zfs_ioc_vec[vec].zvec_secpolicy(zc, cr);
 
 	/*

Index: src/external/cddl/osnet/sys/sys/sunddi.h
diff -u src/external/cddl/osnet/sys/sys/sunddi.h:1.3 src/external/cddl/osnet/sys/sys/sunddi.h:1.4
--- src/external/cddl/osnet/sys/sys/sunddi.h:1.3	Sun Feb 21 01:46:36 2010
+++ src/external/cddl/osnet/sys/sys/sunddi.h	Wed May 19 18:01:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunddi.h,v 1.3 2010/02/21 01:46:36 darran Exp $	*/
+/*	$NetBSD: sunddi.h,v 1.4 2010/05/19 18:01:26 haad Exp $	*/
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek p...@freebsd.org
@@ -31,8 +31,13 @@
 #ifndef _OPENSOLARIS_SYS_SUNDDI_H_
 #define	_OPENSOLARIS_SYS_SUNDDI_H_
 
+#ifndef _KERNEL
 #define	ddi_copyin(from, to, size, flag)	(bcopy((from), (to), (size)), 0)
 #define	ddi_copyout(from, to, size, flag)	(bcopy((from), (to), (size)), 0)
+#else
+#define	ddi_copyin(from, to, size, flag)	(ioctl_copyin((flag), (from), (to), (size)))
+#define	ddi_copyout(from, to, size, flag)	(ioctl_copyout((flag), (from), (to), (size)))
+#endif
 int ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result);
 
 #endif	/* _OPENSOLARIS_SYS_SUNDDI_H_ */



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2010-05-19 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Wed May 19 17:57:42 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_ioctl.c

Log Message:
Do not call zfs_init and zfs_fini directly they will be called by vfs routines.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.4 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.5
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.4	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c	Wed May 19 17:57:42 2010
@@ -4626,14 +4626,13 @@
 			return error;
 		}
 		spa_init(FREAD | FWRITE);
-		zfs_init();
 		zvol_init();
 		zfs_vfsinit(16, MOUNT_ZFS); /* I need to use well defined args. */
 		error = devsw_attach(zfs, zfs_bdevsw, zfs_bmajor,
 		zfs_cdevsw, zfs_cmajor);
 		if (error != 0) {
 			zvol_fini();
-			zfs_fini();
+			zfs_vfsfini();
 			spa_fini();
 			lwp_specific_key_delete(zfs_fsyncer_key);
 			lwp_specific_key_delete(rrw_tsd_key);
@@ -4647,7 +4646,6 @@
 		error = devsw_detach(zfs_bdevsw, zfs_cdevsw);
 		zvol_fini();
 		zfs_vfsfini();
-		zfs_fini();
 		spa_fini();
 		lwp_specific_key_delete(zfs_fsyncer_key);
 		lwp_specific_key_delete(rrw_tsd_key);



CVS commit: src/sys/net

2010-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 19 18:58:22 UTC 2010

Modified Files:
src/sys/net: if_ether.h if_ethersubr.c

Log Message:
Changes to ether_nonstatic_aton():

Be more leinent on input string format.  Each nibble pair may optionally be
followed by any of ':', '-', '.' or ' '.

Make source string const and work on a temporary copy.  The caller may not
expect their string to be destroyed.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/net/if_ether.h
cvs rdiff -u -r1.178 -r1.179 src/sys/net/if_ethersubr.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/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.56 src/sys/net/if_ether.h:1.57
--- src/sys/net/if_ether.h:1.56	Wed Mar 18 15:14:31 2009
+++ src/sys/net/if_ether.h	Wed May 19 18:58:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.56 2009/03/18 15:14:31 cegger Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.57 2010/05/19 18:58:22 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -310,7 +310,7 @@
 uint32_t ether_crc32_le(const uint8_t *, size_t);
 uint32_t ether_crc32_be(const uint8_t *, size_t);
 
-int	ether_nonstatic_aton(u_char *, char *);
+int	ether_nonstatic_aton(u_char *, const char *);
 #else
 /*
  * Prototype ethers(3) functions.

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.178 src/sys/net/if_ethersubr.c:1.179
--- src/sys/net/if_ethersubr.c:1.178	Wed May  5 18:12:24 2010
+++ src/sys/net/if_ethersubr.c	Wed May 19 18:58:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.178 2010/05/05 18:12:24 dyoung Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.179 2010/05/19 18:58:22 jakllsch Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ethersubr.c,v 1.178 2010/05/05 18:12:24 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ethersubr.c,v 1.179 2010/05/19 18:58:22 jakllsch Exp $);
 
 #include opt_inet.h
 #include opt_atalk.h
@@ -1224,38 +1224,47 @@
  * ether_aton implementation, not using a static buffer.
  */
 int
-ether_nonstatic_aton(u_char *dest, char *str)
+ether_nonstatic_aton(u_char *dest, const char *src)
 {
-int i;
-char *cp = str;
-u_char val[6];
-
-#define set_value   \
-if (*cp  '9'  *cp  'a') \
-*cp -= 'A' - 10;\
-else if (*cp  '9') \
-*cp -= 'a' - 10;\
-else\
-*cp -= '0'
-
-for (i = 0; i  6; i++, cp++) {
-if (!isxdigit(*cp))
-return (1);
-set_value;
-val[i] = *cp++;
-if (isxdigit(*cp)) {
-set_value;
-val[i] *= 16;
-val[i] += *cp++;
-}
-if (*cp == ':' || i == 5)
-continue;
-else
-return 1;
-}
-memcpy(dest, val, 6);
+	int i;
+	char str[3 * ETHER_ADDR_LEN + 2];
+	u_char val[ETHER_ADDR_LEN];
+	char *cp;
+
+#define set_value			\
+	if (*cp  '9'  *cp  'a')	\
+		*cp -= 'A' - 10;	\
+	else if (*cp  '9')		\
+		*cp -= 'a' - 10;	\
+	else\
+		*cp -= '0'
+
+	strlcpy(str, src, sizeof(str));
+
+	cp = str;
+
+	for (i = 0; i  ETHER_ADDR_LEN; i++) {
+		if (!isxdigit(*cp))
+			return 1;
+		set_value;
+		val[i] = *cp++;
+		if (isxdigit(*cp)) {
+			set_value;
+			val[i] = 4;
+			val[i] += *cp++;
+		}
+		if (*cp == ':' || *cp == '-' || *cp == '.' || *cp == ' ') {
+			cp++;
+			continue;
+		}
+		if (isxdigit(*cp) || i == (ETHER_ADDR_LEN - 1))
+			continue;
+		return 1;
+	}
+	memcpy(dest, val, ETHER_ADDR_LEN);
 
-return 0;
+	return 0;
+#undef set_value
 }
 
 



CVS commit: src

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 19 19:17:08 UTC 2010

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/syscall: Makefile
Added Files:
src/tests/syscall: t_timer.c

Log Message:
Add a simple test for timer_create(2) / sigevent(3).
Case for SIGEV_THREAD commented out.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.8 -r1.9 src/tests/syscall/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/syscall/t_timer.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/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.74 src/distrib/sets/lists/tests/mi:1.75
--- src/distrib/sets/lists/tests/mi:1.74	Sat May 15 09:00:53 2010
+++ src/distrib/sets/lists/tests/mi	Wed May 19 19:17:08 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.74 2010/05/15 09:00:53 njoly Exp $
+# $NetBSD: mi,v 1.75 2010/05/19 19:17:08 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -201,6 +201,7 @@
 ./usr/libdata/debug/usr/tests/rump/rumpkern/t_modlinkset.debug		tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/syscall	tests-syscall-debug
 ./usr/libdata/debug/usr/tests/syscall/t_cmsg.debug			tests-syscall-debug	debug,atf
+./usr/libdata/debug/usr/tests/syscall/t_timer.debug			tests-syscall-debug	debug,atf
 ./usr/libdata/debug/usr/tests/util	tests-util-debug
 ./usr/libdata/debug/usr/tests/util/df	tests-util-debug
 ./usr/libdata/debug/usr/tests/util/df/h_df.debug			tests-util-debug	debug
@@ -1124,6 +1125,7 @@
 ./usr/tests/syscalltests-syscall-tests
 ./usr/tests/syscall/Atffile			tests-syscall-tests	atf
 ./usr/tests/syscall/t_cmsg			tests-syscall-tests	atf
+./usr/tests/syscall/t_timer			tests-syscall-tests	atf
 ./usr/tests/utiltests-util-tests
 ./usr/tests/util/Atffile			tests-util-tests
 ./usr/tests/util/awktests-util-tests

Index: src/tests/syscall/Makefile
diff -u src/tests/syscall/Makefile:1.8 src/tests/syscall/Makefile:1.9
--- src/tests/syscall/Makefile:1.8	Thu Nov 26 17:33:23 2009
+++ src/tests/syscall/Makefile	Wed May 19 19:17:08 2010
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.8 2009/11/26 17:33:23 pooka Exp $
+# $NetBSD: Makefile,v 1.9 2010/05/19 19:17:08 jruoho Exp $
 
 .include bsd.own.mk
 
 TESTSDIR=	${TESTSBASE}/syscall
 
-TESTS_C+=	t_cmsg
+TESTS_C+=	t_cmsg t_timer
 
 LDADD+=	-lrumpnet_local -lrumpnet_net -lrumpnet
 LDADD+=	-lrumpvfs -lrump -lrumpuser -lpthread

Added files:

Index: src/tests/syscall/t_timer.c
diff -u /dev/null src/tests/syscall/t_timer.c:1.1
--- /dev/null	Wed May 19 19:17:08 2010
+++ src/tests/syscall/t_timer.c	Wed May 19 19:17:08 2010
@@ -0,0 +1,324 @@
+/*	$NetBSD: t_timer.c,v 1.1 2010/05/19 19:17:08 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * 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 errno.h
+#include pthread.h
+#include signal.h
+#include string.h
+#include time.h
+#include unistd.h
+
+#include atf-c.h
+
+#include ../h_macros.h
+
+static void	timer_signal_create(clockid_t, int);
+static void	timer_signal_handler(int, siginfo_t *, void *);
+static int	timer_wait(time_t);
+
+#if 0
+/*
+ * XXX: SIGEV_THREAD is not yet supported.
+ */
+static void	timer_thread_create(clockid_t);
+static void	timer_thread_handler(sigval_t);
+#endif
+
+static timer_t t;
+static bool error;
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+
+ATF_TC(timer_create_bogus);
+ATF_TC_HEAD(timer_create_bogus, tc)
+{
+
+	/* Cf. PR lib/42434. */
+	

CVS commit: src

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed May 19 20:04:43 UTC 2010

Modified Files:
src/distrib/sets/lists/comp: mi
src/lib/libpthread: Makefile

Log Message:
Build links for rest of the pthread_attr(3) functions.
Hopefully I got all of them right in the setlist...


To generate a diff of this commit:
cvs rdiff -u -r1.1451 -r1.1452 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.56 -r1.57 src/lib/libpthread/Makefile

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1451 src/distrib/sets/lists/comp/mi:1.1452
--- src/distrib/sets/lists/comp/mi:1.1451	Wed May 19 06:28:53 2010
+++ src/distrib/sets/lists/comp/mi	Wed May 19 20:04:42 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1451 2010/05/19 06:28:53 jruoho Exp $
+#	$NetBSD: mi,v 1.1452 2010/05/19 20:04:42 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -7535,13 +7535,25 @@
 ./usr/share/man/cat3/pthread_attr.0		comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_destroy.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_getdetachstate.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_getguardsize.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_getinheritsched.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_getname_np.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_getschedparam.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_getschedpolicy.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_getscope.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_getstackaddr.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_getstacksize.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_init.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_setcreatesuspend_np.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_setdetachstate.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_setguardsize.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_setinheritsched.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_setname_np.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_attr_setschedparam.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_setschedpolicy.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_setscope.0		comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_setstackaddr.0	comp-c-catman		.cat
+./usr/share/man/cat3/pthread_attr_setstacksize.0	comp-c-catman		.cat
 ./usr/share/man/cat3/pthread_barierattr_destroy.0	comp-obsolete		obsolete
 ./usr/share/man/cat3/pthread_barierattr_init.0	comp-obsolete		obsolete
 ./usr/share/man/cat3/pthread_barrier_destroy.0	comp-c-catman		.cat
@@ -13345,13 +13357,25 @@
 ./usr/share/man/html3/pthread_attr.html		comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_destroy.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_getdetachstate.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_getguardsize.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_getinheritsched.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_getname_np.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_getschedparam.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_getschedpolicy.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_getscope.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_getstackaddr.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_getstacksize.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_init.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_setcreatesuspend_np.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_setdetachstate.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_setguardsize.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_setinheritsched.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_setname_np.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_attr_setschedparam.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_setschedpolicy.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_setscope.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_setstackaddr.html	comp-c-htmlman		html
+./usr/share/man/html3/pthread_attr_setstacksize.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_barrier_destroy.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_barrier_init.html	comp-c-htmlman		html
 ./usr/share/man/html3/pthread_barrier_wait.html	comp-c-htmlman		html
@@ -19147,15 +19171,26 @@
 ./usr/share/man/man3/pthread.3			comp-c-man		.man
 ./usr/share/man/man3/pthread_atfork.3		comp-c-man		.man
 ./usr/share/man/man3/pthread_attr.3		comp-c-man		.man
-./usr/share/man/man3/pthread_attr_destroy.3	comp-c-man		.man
 ./usr/share/man/man3/pthread_attr_getdetachstate.3	

CVS commit: src/sys

2010-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 19 20:41:59 UTC 2010

Modified Files:
src/sys/arch/evbmips/adm5120: machdep.c
src/sys/dev/usb: if_cdce.c
src/sys/net: if_ether.h if_etherip.c if_ethersubr.c if_tap.c

Log Message:
Replace ether_nonstatic_aton with a
- better named one
- not suffering from buffer oveflow
- simpler
- handling different separators
- returning error codes for errors

Some ideas from one posted on tech-net by Jonathan A. Kollasch


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbmips/adm5120/machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.57 -r1.58 src/sys/net/if_ether.h
cvs rdiff -u -r1.29 -r1.30 src/sys/net/if_etherip.c
cvs rdiff -u -r1.179 -r1.180 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.64 -r1.65 src/sys/net/if_tap.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/evbmips/adm5120/machdep.c
diff -u src/sys/arch/evbmips/adm5120/machdep.c:1.16 src/sys/arch/evbmips/adm5120/machdep.c:1.17
--- src/sys/arch/evbmips/adm5120/machdep.c:1.16	Mon Feb  8 14:02:27 2010
+++ src/sys/arch/evbmips/adm5120/machdep.c	Wed May 19 16:41:59 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.16 2010/02/08 19:02:27 joerg Exp $ */
+/* $NetBSD: machdep.c,v 1.17 2010/05/19 20:41:59 christos Exp $ */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -107,7 +107,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.16 2010/02/08 19:02:27 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.17 2010/05/19 20:41:59 christos Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -281,7 +281,7 @@
 		} else if (strcmp(key, kmac) == 0) {
 			prop_data_t pd;
 
-			ether_nonstatic_aton(enaddr, val);
+			(void)ether_aton_r(enaddr, sizeof(enaddr), val);
 			if (properties == NULL)
 continue;
 			pd = prop_data_create_data(enaddr, sizeof(enaddr));

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.28 src/sys/dev/usb/if_cdce.c:1.29
--- src/sys/dev/usb/if_cdce.c:1.28	Mon Apr  5 03:21:48 2010
+++ src/sys/dev/usb/if_cdce.c	Wed May 19 16:41:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.28 2010/04/05 07:21:48 joerg Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.29 2010/05/19 20:41:59 christos Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul wp...@windriver.com
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_cdce.c,v 1.28 2010/04/05 07:21:48 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_cdce.c,v 1.29 2010/05/19 20:41:59 christos Exp $);
 #ifdef	__NetBSD__
 #include opt_inet.h
 #endif
@@ -268,7 +268,7 @@
 		memcpy(eaddr[1], hardclock_ticks, sizeof(u_int32_t));
 		eaddr[5] = (u_int8_t)(device_unit(sc-cdce_dev));
 	} else {
-		(void)ether_nonstatic_aton(eaddr, eaddr_str);
+		(void)ether_aton_r(eaddr, sizeof(eaddr), eaddr_str);
 	}
 
 	s = splnet();

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.57 src/sys/net/if_ether.h:1.58
--- src/sys/net/if_ether.h:1.57	Wed May 19 14:58:22 2010
+++ src/sys/net/if_ether.h	Wed May 19 16:41:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.57 2010/05/19 18:58:22 jakllsch Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.58 2010/05/19 20:41:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -310,7 +310,7 @@
 uint32_t ether_crc32_le(const uint8_t *, size_t);
 uint32_t ether_crc32_be(const uint8_t *, size_t);
 
-int	ether_nonstatic_aton(u_char *, const char *);
+int	ether_aton_r(u_char *, size_t, const char *);
 #else
 /*
  * Prototype ethers(3) functions.

Index: src/sys/net/if_etherip.c
diff -u src/sys/net/if_etherip.c:1.29 src/sys/net/if_etherip.c:1.30
--- src/sys/net/if_etherip.c:1.29	Mon Apr  5 03:22:23 2010
+++ src/sys/net/if_etherip.c	Wed May 19 16:41:59 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_etherip.c,v 1.29 2010/04/05 07:22:23 joerg Exp $*/
+/*  $NetBSD: if_etherip.c,v 1.30 2010/05/19 20:41:59 christos Exp $*/
 
 /*
  *  Copyright (c) 2006, Hans Rosenfeld rosenf...@grumpf.hope-2000.org
@@ -86,7 +86,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_etherip.c,v 1.29 2010/04/05 07:22:23 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_etherip.c,v 1.30 2010/05/19 20:41:59 christos Exp $);
 
 #include opt_inet.h
 
@@ -691,7 +691,7 @@
 		return EINVAL;
 
 	/* Commit change */
-	if (ether_nonstatic_aton(enaddr, addr) != 0)
+	if (ether_aton_r(enaddr, sizeof(enaddr), addr) != 0)
 		return EINVAL;
 
 	if_set_sadl(ifp, enaddr, ETHER_ADDR_LEN, false);

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.179 src/sys/net/if_ethersubr.c:1.180
--- src/sys/net/if_ethersubr.c:1.179	Wed May 19 14:58:22 2010
+++ src/sys/net/if_ethersubr.c	Wed May 19 16:41:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.179 2010/05/19 18:58:22 jakllsch Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.180 

CVS commit: src/sys/net

2010-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 19 20:43:51 UTC 2010

Modified Files:
src/sys/net: if_ethersubr.c

Log Message:
delint previous


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/net/if_ethersubr.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/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.180 src/sys/net/if_ethersubr.c:1.181
--- src/sys/net/if_ethersubr.c:1.180	Wed May 19 16:41:59 2010
+++ src/sys/net/if_ethersubr.c	Wed May 19 16:43:51 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.180 2010/05/19 20:41:59 christos Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.181 2010/05/19 20:43:51 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ethersubr.c,v 1.180 2010/05/19 20:41:59 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ethersubr.c,v 1.181 2010/05/19 20:43:51 christos Exp $);
 
 #include opt_inet.h
 #include opt_atalk.h
@@ -1226,7 +1226,6 @@
 int
 ether_aton_r(u_char *dest, size_t len, const char *str)
 {
-int i;
 const u_char *cp = (const void *)str;
 	u_char *ep;
 
@@ -1247,7 +1246,7 @@
 			dest++;
 			cp++;
 } else
-			*dest++;
+			dest++;
 		if (dest == ep)
 			return *cp == '\0' ? 0 : ENAMETOOLONG;
 		switch (*cp) {



CVS commit: src/sys/dev/usb

2010-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed May 19 21:10:42 UTC 2010

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

Log Message:
Changes in cdce(4).

When getting the CDC Ethernet descriptor, search for the right
descriptor type.  Avoid ignoring return value of ether_aton_r().

Never return ENETRESET from cdce_ioctl().
This fixes the cannot assign link-local address issue.

Deduplicate a local Ethernet CRC32 function.  When appending
CRC32 for Zaurus ensure it is in a consistent endianess.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/usb/if_cdce.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/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.29 src/sys/dev/usb/if_cdce.c:1.30
--- src/sys/dev/usb/if_cdce.c:1.29	Wed May 19 20:41:59 2010
+++ src/sys/dev/usb/if_cdce.c	Wed May 19 21:10:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.29 2010/05/19 20:41:59 christos Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.30 2010/05/19 21:10:42 jakllsch Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul wp...@windriver.com
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_cdce.c,v 1.29 2010/05/19 20:41:59 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_cdce.c,v 1.30 2010/05/19 21:10:42 jakllsch Exp $);
 #ifdef	__NetBSD__
 #include opt_inet.h
 #endif
@@ -94,7 +94,6 @@
 Static void	 cdce_init(void *);
 Static void	 cdce_watchdog(struct ifnet *);
 Static void	 cdce_stop(struct cdce_softc *);
-Static uint32_t	 cdce_crc32(const void *, size_t);
 
 Static const struct cdce_type cdce_devs[] = {
   {{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2501 }, CDCE_NO_UNION },
@@ -261,14 +260,13 @@
 	}
 
 	ue = (const usb_cdc_ethernet_descriptor_t *)usb_find_desc(dev,
-	UDESC_INTERFACE, UDESCSUB_CDC_ENF);
-	if (!ue || usbd_get_string(dev, ue-iMacAddress, eaddr_str)) {
+	UDESC_CS_INTERFACE, UDESCSUB_CDC_ENF);
+	if (!ue || usbd_get_string(dev, ue-iMacAddress, eaddr_str) ||
+	ether_aton_r(eaddr, sizeof(eaddr), eaddr_str)) {
 		aprint_normal_dev(self, faking address\n);
 		eaddr[0]= 0x2a;
-		memcpy(eaddr[1], hardclock_ticks, sizeof(u_int32_t));
-		eaddr[5] = (u_int8_t)(device_unit(sc-cdce_dev));
-	} else {
-		(void)ether_aton_r(eaddr, sizeof(eaddr), eaddr_str);
+		memcpy(eaddr[1], hardclock_ticks, sizeof(uint32_t));
+		eaddr[5] = (uint8_t)(device_unit(sc-cdce_dev));
 	}
 
 	s = splnet();
@@ -363,11 +361,11 @@
 	m_copydata(m, 0, m-m_pkthdr.len, c-cdce_buf);
 	if (sc-cdce_flags  CDCE_ZAURUS) {
 		/* Zaurus wants a 32-bit CRC appended to every frame */
-		u_int32_t crc;
+		uint32_t crc;
 
-		crc = cdce_crc32(c-cdce_buf, m-m_pkthdr.len);
-		memcpy(c-cdce_buf + m-m_pkthdr.len, crc, 4);
-		extra = 4;
+		crc = htole32(~ether_crc32_le(c-cdce_buf, m-m_pkthdr.len));
+		memcpy(c-cdce_buf + m-m_pkthdr.len, crc, sizeof(crc));
+		extra = sizeof(crc);
 	}
 	c-cdce_mbuf = m;
 
@@ -498,6 +496,9 @@
 
 	splx(s);
 
+	if (error == ENETRESET)
+		error = 0;
+
 	return (error);
 }
 
@@ -787,69 +788,3 @@
 		return EOPNOTSUPP;
 	}
 }
-
-
-/*  COPYRIGHT (C) 1986 Gary S. Brown.  You may use this program, or
- *  code or tables extracted from it, as desired without restriction.
- */
-
-static uint32_t cdce_crc32_tab[] = {
-	0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
-	0xe963a535, 0x9e6495a3,	0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
-	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
-	0xf3b97148, 0x84be41de,	0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-	0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,	0x14015c4f, 0x63066cd9,
-	0xfa0f3d63, 0x8d080df5,	0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
-	0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,	0x35b5a8fa, 0x42b2986c,
-	0xdbbbc9d6, 0xacbcf940,	0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-	0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
-	0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-	0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,	0x76dc4190, 0x01db7106,
-	0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-	0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
-	0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
-	0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
-	0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-	0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
-	0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
-	0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
-	0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-	0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
-	0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
-	0xead54739, 0x9dd277af, 0x04db2615, 

CVS commit: src/regress/sys/net

2010-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 19 21:55:36 UTC 2010

Modified Files:
src/regress/sys/net: Makefile
Added Files:
src/regress/sys/net/ether_aton_r: Makefile autogen main.c

Log Message:
regression test for ether_aton_r()


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/regress/sys/net/Makefile
cvs rdiff -u -r0 -r1.1 src/regress/sys/net/ether_aton_r/Makefile \
src/regress/sys/net/ether_aton_r/autogen \
src/regress/sys/net/ether_aton_r/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/regress/sys/net/Makefile
diff -u src/regress/sys/net/Makefile:1.1 src/regress/sys/net/Makefile:1.2
--- src/regress/sys/net/Makefile:1.1	Wed Dec 14 18:55:02 2005
+++ src/regress/sys/net/Makefile	Wed May 19 17:55:35 2010
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.1 2005/12/14 23:55:02 rpaulo Exp $
+#	$NetBSD: Makefile,v 1.2 2010/05/19 21:55:35 christos Exp $
 
 .include bsd.own.mk
 
-SUBDIR= bpf
+SUBDIR= bpf ether_aton_r
 
 .include bsd.subdir.mk

Added files:

Index: src/regress/sys/net/ether_aton_r/Makefile
diff -u /dev/null src/regress/sys/net/ether_aton_r/Makefile:1.1
--- /dev/null	Wed May 19 17:55:36 2010
+++ src/regress/sys/net/ether_aton_r/Makefile	Wed May 19 17:55:36 2010
@@ -0,0 +1,26 @@
+#	$NetBSD: Makefile,v 1.1 2010/05/19 21:55:36 christos Exp $
+#
+# To use this, copy / link the cpu_in_cksum.S from the arch subdirectory
+# and copy assym.h from the build directory of a kernel.
+#
+
+NOMAN=	# defined
+.include bsd.own.mk
+
+PROG=	ether_aton_r
+SRCS=	ether_aton_r.c main.c
+WARNS ?=	4
+
+CLEANFILES+=ether_aton_r.c
+
+ether_aton_r.c: autogen ${NETBSDSRCDIR}/sys/net/if_ethersubr.c
+	${.ALLSRC} ${.TARGET}
+
+regress:
+	@if ./${PROG} ; then		\
+		echo PASSED;		\
+	else\
+		echo FAILED;		\
+	fi
+
+.include bsd.prog.mk
Index: src/regress/sys/net/ether_aton_r/autogen
diff -u /dev/null src/regress/sys/net/ether_aton_r/autogen:1.1
--- /dev/null	Wed May 19 17:55:36 2010
+++ src/regress/sys/net/ether_aton_r/autogen	Wed May 19 17:55:36 2010
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+cat  __EOF  $2
+
+#include ctype.h
+#include sys/types.h
+#include errno.h
+
+#define ETHER_ADDR_LEN 6
+
+int ether_aton_r(u_char *dest, size_t len, const char *str);
+
+__EOF
+
+ed $1  _EOF  /dev/null 21
+1
+/^ether_aton_r/
+-
+-
+1,.d
+/^}$/
++
+.,\$d
+W $2
+q
+_EOF
Index: src/regress/sys/net/ether_aton_r/main.c
diff -u /dev/null src/regress/sys/net/ether_aton_r/main.c:1.1
--- /dev/null	Wed May 19 17:55:36 2010
+++ src/regress/sys/net/ether_aton_r/main.c	Wed May 19 17:55:36 2010
@@ -0,0 +1,96 @@
+/*	$NetBSD: main.c,v 1.1 2010/05/19 21:55:36 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *This product includes software developed by the NetBSD
+ *Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include sys/cdefs.h
+__RCSID($NetBSD: main.c,v 1.1 2010/05/19 21:55:36 christos Exp $);
+
+#include stdio.h
+#include ctype.h
+#include sys/types.h
+#include err.h
+#include string.h
+#include errno.h
+
+#define ETHER_ADDR_LEN 6
+
+int ether_aton_r(u_char *dest, size_t len, const char *str);
+

CVS commit: src/regress/sys/net/ether_aton_r

2010-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 19 21:59:35 UTC 2010

Modified Files:
src/regress/sys/net/ether_aton_r: main.c

Log Message:
verify hex digits.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/regress/sys/net/ether_aton_r/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/regress/sys/net/ether_aton_r/main.c
diff -u src/regress/sys/net/ether_aton_r/main.c:1.1 src/regress/sys/net/ether_aton_r/main.c:1.2
--- src/regress/sys/net/ether_aton_r/main.c:1.1	Wed May 19 17:55:36 2010
+++ src/regress/sys/net/ether_aton_r/main.c	Wed May 19 17:59:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.1 2010/05/19 21:55:36 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.2 2010/05/19 21:59:34 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: main.c,v 1.1 2010/05/19 21:55:36 christos Exp $);
+__RCSID($NetBSD: main.c,v 1.2 2010/05/19 21:59:34 christos Exp $);
 
 #include stdio.h
 #include ctype.h
@@ -60,6 +60,7 @@
 #define ZERO { 0, 0, 0, 0, 0, 0 }
 	{ { 0, 1, 0x22, 3, 0x14, 5 }, 0:1:22-3:14:05, 0 },
 	{ { 0, 1, 0x22, 3, 0x14, 5 }, 000122031405, 0 },
+	{ { 0xa, 0xB, 0xcc, 0xdD, 0xEE, 0xf }, 0a0BccdDEE0f, 0 },
 	{ ZERO,			  0:1:2-3:04:05:06, ENAMETOOLONG },
 	{ ZERO,			  0:1:2-3:04:, ENOBUFS },
 	{ ZERO,			  0:1:2-3:04:x7, EINVAL },



CVS commit: src/sys/external/bsd/drm/dist/bsd-core

2010-05-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed May 19 22:14:20 UTC 2010

Modified Files:
src/sys/external/bsd/drm/dist/bsd-core: drmP.h drm_sysctl.c

Log Message:
only use bus_space*() on drm_local_map_t's that have been mapped into
some bus space somewhere.  otherwise, just use normal accesses since
it is normal memory.

this fixes radeondrm on x86 since bus_space_tag_t became a pointer.

add the GEM and TTM mapping types to sysctl support (though right
now we will never have them in our list of maps.)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm/dist/bsd-core/drmP.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm/dist/bsd-core/drm_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/sys/external/bsd/drm/dist/bsd-core/drmP.h
diff -u src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.16 src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.17
--- src/sys/external/bsd/drm/dist/bsd-core/drmP.h:1.16	Tue Jan 26 08:01:26 2010
+++ src/sys/external/bsd/drm/dist/bsd-core/drmP.h	Wed May 19 22:14:20 2010
@@ -357,53 +357,6 @@
 	lock; addl $0,0(%%rsp) : : : memory);
 #endif
 
-#if defined(__FreeBSD__)
-
-#define DRM_READ8(map, offset)		\
-	*(volatile u_int8_t *)(((vm_offset_t)(map)-handle) +		\
-	(vm_offset_t)(offset))
-#define DRM_READ16(map, offset)		\
-	*(volatile u_int16_t *)(((vm_offset_t)(map)-handle) +		\
-	(vm_offset_t)(offset))
-#define DRM_READ32(map, offset)		\
-	*(volatile u_int32_t *)(((vm_offset_t)(map)-handle) +		\
-	(vm_offset_t)(offset))
-#define DRM_WRITE8(map, offset, val)	\
-	*(volatile u_int8_t *)(((vm_offset_t)(map)-handle) +		\
-	(vm_offset_t)(offset)) = val
-#define DRM_WRITE16(map, offset, val)	\
-	*(volatile u_int16_t *)(((vm_offset_t)(map)-handle) +		\
-	(vm_offset_t)(offset)) = val
-#define DRM_WRITE32(map, offset, val)	\
-	*(volatile u_int32_t *)(((vm_offset_t)(map)-handle) +		\
-	(vm_offset_t)(offset)) = val
-
-#define DRM_VERIFYAREA_READ( uaddr, size )		\
-	(!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
-
-#elif   defined(__NetBSD__)
-
-typedef vaddr_t vm_offset_t;
-
-#define DRM_READ8(map, offset)		\
-	bus_space_read_1( (map)-bst, (map)-bsh, (offset))
-#define DRM_READ16(map, offset)		\
-	bus_space_read_2( (map)-bst, (map)-bsh, (offset))
-#define DRM_READ32(map, offset)		\
-	bus_space_read_4( (map)-bst, (map)-bsh, (offset))
-#define DRM_WRITE8(map, offset, val)	\
-	bus_space_write_1((map)-bst, (map)-bsh, (offset), (val))
-#define DRM_WRITE16(map, offset, val)	\
-	bus_space_write_2((map)-bst, (map)-bsh, (offset), (val))
-#define DRM_WRITE32(map, offset, val)	\
-	bus_space_write_4((map)-bst, (map)-bsh, (offset), (val))
-
-#define DRM_VERIFYAREA_READ( uaddr, size )		\
-	(!uvm_map_checkprot((curproc-p_vmspace-vm_map),  \
-		(vaddr_t)uaddr, (vaddr_t)uaddr+size, UVM_PROT_READ))
-
-#endif
-
 #define DRM_COPY_TO_USER(user, kern, size) \
 	copyout(kern, user, size)
 #define DRM_COPY_FROM_USER(kern, user, size) \
@@ -929,6 +882,97 @@
 #define drm_core_has_AGP(dev) (0)
 #endif
 
+#if defined(__FreeBSD__)
+
+#define DRM_READ8(map, offset)		\
+	*(volatile u_int8_t *)(((vm_offset_t)(map)-handle) +		\
+	(vm_offset_t)(offset))
+#define DRM_READ16(map, offset)		\
+	*(volatile u_int16_t *)(((vm_offset_t)(map)-handle) +		\
+	(vm_offset_t)(offset))
+#define DRM_READ32(map, offset)		\
+	*(volatile u_int32_t *)(((vm_offset_t)(map)-handle) +		\
+	(vm_offset_t)(offset))
+#define DRM_WRITE8(map, offset, val)	\
+	*(volatile u_int8_t *)(((vm_offset_t)(map)-handle) +		\
+	(vm_offset_t)(offset)) = val
+#define DRM_WRITE16(map, offset, val)	\
+	*(volatile u_int16_t *)(((vm_offset_t)(map)-handle) +		\
+	(vm_offset_t)(offset)) = val
+#define DRM_WRITE32(map, offset, val)	\
+	*(volatile u_int32_t *)(((vm_offset_t)(map)-handle) +		\
+	(vm_offset_t)(offset)) = val
+
+#define DRM_VERIFYAREA_READ( uaddr, size )		\
+	(!useracc(__DECONST(caddr_t, uaddr), size, VM_PROT_READ))
+
+#elif   defined(__NetBSD__)
+
+typedef vaddr_t vm_offset_t;
+
+#define DRM_IS_BUS_SPACE(map)	((map)-type == _DRM_REGISTERS || \
+ (map)-type == _DRM_CONSISTENT)
+
+static __inline__ u_int8_t
+DRM_READ8(drm_local_map_t *map, bus_size_t offset)
+{
+	if (DRM_IS_BUS_SPACE(map))
+		return bus_space_read_1(map-bst, map-bsh, offset);
+	else
+		return *(volatile u_int8_t *)((vaddr_t)map-handle + offset);
+}
+
+static __inline__ u_int16_t
+DRM_READ16(drm_local_map_t *map, bus_size_t offset)
+{
+	if (DRM_IS_BUS_SPACE(map))
+		return bus_space_read_2(map-bst, map-bsh, offset);
+	else
+		return *(volatile u_int16_t *)((vaddr_t)map-handle + offset);
+}
+
+static __inline__ u_int32_t
+DRM_READ32(drm_local_map_t *map, bus_size_t offset)
+{
+	if (DRM_IS_BUS_SPACE(map))
+		return bus_space_read_4(map-bst, map-bsh, offset);
+	else
+		return *(volatile u_int32_t *)((vaddr_t)map-handle + 

CVS commit: src/lib/libp2k

2010-05-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu May 20 00:13:02 UTC 2010

Modified Files:
src/lib/libp2k: p2k.c

Log Message:
Initialize hasdebug default deterministically.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libp2k/p2k.c

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

Modified files:

Index: src/lib/libp2k/p2k.c
diff -u src/lib/libp2k/p2k.c:1.36 src/lib/libp2k/p2k.c:1.37
--- src/lib/libp2k/p2k.c:1.36	Sat May  1 14:44:48 2010
+++ src/lib/libp2k/p2k.c	Thu May 20 00:13:02 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: p2k.c,v 1.36 2010/05/01 14:44:48 pooka Exp $	*/
+/*	$NetBSD: p2k.c,v 1.37 2010/05/20 00:13:02 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009  Antti Kantee.  All Rights Reserved.
@@ -314,6 +314,8 @@
 	PUFFSOP_SET(pops, p2k, node, abortop);
 
 	dodaemon = true;
+	hasdebug = false;
+
 	if (getenv(P2K_DEBUG) != NULL) {
 		puffs_flags |= PUFFS_FLAG_OPDUMP;
 		dodaemon = false;



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2010-05-19 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Thu May 20 00:36:31 UTC 2010

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c

Log Message:
add a static function to resolve the userid in one place, and start to use it


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.51 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.52
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.51	Wed May 19 02:50:16 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Thu May 20 00:36:31 2010
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT(@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.);
-__RCSID($NetBSD: netpgp.c,v 1.51 2010/05/19 02:50:16 agc Exp $);
+__RCSID($NetBSD: netpgp.c,v 1.52 2010/05/20 00:36:31 agc Exp $);
 #endif
 
 #include sys/types.h
@@ -381,6 +381,25 @@
 	return (uint64_t)strtoll(s, NULL, 10);
 }
 
+/* resolve the userid */
+static const __ops_key_t *
+resolve_userid(netpgp_t *netpgp, const char *userid)
+{
+	const __ops_key_t	*key;
+	__ops_io_t		*io;
+
+	if (userid == NULL) {
+		userid = netpgp_getvar(netpgp, userid);
+	} else if (userid[0] == '0'  userid[1] == 'x') {
+		userid += 2;
+	}
+	io = netpgp-io;
+	if ((key = __ops_getkeybyname(io, netpgp-pubring, userid)) == NULL) {
+		(void) fprintf(io-errs, Can't find key '%s'\n, userid);
+	}
+	return key;
+}
+
 /***/
 /* exported functions start here */
 /***/
@@ -654,14 +673,7 @@
 	char			*newkey;
 
 	io = netpgp-io;
-	if (name == NULL) {
-		name = netpgp_getvar(netpgp, userid);
-	} else if (name[0] == '0'  name[1] == 'x') {
-		name += 2;
-	}
-	key = __ops_getkeybyname(netpgp-io, netpgp-pubring, name);
-	if (key == NULL) {
-		(void) fprintf(io-errs, Can't find key '%s'\n, name);
+	if ((key = resolve_userid(netpgp, name)) == NULL) {
 		return NULL;
 	}
 	if (strcmp(fmt, mr) == 0) {
@@ -684,16 +696,8 @@
 	__ops_io_t		*io;
 
 	io = netpgp-io;
-	if (name == NULL) {
-		name = netpgp_getvar(netpgp, userid);
-	} else if (name[0] == '0'  name[1] == 'x') {
-		name += 2;
-	}
-	key = __ops_getkeybyname(io, netpgp-pubring, name);
-	if (key == NULL) {
-		(void) fprintf(io-errs,
-			Cannot find own key \%s\ in keyring\n, name);
-		return 0;
+	if ((key = resolve_userid(netpgp, name)) == NULL) {
+		return NULL;
 	}
 	return __ops_export_key(io, key, NULL);
 }
@@ -817,14 +821,8 @@
 			netpgp_encrypt_file: no filename specified\n);
 		return 0;
 	}
-	if (userid == NULL) {
-		userid = netpgp_getvar(netpgp, userid);
-	}
 	suffix = (armored) ? .asc : .gpg;
-	keypair = __ops_getkeybyname(io, netpgp-pubring, userid);
-	if (keypair == NULL) {
-		(void) fprintf(io-errs, Userid '%s' not found in keyring\n,
-	userid);
+	if ((keypair = resolve_userid(netpgp, userid)) == NULL) {
 		return 0;
 	}
 	if (out == NULL) {



CVS commit: src/lib/libpthread

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu May 20 04:40:23 UTC 2010

Modified Files:
src/lib/libpthread: pthread_cond_init.3 pthread_mutex_init.3
pthread_rwlock_init.3

Log Message:
Note the initializer macros.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libpthread/pthread_cond_init.3
cvs rdiff -u -r1.5 -r1.6 src/lib/libpthread/pthread_mutex_init.3
cvs rdiff -u -r1.8 -r1.9 src/lib/libpthread/pthread_rwlock_init.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/libpthread/pthread_cond_init.3
diff -u src/lib/libpthread/pthread_cond_init.3:1.9 src/lib/libpthread/pthread_cond_init.3:1.10
--- src/lib/libpthread/pthread_cond_init.3:1.9	Mon May 26 08:43:57 2008
+++ src/lib/libpthread/pthread_cond_init.3	Thu May 20 04:40:23 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: pthread_cond_init.3,v 1.9 2008/05/26 08:43:57 wiz Exp $
+.\ $NetBSD: pthread_cond_init.3,v 1.10 2010/05/20 04:40:23 jruoho Exp $
 .\
 .\ Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -51,7 +51,7 @@
 .\
 .\ $FreeBSD: src/lib/libpthread/man/pthread_cond_init.3,v 1.13 2002/09/16 19:29:28 mini Exp $
 .\
-.Dd January 30, 2003
+.Dd May 20, 2010
 .Dt PTHREAD_COND_INIT 3
 .Os
 .Sh NAME
@@ -63,6 +63,8 @@
 .In pthread.h
 .Ft int
 .Fn pthread_cond_init pthread_cond_t * restrict cond const pthread_condattr_t * restrict attr
+.Pp
+.Va pthread_cond_t cond = Dv PTHREAD_COND_INITIALIZER;
 .Sh DESCRIPTION
 The
 .Fn pthread_cond_init
@@ -80,6 +82,18 @@
 condition variable.
 The predicate should identify a state of the
 shared data that must be true before the thread proceeds.
+.Pp
+The macro
+.Dv PTHREAD_COND_INITIALIZER
+can be used to initialize a condition variable when it can be statically
+allocated and the default attributes are appropriate.
+The effect is similar to calling
+.Fn pthread_cond_init
+with
+.Fa attr
+specified as
+.Dv NULL ,
+except that no error checking is done.
 .Sh RETURN VALUES
 If successful, the
 .Fn pthread_cond_init

Index: src/lib/libpthread/pthread_mutex_init.3
diff -u src/lib/libpthread/pthread_mutex_init.3:1.5 src/lib/libpthread/pthread_mutex_init.3:1.6
--- src/lib/libpthread/pthread_mutex_init.3:1.5	Mon May 26 08:43:57 2008
+++ src/lib/libpthread/pthread_mutex_init.3	Thu May 20 04:40:23 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: pthread_mutex_init.3,v 1.5 2008/05/26 08:43:57 wiz Exp $
+.\ $NetBSD: pthread_mutex_init.3,v 1.6 2010/05/20 04:40:23 jruoho Exp $
 .\
 .\ Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -51,7 +51,7 @@
 .\
 .\ $FreeBSD: src/lib/libpthread/man/pthread_mutex_init.3,v 1.12 2002/09/16 19:29:29 mini Exp $
 .\
-.Dd January 30, 2003
+.Dd May 20, 2010
 .Dt PTHREAD_MUTEX_INIT 3
 .Os
 .Sh NAME
@@ -63,6 +63,8 @@
 .In pthread.h
 .Ft int
 .Fn pthread_mutex_init pthread_mutex_t * restrict mutex const pthread_mutexattr_t * restrict attr
+.Pp
+.Va pthread_mutex_t mutex = Dv PTHREAD_MUTEX_INITIALIZER;
 .Sh DESCRIPTION
 The
 .Fn pthread_mutex_init
@@ -71,6 +73,18 @@
 If
 .Fa attr
 is NULL the default attributes are used.
+.Pp
+The macro
+.Dv PTHREAD_MUTEX_INITIALIZER
+can be used to initialize a mutex when the default attributes are
+appropriate and the mutex can be statically allocated.
+The behavior is similar to
+.Fn pthread_mutex_init
+with
+.Fa attr
+specified as
+.Dv NULL ,
+except that no error checking is done.
 .Sh RETURN VALUES
 If successful,
 .Fn pthread_mutex_init

Index: src/lib/libpthread/pthread_rwlock_init.3
diff -u src/lib/libpthread/pthread_rwlock_init.3:1.8 src/lib/libpthread/pthread_rwlock_init.3:1.9
--- src/lib/libpthread/pthread_rwlock_init.3:1.8	Sun May  4 19:43:05 2008
+++ src/lib/libpthread/pthread_rwlock_init.3	Thu May 20 04:40:23 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: pthread_rwlock_init.3,v 1.8 2008/05/04 19:43:05 martin Exp $
+.\ $NetBSD: pthread_rwlock_init.3,v 1.9 2010/05/20 04:40:23 jruoho Exp $
 .\
 .\ Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -48,7 +48,7 @@
 .\
 .\ $FreeBSD: src/lib/libpthread/man/pthread_rwlock_init.3,v 1.6 2002/09/16 19:29:29 mini Exp $
 .\
-.Dd January 30, 2003
+.Dd May 20, 2010
 .Dt PTHREAD_RWLOCK_INIT 3
 .Os
 .Sh NAME
@@ -60,6 +60,8 @@
 .In pthread.h
 .Ft int
 .Fn pthread_rwlock_init pthread_rwlock_t * restrict lock const pthread_rwlockattr_t * restrict attr
+.Pp
+.Va pthread_rwlock_t lock = Dv PTHREAD_RWLOCK_INITIALIZER;
 .Sh DESCRIPTION
 The
 .Fn pthread_rwlock_init
@@ -73,6 +75,18 @@
 The results of calling
 .Fn pthread_rwlock_init
 with an already initialized lock are undefined.
+.Pp
+The macro
+.Dv PTHREAD_RWLOCK_INITIALIZER
+can be used to initialize a read/write lock when the allocation can be done
+statically, no error checking is required, and the default attributes are
+appropriate.
+The behavior is similar to calling
+.Fn pthread_rwlock_init
+with
+.Fa attr
+specified as
+.Dv NULL .
 .Sh RETURN VALUES
 If successful, the
 .Fn 

CVS commit: src/lib/libpthread

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu May 20 04:41:11 UTC 2010

Modified Files:
src/lib/libpthread: pthread_cond_wait.3

Log Message:
.Fa - .Fn.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libpthread/pthread_cond_wait.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/libpthread/pthread_cond_wait.3
diff -u src/lib/libpthread/pthread_cond_wait.3:1.14 src/lib/libpthread/pthread_cond_wait.3:1.15
--- src/lib/libpthread/pthread_cond_wait.3:1.14	Tue May 18 06:31:17 2010
+++ src/lib/libpthread/pthread_cond_wait.3	Thu May 20 04:41:11 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: pthread_cond_wait.3,v 1.14 2010/05/18 06:31:17 jruoho Exp $
+.\ $NetBSD: pthread_cond_wait.3,v 1.15 2010/05/20 04:41:11 jruoho Exp $
 .\
 .\ Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -51,7 +51,7 @@
 .\
 .\ $FreeBSD: src/lib/libpthread/man/pthread_cond_wait.3,v 1.16 2002/09/16 19:29:28 mini Exp $
 .\
-.Dd May 18, 2010
+.Dd May 19, 2010
 .Dt PTHREAD_COND_WAIT 3
 .Os
 .Sh NAME
@@ -82,7 +82,7 @@
 The current thread holds the lock on
 .Fa mutex
 upon return from the
-.Fa pthread_cond_wait
+.Fn pthread_cond_wait
 call.
 .Pp
 The



CVS commit: src/lib/libpthread

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu May 20 04:47:38 UTC 2010

Modified Files:
src/lib/libpthread: pthread_once.3

Log Message:
Use similar markup than in pthread_mutex_init(3) etc. with the initializer
macro. Improve wording slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libpthread/pthread_once.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/libpthread/pthread_once.3
diff -u src/lib/libpthread/pthread_once.3:1.5 src/lib/libpthread/pthread_once.3:1.6
--- src/lib/libpthread/pthread_once.3:1.5	Sun May 16 12:36:32 2010
+++ src/lib/libpthread/pthread_once.3	Thu May 20 04:47:38 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: pthread_once.3,v 1.5 2010/05/16 12:36:32 jruoho Exp $
+.\ $NetBSD: pthread_once.3,v 1.6 2010/05/20 04:47:38 jruoho Exp $
 .\
 .\ Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -55,7 +55,7 @@
 .\
 .\ $FreeBSD: src/lib/libpthread/man/pthread_once.3,v 1.14 2002/09/16 19:29:29 mini Exp $
 .\
-.Dd May 16, 2010
+.Dd May 20, 2010
 .Dt PTHREAD_ONCE 3
 .Os
 .Sh NAME
@@ -65,12 +65,10 @@
 .Lb libpthread
 .Sh SYNOPSIS
 .In pthread.h
-.Pp
-pthread_once_t
-.Fa once_control
-= PTHREAD_ONCE_INIT;
 .Ft int
 .Fn pthread_once pthread_once_t *once_control void (*init_routine)(void)
+.Pp
+.Va pthread_once_t once_control = Dv PTHREAD_ONCE_INIT;
 .Sh DESCRIPTION
 The first call to
 .Fn pthread_once
@@ -108,9 +106,10 @@
 .Pp
 The constant
 .Dv PTHREAD_ONCE_INIT
-is defined by header
-.In pthread.h .
-.Pp
+initializes the static once synchronization control structure
+.Fa once_control
+to be used with
+.Fn pthread_once .
 The behavior of
 .Fn pthread_once
 is undefined if



CVS commit: [netbsd-5] src/lib/libpthread

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:02:07 UTC 2010

Modified Files:
src/lib/libpthread [netbsd-5]: pthread.c

Log Message:
Pull up following revision(s) (requested by explorer in ticket #1353):
lib/libpthread/pthread.c: revision 1.114, 1.115
Correctly set pt_lid in the child, after a fork
--
fix the pthread pt_lid in the fork callback function that runs in the
child instead of a function that may be going away.  KNFify


To generate a diff of this commit:
cvs rdiff -u -r1.106.2.2 -r1.106.2.3 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.106.2.2 src/lib/libpthread/pthread.c:1.106.2.3
--- src/lib/libpthread/pthread.c:1.106.2.2	Mon Jan 11 00:47:29 2010
+++ src/lib/libpthread/pthread.c	Thu May 20 05:02:07 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.106.2.2 2010/01/11 00:47:29 snj Exp $	*/
+/*	$NetBSD: pthread.c,v 1.106.2.3 2010/05/20 05:02:07 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread.c,v 1.106.2.2 2010/01/11 00:47:29 snj Exp $);
+__RCSID($NetBSD: pthread.c,v 1.106.2.3 2010/05/20 05:02:07 snj Exp $);
 
 #define	__EXPOSE_STACK	1
 
@@ -240,11 +240,14 @@
 static void
 pthread__fork_callback(void)
 {
+	struct __pthread_st *self;
 
 	/* lwpctl state is not copied across fork. */
 	if (_lwp_ctl(LWPCTL_FEATURE_CURCPU, pthread__first-pt_lwpctl)) {
 		err(1, _lwp_ctl);
 	}
+	self = pthread__self();
+	self-pt_lid = _lwp_self();
 }
 
 static void



CVS commit: [netbsd-5] src/sys/netinet

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:05:58 UTC 2010

Modified Files:
src/sys/netinet [netbsd-5]: in.c

Log Message:
Revert ticket 1357.


To generate a diff of this commit:
cvs rdiff -u -r1.127.4.2 -r1.127.4.3 src/sys/netinet/in.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/netinet/in.c
diff -u src/sys/netinet/in.c:1.127.4.2 src/sys/netinet/in.c:1.127.4.3
--- src/sys/netinet/in.c:1.127.4.2	Mon Mar 29 00:29:44 2010
+++ src/sys/netinet/in.c	Thu May 20 05:05:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.127.4.2 2010/03/29 00:29:44 snj Exp $	*/
+/*	$NetBSD: in.c,v 1.127.4.3 2010/05/20 05:05:58 snj Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in.c,v 1.127.4.2 2010/03/29 00:29:44 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: in.c,v 1.127.4.3 2010/05/20 05:05:58 snj Exp $);
 
 #include opt_inet.h
 #include opt_inet_conf.h
@@ -398,7 +398,6 @@
 			if (ia == 0)
 return (ENOBUFS);
 			bzero((void *)ia, sizeof *ia);
-			mutex_enter(softnet_lock);
 			TAILQ_INSERT_TAIL(in_ifaddrhead, ia, ia_list);
 			IFAREF(ia-ia_ifa);
 			ifa_insert(ifp, ia-ia_ifa);
@@ -418,7 +417,6 @@
 			ia-ia_ifp = ifp;
 			ia-ia_idsalt = arc4random() % 65535;
 			LIST_INIT(ia-ia_multiaddrs);
-			mutex_exit(softnet_lock);
 			newifaddr = 1;
 		}
 		break;
@@ -466,14 +464,12 @@
 	case SIOCSIFDSTADDR:
 		if ((ifp-if_flags  IFF_POINTOPOINT) == 0)
 			return (EINVAL);
-		mutex_enter(softnet_lock);
 		oldaddr = ia-ia_dstaddr;
 		ia-ia_dstaddr = *satocsin(ifreq_getdstaddr(cmd, ifr));
 		if (ifp-if_ioctl != NULL 
 		(error = (*ifp-if_ioctl)(ifp, SIOCSIFDSTADDR,
 		  (void *)ia)) != 0) {
 			ia-ia_dstaddr = oldaddr;
-			mutex_exit(softnet_lock);
 			return error;
 		}
 		if (ia-ia_flags  IFA_ROUTE) {
@@ -482,7 +478,6 @@
 			ia-ia_ifa.ifa_dstaddr = sintosa(ia-ia_dstaddr);
 			rtinit(ia-ia_ifa, RTM_ADD, RTF_HOST|RTF_UP);
 		}
-		mutex_exit(softnet_lock);
 		break;
 
 	case SIOCSIFBRDADDR:
@@ -492,7 +487,6 @@
 		break;
 
 	case SIOCSIFADDR:
-		mutex_enter(softnet_lock);
 		error = in_ifinit(ifp, ia, satocsin(ifreq_getaddr(cmd, ifr)),
 		1);
 #ifdef PFIL_HOOKS
@@ -500,22 +494,18 @@
 			(void)pfil_run_hooks(if_pfil,
 			(struct mbuf **)SIOCSIFADDR, ifp, PFIL_IFADDR);
 #endif
-		mutex_exit(softnet_lock);
 		break;
 
 	case SIOCSIFNETMASK:
-		mutex_enter(softnet_lock);
 		in_ifscrub(ifp, ia);
 		ia-ia_sockmask = *satocsin(ifreq_getaddr(cmd, ifr));
 		ia-ia_subnetmask = ia-ia_sockmask.sin_addr.s_addr;
 		error = in_ifinit(ifp, ia, NULL, 0);
-		mutex_exit(softnet_lock);
 		break;
 
 	case SIOCAIFADDR:
 		maskIsNew = 0;
 		hostIsNew = 1;
-		mutex_enter(softnet_lock);
 		if (ia-ia_addr.sin_family != AF_INET)
 			;
 		else if (ifra-ifra_addr.sin_len == 0) {
@@ -548,7 +538,6 @@
 			(void)pfil_run_hooks(if_pfil,
 			(struct mbuf **)SIOCAIFADDR, ifp, PFIL_IFADDR);
 #endif
-		mutex_exit(softnet_lock);
 		break;
 
 	case SIOCGIFALIAS:
@@ -565,13 +554,11 @@
 		break;
 
 	case SIOCDIFADDR:
-		mutex_enter(softnet_lock);
 		in_purgeaddr(ia-ia_ifa);
 #ifdef PFIL_HOOKS
 		(void)pfil_run_hooks(if_pfil, (struct mbuf **)SIOCDIFADDR,
 		ifp, PFIL_IFADDR);
 #endif
-		mutex_exit(softnet_lock);
 		break;
 
 #ifdef MROUTING



CVS commit: [netbsd-5] src/distrib/utils/sysinst

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:09:41 UTC 2010

Modified Files:
src/distrib/utils/sysinst [netbsd-5]: mbr.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1375):
distrib/utils/sysinst/mbr.c: revision 1.83
The 16bit bootmenu valid magic is slightly week, collisions have been
seen in the wild. So, before accepting arbitrary strings from there,
validate at least slightly and ignore if the entries are not properly
0 terminated or contain controll characters.


To generate a diff of this commit:
cvs rdiff -u -r1.79.14.1 -r1.79.14.2 src/distrib/utils/sysinst/mbr.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/mbr.c
diff -u src/distrib/utils/sysinst/mbr.c:1.79.14.1 src/distrib/utils/sysinst/mbr.c:1.79.14.2
--- src/distrib/utils/sysinst/mbr.c:1.79.14.1	Mon May 18 19:35:13 2009
+++ src/distrib/utils/sysinst/mbr.c	Thu May 20 05:09:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.79.14.1 2009/05/18 19:35:13 bouyer Exp $ */
+/*	$NetBSD: mbr.c,v 1.79.14.2 2010/05/20 05:09:40 snj Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1377,6 +1377,45 @@
 	return unknown;
 }
 
+#ifdef BOOTSEL
+static int
+validate_and_set_names(mbr_info_t *mbri, const struct mbr_bootsel *src,
+uint32_t ext_base)
+{
+	size_t i, l;
+	const unsigned char *p;
+
+	/*
+	 * The 16 bit magic used to detect wether mbr_bootsel is valid
+	 * or not is pretty week - collisions have been seen in the wild;
+	 * but maybe it is just foreign tools corruption reminiscents
+	 * of NetBSD MBRs. Anyway, before accepting a boot menu definition,
+	 * make sure it is kinda sane.
+	 */
+
+	for (i = 0; i  MBR_PART_COUNT; i++) {
+		/*
+		 * Make sure the name does not contain controll chars
+		 * (not using iscntrl due to minimalistic locale support
+		 * in miniroot environments) and is properly 0-terminated.
+		 */
+		for (l = 0, p = (const unsigned char *)src-mbrbs_nametab[i];
+		*p != 0; l++, p++) {
+			if (l 	MBR_BS_PARTNAMESIZE)
+return 0;
+			if (*p  ' ')	/* hacky 'iscntrl' */
+return 0;
+		}
+	}
+
+	memcpy(mbri-mbrb, src, sizeof(*src));
+
+	if (ext_base == 0)
+		return mbri-mbrb.mbrbs_defkey - SCAN_1;
+	return 0;
+}
+#endif
+
 int
 read_mbr(const char *disk, mbr_info_t *mbri)
 {
@@ -1434,15 +1473,14 @@
 #if BOOTSEL
 		if (mbrs-mbr_bootsel_magic == htole16(MBR_MAGIC)) {
 			/* old bootsel, grab bootsel info */
-			mbri-mbrb = *(struct mbr_bootsel *)
-((uint8_t *)mbrs + MBR_BS_OLD_OFFSET);
-			if (ext_base == 0)
-bootkey = mbri-mbrb.mbrbs_defkey - SCAN_1;
+			bootkey = validate_and_set_names(mbri, 
+(struct mbr_bootsel *)
+((uint8_t *)mbrs + MBR_BS_OLD_OFFSET),
+ext_base);
 		} else if (mbrs-mbr_bootsel_magic == htole16(MBR_BS_MAGIC)) {
 			/* new location */
-			mbri-mbrb = mbrs-mbr_bootsel;
-			if (ext_base == 0)
-bootkey = mbri-mbrb.mbrbs_defkey - SCAN_1;
+			bootkey = validate_and_set_names(mbri,
+			mbrs-mbr_bootsel, ext_base);
 		}
 		/* Save original flags for mbr code update tests */
 		mbri-oflags = mbri-mbrb.mbrbs_flags;



CVS commit: src/lib/libpthread

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu May 20 05:19:29 UTC 2010

Modified Files:
src/lib/libpthread: pthread_mutexattr.3

Log Message:
Use a list with the mutex type. Note, from the standard, that recursive
mutexes should be avoided when condition variables are used.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libpthread/pthread_mutexattr.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/libpthread/pthread_mutexattr.3
diff -u src/lib/libpthread/pthread_mutexattr.3:1.9 src/lib/libpthread/pthread_mutexattr.3:1.10
--- src/lib/libpthread/pthread_mutexattr.3:1.9	Sat Apr 11 16:51:39 2009
+++ src/lib/libpthread/pthread_mutexattr.3	Thu May 20 05:19:29 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: pthread_mutexattr.3,v 1.9 2009/04/11 16:51:39 wiz Exp $
+.\ $NetBSD: pthread_mutexattr.3,v 1.10 2010/05/20 05:19:29 jruoho Exp $
 .\
 .\ Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -50,7 +50,7 @@
 .\ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\
 .\ $FreeBSD: src/lib/libpthread/man/pthread_mutexattr.3,v 1.8 2002/09/16 19:29:29 mini Exp $
-.Dd January 30, 2003
+.Dd May 20, 2010
 .Dt PTHREAD_MUTEXATTR 3
 .Os
 .Sh NAME
@@ -103,42 +103,31 @@
 .Pp
 The
 .Fn pthread_mutexattr_settype
-functions set the mutex type value of the attribute.
+functions set the mutex
+.Fa type
+value of the attribute.
 Valid mutex types are:
-.Dv PTHREAD_MUTEX_NORMAL ,
-.Dv PTHREAD_MUTEX_ERRORCHECK ,
-.Dv PTHREAD_MUTEX_RECURSIVE ,
-and
-.Dv PTHREAD_MUTEX_DEFAULT .
-The default mutex type for
-.Fn pthread_mutexaddr_init
-is
-.Dv PTHREAD_MUTEX_DEFAULT .
-.Pp
-.Dv PTHREAD_MUTEX_NORMAL
-mutexes do not check for usage errors.
-.Dv PTHREAD_MUTEX_NORMAL
-mutexes will deadlock if reentered, and result in undefined behavior if a
+.Bl -tag -width XXX -offset 2n
+.It Dv PTHREAD_MUTEX_NORMAL
+This type of mutex does not check for usage errors.
+It will deadlock if reentered, and result in undefined behavior if a
 locked mutex is unlocked by another thread.
 Attempts to unlock an already unlocked
 .Dv PTHREAD_MUTEX_NORMAL
 mutex will result in undefined behavior.
-.Pp
-.Dv PTHREAD_MUTEX_ERRORCHECK
-mutexes do check for usage errors.
+.It Dv PTHREAD_MUTEX_ERRORCHECK
+These mutexes do check for usage errors.
 If an attempt is made to relock a
 .Dv PTHREAD_MUTEX_ERRORCHECK
-mutex without first dropping the lock an error will be returned.
+mutex without first dropping the lock, an error will be returned.
 If a thread attempts to unlock a
 .Dv PTHREAD_MUTEX_ERRORCHECK
 mutex that is locked by another thread, an error will be returned.
 If a thread attempts to unlock a
 .Dv PTHREAD_MUTEX_ERRORCHECK
-thread that is unlocked, an error will be
-returned.
-.Pp
-.Dv PTHREAD_MUTEX_RECURSIVE
-mutexes allow recursive locking.
+thread that is unlocked, an error will be returned.
+.It Dv PTHREAD_MUTEX_RECURSIVE
+These mutexes allow recursive locking.
 An attempt to relock a
 .Dv PTHREAD_MUTEX_RECURSIVE
 mutex that is already locked by the same thread succeeds.
@@ -153,8 +142,15 @@
 .Dv PTHREAD_MUTEX_RECURSIVE
 thread that is unlocked, an error will be returned.
 .Pp
-.Dv PTHREAD_MUTEX_DEFAULT
-mutexes result in undefined behavior if reentered.
+It is advised that
+.Dv PTHREAD_MUTEX_RECURSIVE
+mutexes are not used with condition variables.
+This is because of the implicit unlocking done by
+.Xr pthread_cond_wait 3
+and
+.Xr pthread_cond_timedwait 3 .
+.It Dv PTHREAD_MUTEX_DEFAULT
+Also this type of mutex will cause undefined behavior if reentered.
 Unlocking a
 .Dv PTHREAD_MUTEX_DEFAULT
 mutex locked by another thread will result in undefined behavior.
@@ -162,6 +158,11 @@
 .Dv PTHREAD_MUTEX_DEFAULT
 mutex will result in undefined behavior.
 .Pp
+This is the default mutex type for
+.Fn pthread_mutexaddr_init .
+.El
+.Pp
+The
 .Fn pthread_mutexattr_gettype
 functions copy the type value of the attribute to the location
 pointed to by the second parameter.



CVS commit: [netbsd-5] src/sys/netinet

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:21:54 UTC 2010

Modified Files:
src/sys/netinet [netbsd-5]: tcp_input.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1382):
sys/netinet/tcp_input.c: revision 1.304
syn_cache_put(): defer all pool_put() to the callout. Reschedule
the callout if needed so frees are not delayed too much.
syn_cache_timer(): we can't call syn_cache_put() here any more,
so move code deleted from syn_cache_put() here.
Avoid KASSERT() in kern_timeout.c because pool_put() is called from
ipintr context, as reported in
http://mail-index.netbsd.org/tech-kern/2010/03/19/msg007762.html
Thanks to Andrew Doran and Mindaugas Rasiukevicius for help and review.


To generate a diff of this commit:
cvs rdiff -u -r1.291.4.2 -r1.291.4.3 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.291.4.2 src/sys/netinet/tcp_input.c:1.291.4.3
--- src/sys/netinet/tcp_input.c:1.291.4.2	Sat Sep 26 18:34:29 2009
+++ src/sys/netinet/tcp_input.c	Thu May 20 05:21:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.291.4.2 2009/09/26 18:34:29 snj Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.291.4.3 2010/05/20 05:21:54 snj Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -145,7 +145,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.291.4.2 2009/09/26 18:34:29 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.291.4.3 2010/05/20 05:21:54 snj Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -3343,12 +3343,9 @@
 	if (sc-sc_ipopts)
 		(void) m_free(sc-sc_ipopts);
 	rtcache_free(sc-sc_route);
-	if (callout_invoking(sc-sc_timer))
-		sc-sc_flags |= SCF_DEAD;
-	else {
-		callout_destroy(sc-sc_timer);
-		pool_put(syn_cache_pool, sc);
-	}
+	sc-sc_flags |= SCF_DEAD;
+	if (!callout_invoking(sc-sc_timer))
+		callout_schedule((sc)-sc_timer, 1);
 }
 
 void
@@ -3509,7 +3506,11 @@
  dropit:
 	TCP_STATINC(TCP_STAT_SC_TIMED_OUT);
 	syn_cache_rm(sc);
-	syn_cache_put(sc);	/* calls pool_put but see spl above */
+	if (sc-sc_ipopts)
+		(void) m_free(sc-sc_ipopts);
+	rtcache_free(sc-sc_route);
+	callout_destroy(sc-sc_timer);
+	pool_put(syn_cache_pool, sc);
 	KERNEL_UNLOCK_ONE(NULL);
 	mutex_exit(softnet_lock);
 }



CVS commit: [netbsd-5] src/crypto/dist/ssh

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:25:30 UTC 2010

Modified Files:
src/crypto/dist/ssh [netbsd-5]: ssh_config ssh_config.5 sshd_config.5

Log Message:
Pull up following revision(s) (requested by drochner in ticket #1384):
crypto/external/bsd/openssh/dist/ssh_config.5: revision 1.3 via patch
crypto/external/bsd/openssh/dist/sshd_config.5: revision 1.4 via patch
crypto/external/bsd/openssh/dist/ssh_config: revision 1.3 via patch
Don't mention umac...@openssh.com MAC algorithm which is not enabled
in our SSH client and daemon as it causes crashes on architectures which
strict aligment requirements (e.g. NetBSD/sparc64).
This fixes PR bin/43221 by myself.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.6.1 src/crypto/dist/ssh/ssh_config
cvs rdiff -u -r1.16 -r1.16.8.1 src/crypto/dist/ssh/ssh_config.5
cvs rdiff -u -r1.15 -r1.15.8.1 src/crypto/dist/ssh/sshd_config.5

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

Modified files:

Index: src/crypto/dist/ssh/ssh_config
diff -u src/crypto/dist/ssh/ssh_config:1.14 src/crypto/dist/ssh/ssh_config:1.14.6.1
--- src/crypto/dist/ssh/ssh_config:1.14	Fri Apr 25 15:01:45 2008
+++ src/crypto/dist/ssh/ssh_config	Thu May 20 05:25:30 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: ssh_config,v 1.14 2008/04/25 15:01:45 jmmv Exp $
+#	$NetBSD: ssh_config,v 1.14.6.1 2010/05/20 05:25:30 snj Exp $
 #	$OpenBSD: ssh_config,v 1.23 2007/06/08 04:40:40 pvalchev Exp $
 
 # This is the ssh client system-wide configuration file.  See
@@ -39,7 +39,7 @@
 #   Protocol 2,1
 #   Cipher 3des
 #   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
-#   MACs hmac-md5,hmac-sha1,umac...@openssh.com,hmac-ripemd160
+#   MACs hmac-md5,hmac-sha1,hmac-ripemd160
 #   EscapeChar ~
 #   Tunnel no
 #   TunnelDevice any:any

Index: src/crypto/dist/ssh/ssh_config.5
diff -u src/crypto/dist/ssh/ssh_config.5:1.16 src/crypto/dist/ssh/ssh_config.5:1.16.8.1
--- src/crypto/dist/ssh/ssh_config.5:1.16	Sun Apr  6 23:38:20 2008
+++ src/crypto/dist/ssh/ssh_config.5	Thu May 20 05:25:30 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: ssh_config.5,v 1.16 2008/04/06 23:38:20 christos Exp $
+.\	$NetBSD: ssh_config.5,v 1.16.8.1 2010/05/20 05:25:30 snj Exp $
 .\  -*- nroff -*-
 .\
 .\ Author: Tatu Ylonen y...@cs.hut.fi
@@ -651,7 +651,7 @@
 Multiple algorithms must be comma-separated.
 The default is:
 .Bd -literal -offset indent
-hmac-md5,hmac-sha1,umac...@openssh.com,
+hmac-md5,hmac-sha1,
 hmac-ripemd160,hmac-sha1-96,hmac-md5-96
 .Ed
 .It Cm NoHostAuthenticationForLocalhost

Index: src/crypto/dist/ssh/sshd_config.5
diff -u src/crypto/dist/ssh/sshd_config.5:1.15 src/crypto/dist/ssh/sshd_config.5:1.15.8.1
--- src/crypto/dist/ssh/sshd_config.5:1.15	Sun Apr  6 23:38:20 2008
+++ src/crypto/dist/ssh/sshd_config.5	Thu May 20 05:25:30 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: sshd_config.5,v 1.15 2008/04/06 23:38:20 christos Exp $
+.\	$NetBSD: sshd_config.5,v 1.15.8.1 2010/05/20 05:25:30 snj Exp $
 .\  -*- nroff -*-
 .\
 .\ Author: Tatu Ylonen y...@cs.hut.fi
@@ -538,7 +538,7 @@
 Multiple algorithms must be comma-separated.
 The default is:
 .Bd -literal -offset indent
-hmac-md5,hmac-sha1,umac...@openssh.com,
+hmac-md5,hmac-sha1,
 hmac-ripemd160,hmac-sha1-96,hmac-md5-96
 .Ed
 .It Cm Match



CVS commit: [netbsd-5] src/sys/conf

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:27:59 UTC 2010

Modified Files:
src/sys/conf [netbsd-5]: copyright

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1388):
sys/conf/copyright: revision 1.7
Welcome to 2010.
Don't forget to update copyright notices when you add new code.


To generate a diff of this commit:
cvs rdiff -u -r1.5.20.1 -r1.5.20.2 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.5.20.1 src/sys/conf/copyright:1.5.20.2
--- src/sys/conf/copyright:1.5.20.1	Wed Jul 29 19:47:59 2009
+++ src/sys/conf/copyright	Thu May 20 05:27:59 2010
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009
+2006, 2007, 2008, 2009, 2010
 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-5-0] src/sys/conf

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:28:58 UTC 2010

Modified Files:
src/sys/conf [netbsd-5-0]: copyright

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1388):
sys/conf/copyright: revision 1.7
Welcome to 2010.
Don't forget to update copyright notices when you add new code.


To generate a diff of this commit:
cvs rdiff -u -r1.5.24.1 -r1.5.24.2 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.5.24.1 src/sys/conf/copyright:1.5.24.2
--- src/sys/conf/copyright:1.5.24.1	Wed Jul 29 19:46:14 2009
+++ src/sys/conf/copyright	Thu May 20 05:28:58 2010
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009
+2006, 2007, 2008, 2009, 2010
 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-5-0] src/distrib/utils/sysinst

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:32:45 UTC 2010

Modified Files:
src/distrib/utils/sysinst [netbsd-5-0]: mbr.c msg.mbr.de msg.mbr.en
msg.mbr.es msg.mbr.fr msg.mbr.pl

Log Message:
Pull up following revision(s) (requested by martin in ticket #1396):
distrib/utils/sysinst/mbr.c: revision 1.84
distrib/utils/sysinst/msg.mbr.de: revision 1.10
distrib/utils/sysinst/msg.mbr.en: revision 1.14
distrib/utils/sysinst/msg.mbr.es: revision 1.5
distrib/utils/sysinst/msg.mbr.fr: revision 1.16
distrib/utils/sysinst/msg.mbr.pl: revision 1.12
Fix a varargs argument type mismatch on 32bit archs - change format to
explicitly use %lu and cast the passed value accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.79.18.1 src/distrib/utils/sysinst/mbr.c
cvs rdiff -u -r1.8 -r1.8.26.1 src/distrib/utils/sysinst/msg.mbr.de
cvs rdiff -u -r1.13 -r1.13.34.1 src/distrib/utils/sysinst/msg.mbr.en
cvs rdiff -u -r1.4 -r1.4.34.1 src/distrib/utils/sysinst/msg.mbr.es
cvs rdiff -u -r1.14 -r1.14.32.1 src/distrib/utils/sysinst/msg.mbr.fr
cvs rdiff -u -r1.11 -r1.11.32.1 src/distrib/utils/sysinst/msg.mbr.pl

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/mbr.c
diff -u src/distrib/utils/sysinst/mbr.c:1.79 src/distrib/utils/sysinst/mbr.c:1.79.18.1
--- src/distrib/utils/sysinst/mbr.c:1.79	Fri Dec 28 00:48:43 2007
+++ src/distrib/utils/sysinst/mbr.c	Thu May 20 05:32:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.79 2007/12/28 00:48:43 dholland Exp $ */
+/*	$NetBSD: mbr.c,v 1.79.18.1 2010/05/20 05:32:45 snj Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1156,8 +1156,8 @@
 
 	msg_display(MSG_editparttable);
 
-	msg_table_add(MSG_part_header, dlsize/sizemult, multname, multname,
-	multname, multname);
+	msg_table_add(MSG_part_header, (unsigned long)(dlsize/sizemult),
+	multname, multname, multname, multname);
 
 	if (num_opts == 0) {
 		num_opts = 6;
@@ -1282,6 +1282,10 @@
 		return(md_mbr_use_wholedisk(mbri));
 	}
 
+	/* Default to MB, and use bios geometry for cylinder size */
+	set_sizemultname_meg();
+	current_cylsize = bhead * bsec;
+
 	mbr_menu = new_menu(NULL, NULL, 16, 0, -1, 15, 70,
 			MC_NOBOX | MC_ALWAYS_SCROLL | MC_NOCLEAR,
 			set_mbr_header, set_mbr_label, NULL,
@@ -1289,10 +1293,6 @@
 	if (mbr_menu == -1)
 		return 0;
 
-	/* Default to MB, and use bios geometry for cylinder size */
-	set_sizemultname_meg();
-	current_cylsize = bhead * bsec;
-
 	for (;;) {
 		ptstart = 0;
 		ptsize = 0;

Index: src/distrib/utils/sysinst/msg.mbr.de
diff -u src/distrib/utils/sysinst/msg.mbr.de:1.8 src/distrib/utils/sysinst/msg.mbr.de:1.8.26.1
--- src/distrib/utils/sysinst/msg.mbr.de:1.8	Thu Feb 15 12:00:15 2007
+++ src/distrib/utils/sysinst/msg.mbr.de	Thu May 20 05:32:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.de,v 1.8 2007/02/15 12:00:15 rillig Exp $	*/
+/*	$NetBSD: msg.mbr.de,v 1.8.26.1 2010/05/20 05:32:45 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -66,7 +66,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Festplattenkapazität insgesamt %d %s.
+{   Festplattenkapazität insgesamt %lu %s.
 
 .if BOOTSEL
Start(%3s) Größe(%3s) Flag TypBootmenü

Index: src/distrib/utils/sysinst/msg.mbr.en
diff -u src/distrib/utils/sysinst/msg.mbr.en:1.13 src/distrib/utils/sysinst/msg.mbr.en:1.13.34.1
--- src/distrib/utils/sysinst/msg.mbr.en:1.13	Sun Apr 23 23:09:48 2006
+++ src/distrib/utils/sysinst/msg.mbr.en	Thu May 20 05:32:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.en,v 1.13 2006/04/23 23:09:48 hubertf Exp $	*/
+/*	$NetBSD: msg.mbr.en,v 1.13.34.1 2010/05/20 05:32:45 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -67,7 +67,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Total disk size %d %s.
+{   Total disk size %lu %s.
 
 .if BOOTSEL
Start(%3s)  Size(%3s) Flg KindBootmenu

Index: src/distrib/utils/sysinst/msg.mbr.es
diff -u src/distrib/utils/sysinst/msg.mbr.es:1.4 src/distrib/utils/sysinst/msg.mbr.es:1.4.34.1
--- src/distrib/utils/sysinst/msg.mbr.es:1.4	Thu Dec  8 16:51:45 2005
+++ src/distrib/utils/sysinst/msg.mbr.es	Thu May 20 05:32:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.es,v 1.4 2005/12/08 16:51:45 xtraeme Exp $	*/
+/*	$NetBSD: msg.mbr.es,v 1.4.34.1 2010/05/20 05:32:45 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -66,7 +66,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Tamaño total del disco %d %s.
+{   Tamaño total del disco %lu %s.
 
 .if BOOTSEL
Inicio(%3s) Tamaño(%3s) Opc TipoBootmenu

Index: src/distrib/utils/sysinst/msg.mbr.fr
diff -u src/distrib/utils/sysinst/msg.mbr.fr:1.14 

CVS commit: [netbsd-5-0] src/distrib/utils/sysinst

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:34:34 UTC 2010

Modified Files:
src/distrib/utils/sysinst [netbsd-5-0]: mbr.c msg.mbr.de msg.mbr.en
msg.mbr.es msg.mbr.fr msg.mbr.pl

Log Message:
Bah, wrong branch.  Revert previous.


To generate a diff of this commit:
cvs rdiff -u -r1.79.18.1 -r1.79.18.2 src/distrib/utils/sysinst/mbr.c
cvs rdiff -u -r1.8.26.1 -r1.8.26.2 src/distrib/utils/sysinst/msg.mbr.de
cvs rdiff -u -r1.13.34.1 -r1.13.34.2 src/distrib/utils/sysinst/msg.mbr.en
cvs rdiff -u -r1.4.34.1 -r1.4.34.2 src/distrib/utils/sysinst/msg.mbr.es
cvs rdiff -u -r1.14.32.1 -r1.14.32.2 src/distrib/utils/sysinst/msg.mbr.fr
cvs rdiff -u -r1.11.32.1 -r1.11.32.2 src/distrib/utils/sysinst/msg.mbr.pl

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/mbr.c
diff -u src/distrib/utils/sysinst/mbr.c:1.79.18.1 src/distrib/utils/sysinst/mbr.c:1.79.18.2
--- src/distrib/utils/sysinst/mbr.c:1.79.18.1	Thu May 20 05:32:45 2010
+++ src/distrib/utils/sysinst/mbr.c	Thu May 20 05:34:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.79.18.1 2010/05/20 05:32:45 snj Exp $ */
+/*	$NetBSD: mbr.c,v 1.79.18.2 2010/05/20 05:34:34 snj Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1156,8 +1156,8 @@
 
 	msg_display(MSG_editparttable);
 
-	msg_table_add(MSG_part_header, (unsigned long)(dlsize/sizemult),
-	multname, multname, multname, multname);
+	msg_table_add(MSG_part_header, dlsize/sizemult, multname, multname,
+	multname, multname);
 
 	if (num_opts == 0) {
 		num_opts = 6;
@@ -1282,10 +1282,6 @@
 		return(md_mbr_use_wholedisk(mbri));
 	}
 
-	/* Default to MB, and use bios geometry for cylinder size */
-	set_sizemultname_meg();
-	current_cylsize = bhead * bsec;
-
 	mbr_menu = new_menu(NULL, NULL, 16, 0, -1, 15, 70,
 			MC_NOBOX | MC_ALWAYS_SCROLL | MC_NOCLEAR,
 			set_mbr_header, set_mbr_label, NULL,
@@ -1293,6 +1289,10 @@
 	if (mbr_menu == -1)
 		return 0;
 
+	/* Default to MB, and use bios geometry for cylinder size */
+	set_sizemultname_meg();
+	current_cylsize = bhead * bsec;
+
 	for (;;) {
 		ptstart = 0;
 		ptsize = 0;

Index: src/distrib/utils/sysinst/msg.mbr.de
diff -u src/distrib/utils/sysinst/msg.mbr.de:1.8.26.1 src/distrib/utils/sysinst/msg.mbr.de:1.8.26.2
--- src/distrib/utils/sysinst/msg.mbr.de:1.8.26.1	Thu May 20 05:32:45 2010
+++ src/distrib/utils/sysinst/msg.mbr.de	Thu May 20 05:34:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.de,v 1.8.26.1 2010/05/20 05:32:45 snj Exp $	*/
+/*	$NetBSD: msg.mbr.de,v 1.8.26.2 2010/05/20 05:34:34 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -66,7 +66,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Festplattenkapazität insgesamt %lu %s.
+{   Festplattenkapazität insgesamt %d %s.
 
 .if BOOTSEL
Start(%3s) Größe(%3s) Flag TypBootmenü

Index: src/distrib/utils/sysinst/msg.mbr.en
diff -u src/distrib/utils/sysinst/msg.mbr.en:1.13.34.1 src/distrib/utils/sysinst/msg.mbr.en:1.13.34.2
--- src/distrib/utils/sysinst/msg.mbr.en:1.13.34.1	Thu May 20 05:32:45 2010
+++ src/distrib/utils/sysinst/msg.mbr.en	Thu May 20 05:34:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.en,v 1.13.34.1 2010/05/20 05:32:45 snj Exp $	*/
+/*	$NetBSD: msg.mbr.en,v 1.13.34.2 2010/05/20 05:34:34 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -67,7 +67,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Total disk size %lu %s.
+{   Total disk size %d %s.
 
 .if BOOTSEL
Start(%3s)  Size(%3s) Flg KindBootmenu

Index: src/distrib/utils/sysinst/msg.mbr.es
diff -u src/distrib/utils/sysinst/msg.mbr.es:1.4.34.1 src/distrib/utils/sysinst/msg.mbr.es:1.4.34.2
--- src/distrib/utils/sysinst/msg.mbr.es:1.4.34.1	Thu May 20 05:32:45 2010
+++ src/distrib/utils/sysinst/msg.mbr.es	Thu May 20 05:34:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.es,v 1.4.34.1 2010/05/20 05:32:45 snj Exp $	*/
+/*	$NetBSD: msg.mbr.es,v 1.4.34.2 2010/05/20 05:34:34 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -66,7 +66,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Tamaño total del disco %lu %s.
+{   Tamaño total del disco %d %s.
 
 .if BOOTSEL
Inicio(%3s) Tamaño(%3s) Opc TipoBootmenu

Index: src/distrib/utils/sysinst/msg.mbr.fr
diff -u src/distrib/utils/sysinst/msg.mbr.fr:1.14.32.1 src/distrib/utils/sysinst/msg.mbr.fr:1.14.32.2
--- src/distrib/utils/sysinst/msg.mbr.fr:1.14.32.1	Thu May 20 05:32:45 2010
+++ src/distrib/utils/sysinst/msg.mbr.fr	Thu May 20 05:34:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.fr,v 1.14.32.1 2010/05/20 05:32:45 snj Exp $	*/
+/*	$NetBSD: msg.mbr.fr,v 1.14.32.2 2010/05/20 05:34:34 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -63,7 +63,7 @@
 
 /* the %s's will 

CVS commit: [netbsd-5] src/distrib/utils/sysinst

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:36:35 UTC 2010

Modified Files:
src/distrib/utils/sysinst [netbsd-5]: mbr.c msg.mbr.de msg.mbr.en
msg.mbr.es msg.mbr.fr msg.mbr.pl

Log Message:
Pull up following revision(s) (requested by martin in ticket #1396):
distrib/utils/sysinst/mbr.c: revision 1.84
distrib/utils/sysinst/msg.mbr.de: revision 1.10
distrib/utils/sysinst/msg.mbr.en: revision 1.14
distrib/utils/sysinst/msg.mbr.es: revision 1.5
distrib/utils/sysinst/msg.mbr.fr: revision 1.16
distrib/utils/sysinst/msg.mbr.pl: revision 1.12
Fix a varargs argument type mismatch on 32bit archs - change format to
explicitly use %lu and cast the passed value accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.79.14.2 -r1.79.14.3 src/distrib/utils/sysinst/mbr.c
cvs rdiff -u -r1.8 -r1.8.22.1 src/distrib/utils/sysinst/msg.mbr.de
cvs rdiff -u -r1.13 -r1.13.30.1 src/distrib/utils/sysinst/msg.mbr.en
cvs rdiff -u -r1.4 -r1.4.30.1 src/distrib/utils/sysinst/msg.mbr.es
cvs rdiff -u -r1.14 -r1.14.28.1 src/distrib/utils/sysinst/msg.mbr.fr
cvs rdiff -u -r1.11 -r1.11.28.1 src/distrib/utils/sysinst/msg.mbr.pl

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/mbr.c
diff -u src/distrib/utils/sysinst/mbr.c:1.79.14.2 src/distrib/utils/sysinst/mbr.c:1.79.14.3
--- src/distrib/utils/sysinst/mbr.c:1.79.14.2	Thu May 20 05:09:40 2010
+++ src/distrib/utils/sysinst/mbr.c	Thu May 20 05:36:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.79.14.2 2010/05/20 05:09:40 snj Exp $ */
+/*	$NetBSD: mbr.c,v 1.79.14.3 2010/05/20 05:36:35 snj Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1156,8 +1156,8 @@
 
 	msg_display(MSG_editparttable);
 
-	msg_table_add(MSG_part_header, dlsize/sizemult, multname, multname,
-	multname, multname);
+	msg_table_add(MSG_part_header, (unsigned long)(dlsize/sizemult),
+	multname, multname, multname, multname);
 
 	if (num_opts == 0) {
 		num_opts = 6;
@@ -1282,6 +1282,10 @@
 		return(md_mbr_use_wholedisk(mbri));
 	}
 
+	/* Default to MB, and use bios geometry for cylinder size */
+	set_sizemultname_meg();
+	current_cylsize = bhead * bsec;
+
 	mbr_menu = new_menu(NULL, NULL, 16, 0, -1, 15, 70,
 			MC_NOBOX | MC_ALWAYS_SCROLL | MC_NOCLEAR,
 			set_mbr_header, set_mbr_label, NULL,
@@ -1289,10 +1293,6 @@
 	if (mbr_menu == -1)
 		return 0;
 
-	/* Default to MB, and use bios geometry for cylinder size */
-	set_sizemultname_meg();
-	current_cylsize = bhead * bsec;
-
 	for (;;) {
 		ptstart = 0;
 		ptsize = 0;

Index: src/distrib/utils/sysinst/msg.mbr.de
diff -u src/distrib/utils/sysinst/msg.mbr.de:1.8 src/distrib/utils/sysinst/msg.mbr.de:1.8.22.1
--- src/distrib/utils/sysinst/msg.mbr.de:1.8	Thu Feb 15 12:00:15 2007
+++ src/distrib/utils/sysinst/msg.mbr.de	Thu May 20 05:36:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.de,v 1.8 2007/02/15 12:00:15 rillig Exp $	*/
+/*	$NetBSD: msg.mbr.de,v 1.8.22.1 2010/05/20 05:36:35 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -66,7 +66,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Festplattenkapazität insgesamt %d %s.
+{   Festplattenkapazität insgesamt %lu %s.
 
 .if BOOTSEL
Start(%3s) Größe(%3s) Flag TypBootmenü

Index: src/distrib/utils/sysinst/msg.mbr.en
diff -u src/distrib/utils/sysinst/msg.mbr.en:1.13 src/distrib/utils/sysinst/msg.mbr.en:1.13.30.1
--- src/distrib/utils/sysinst/msg.mbr.en:1.13	Sun Apr 23 23:09:48 2006
+++ src/distrib/utils/sysinst/msg.mbr.en	Thu May 20 05:36:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.en,v 1.13 2006/04/23 23:09:48 hubertf Exp $	*/
+/*	$NetBSD: msg.mbr.en,v 1.13.30.1 2010/05/20 05:36:35 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -67,7 +67,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Total disk size %d %s.
+{   Total disk size %lu %s.
 
 .if BOOTSEL
Start(%3s)  Size(%3s) Flg KindBootmenu

Index: src/distrib/utils/sysinst/msg.mbr.es
diff -u src/distrib/utils/sysinst/msg.mbr.es:1.4 src/distrib/utils/sysinst/msg.mbr.es:1.4.30.1
--- src/distrib/utils/sysinst/msg.mbr.es:1.4	Thu Dec  8 16:51:45 2005
+++ src/distrib/utils/sysinst/msg.mbr.es	Thu May 20 05:36:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mbr.es,v 1.4 2005/12/08 16:51:45 xtraeme Exp $	*/
+/*	$NetBSD: msg.mbr.es,v 1.4.30.1 2010/05/20 05:36:35 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -66,7 +66,7 @@
 
 /* the %s's will expand into three character strings */
 message part_header
-{   Tamaño total del disco %d %s.
+{   Tamaño total del disco %lu %s.
 
 .if BOOTSEL
Inicio(%3s) Tamaño(%3s) Opc TipoBootmenu

Index: src/distrib/utils/sysinst/msg.mbr.fr
diff -u src/distrib/utils/sysinst/msg.mbr.fr:1.14 

CVS commit: src/share/man/man3

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu May 20 05:37:58 UTC 2010

Modified Files:
src/share/man/man3: timeval.3

Log Message:
Note clock_gettime(2) in the example.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man3/timeval.3

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

Modified files:

Index: src/share/man/man3/timeval.3
diff -u src/share/man/man3/timeval.3:1.9 src/share/man/man3/timeval.3:1.10
--- src/share/man/man3/timeval.3:1.9	Wed May 19 13:41:39 2010
+++ src/share/man/man3/timeval.3	Thu May 20 05:37:58 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: timeval.3,v 1.9 2010/05/19 13:41:39 tsutsui Exp $
+.\ $NetBSD: timeval.3,v 1.10 2010/05/20 05:37:58 jruoho Exp $
 .\
 .\ Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd May 19, 2010
+.Dd May 20, 2010
 .Dt TIMEVAL 3
 .Os
 .Sh NAME
@@ -171,15 +171,17 @@
 {
 	struct timeval elapsed;
 
-	_DIAGASSERT(spec != NULL);
-
 	(void)gettimeofday(elapsed, NULL);
 
+	_DIAGASSERT(spec != NULL);
 	TIMEVAL_TO_TIMESPEC(elapsed, spec);
 
 	/* Add the offset for timeout in minutes. */
 	spec-tv_sec = spec-tv_sec + minutes * 60;
 }
 .Ed
+.Pp
+A better alternative would use the more precise
+.Xr clock_gettime 2 .
 .Sh SEE ALSO
 .Xr timeradd 3



CVS commit: src/lib/libp2k

2010-05-19 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu May 20 05:43:54 UTC 2010

Modified Files:
src/lib/libp2k: p2k.3

Log Message:
Use standard section headers.

Xref vfs(9), which could be slightly more elaborate.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libp2k/p2k.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/libp2k/p2k.3
diff -u src/lib/libp2k/p2k.3:1.7 src/lib/libp2k/p2k.3:1.8
--- src/lib/libp2k/p2k.3:1.7	Sat Nov 21 22:32:52 2009
+++ src/lib/libp2k/p2k.3	Thu May 20 05:43:54 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: p2k.3,v 1.7 2009/11/21 22:32:52 wiz Exp $
+.\ $NetBSD: p2k.3,v 1.8 2010/05/20 05:43:54 jruoho Exp $
 .\
 .\ Copyright (c) 2008 Antti Kantee.  All rights reserved.
 .\
@@ -23,7 +23,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd November 21, 2009
+.Dd May 20, 2010
 .Dt P2K 3
 .Os
 .Sh NAME
@@ -63,8 +63,9 @@
 .Sh DESCRIPTION
 The
 .Nm
-library translates the puffs protocol to the kernel vfs protocol and
-back again.
+library translates the puffs protocol to the kernel
+.Xr vfs 9
+protocol and back again.
 It can therefore be used to mount and run kernel file system code as
 a userspace daemon.
 .Pp
@@ -83,7 +84,7 @@
 The run_fs variants of the interfaces are provided as a convenience
 for the common case.
 They execute all of init, setup and mainloop in one call.
-.Pp
+.Sh ENVIRONMENT
 The following environment variables affect the behaviour of
 .Nm .
 They are useful mostly for debugging purposes.
@@ -96,7 +97,7 @@
 .Xr rump_cd9660 8
 arguments are really parsed by
 .Xr mount_cd9660 8 .
-.Bl -tag -width XP2K_NOCACHE_PAGE
+.Bl -tag -width XP2K_NOCACHE_PAGE -offset 2n
 .It Dv P2K_DEBUG
 Do not detach from tty and print information about each puffs operation.
 .It Dv P2K_NODETACH



CVS commit: [netbsd-5] src/sys/arch/i386/i386

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:51:59 UTC 2010

Modified Files:
src/sys/arch/i386/i386 [netbsd-5]: trap.c vector.S

Log Message:
Pull up following revision(s) (requested by riz in ticket #1401):
sys/arch/i386/i386/trap.c: revisions 1.251-1.253 via patch
sys/arch/i386/i386/vector.S: revisions 1.50-1.51 via patch
If we fault on the 'iret' during return to userpace (eg if %eip is outside
the bounds of %cs) then hack the stack to contain a normal fault frame
for the signal setup code (etc).
Previously the code assumed that the original user trap frame was still
present - at it is for faults when loading the segment registers.
--
If we fault on the iret during return to userspace, see if we need to
do a lazy update of %cs to make the stack executable.
If a change is made, just retry the failing sequence.
Signal handlers as gcc nested local functions now work!
--
Fix 'fault on load of %gs during retirn to userspace' to look for the
 correct instruction bytes.
Take the 'fault on load segment register' through the same path as 'fault
 on iret' so we don't have to fixup the broken stackframe that contains a
 mix of user and kernel registers,
Update comments about how the faults during return to userspace are processed.
Setting an invalid %gs in the saved context of a signal handler causes
 a SIGSEGV handler to be entered with what look like valid registers.


To generate a diff of this commit:
cvs rdiff -u -r1.241.4.1 -r1.241.4.2 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.42.6.2 -r1.42.6.3 src/sys/arch/i386/i386/vector.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/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.241.4.1 src/sys/arch/i386/i386/trap.c:1.241.4.2
--- src/sys/arch/i386/i386/trap.c:1.241.4.1	Fri Mar 27 17:25:15 2009
+++ src/sys/arch/i386/i386/trap.c	Thu May 20 05:51:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $	*/
+/*	$NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.2 2010/05/20 05:51:59 snj Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -131,6 +131,7 @@
 static inline int xmm_si_code(struct lwp *);
 void trap(struct trapframe *);
 void trap_tss(struct i386tss *, int, int);
+void trap_return_fault_return(struct trapframe *) __dead;
 
 #ifdef KVM86
 #include machine/kvm86.h
@@ -276,7 +277,7 @@
 	struct proc *p;
 	int type = frame-tf_trapno;
 	struct pcb *pcb;
-	extern char fusubail[], kcopy_fault[], trapreturn[], IDTVEC(osyscall)[];
+	extern char fusubail[], kcopy_fault[], IDTVEC(osyscall)[];
 	struct trapframe *vframe;
 	ksiginfo_t ksi;
 	void *onfault;
@@ -392,67 +393,76 @@
 
 		/*
 		 * Check for failure during return to user mode.
+		 * This can happen loading invalid values into the segment
+		 * registers, or during the 'iret' itself.
 		 *
 		 * We do this by looking at the instruction we faulted on.
 		 * The specific instructions we recognize only happen when
 		 * returning from a trap, syscall, or interrupt.
-		 *
-		 * At this point, there are (at least) two trap frames on
-		 * the kernel stack; we presume here that we faulted while
-		 * loading our registers out of the outer one.
 		 */
+
+		KSI_INIT_TRAP(ksi);
+		ksi.ksi_signo = SIGSEGV;
+		ksi.ksi_code = SEGV_ACCERR;
+		ksi.ksi_trap = type;
+
 		switch (*(u_char *)frame-tf_eip) {
 		case 0xcf:	/* iret */
-			vframe = (void *)((int)frame-tf_esp -
+			/*
+			 * The 'iret' instruction faulted, so we have the
+			 * 'user' registers saved after the kernel %eip:%cs:%fl
+			 * of the 'iret' and below that the user %eip:%cs:%fl
+			 * the 'iret' was processing.
+			 * We must delete the 3 words of kernel return address
+			 * from the stack to generate a normal stack frame
+			 * (eg for sending a SIGSEGV).
+			 */
+			vframe = (void *)((int *)frame + 3);
+			if (KERNELMODE(vframe-tf_cs, vframe-tf_eflags))
+goto we_re_toast;
+			memmove(vframe, frame,
 			offsetof(struct trapframe, tf_eip));
+			/* Set the faulting address to the user %eip */
+			ksi.ksi_addr = (void *)vframe-tf_eip;
 			break;
 		case 0x8e:
 			switch (*(uint32_t *)frame-tf_eip) {
-			case 0x0c245c8e:	/* movl 0xc(%esp,1),%ds */
-			case 0x0824448e:	/* movl 0x8(%esp,1),%es */
-			case 0x0424648e:	/* movl 0x4(%esp,1),%fs */
-			case 0x00246c8e:	/* movl 0x0(%esp,1),%gs */
+			case 0x8e242c8e:	/* mov (%esp,%gs), then */
+			case 0x0424648e:	/* mov 0x4(%esp),%fs */
+			case 0x0824448e:	/* mov 0x8(%esp),%es */
+			case 0x0c245c8e:	/* mov 0xc(%esp),%ds */
 break;
 			default:
 goto we_re_toast;
 			}
-			vframe = (void *)(int)frame-tf_esp;
+			/*
+			 * We faulted loading 

CVS commit: [netbsd-5-0] src/sys/arch/i386/i386

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:56:30 UTC 2010

Modified Files:
src/sys/arch/i386/i386 [netbsd-5-0]: trap.c vector.S

Log Message:
Pull up following revision(s) (requested by riz in ticket #1401):
sys/arch/i386/i386/trap.c: revisions 1.251-1.253 via patch
sys/arch/i386/i386/vector.S: revisions 1.50-1.51 via patch
If we fault on the 'iret' during return to userpace (eg if %eip is outside
the bounds of %cs) then hack the stack to contain a normal fault frame
for the signal setup code (etc).
Previously the code assumed that the original user trap frame was still
present - at it is for faults when loading the segment registers.
--
If we fault on the iret during return to userspace, see if we need to
do a lazy update of %cs to make the stack executable.
If a change is made, just retry the failing sequence.
Signal handlers as gcc nested local functions now work!
--
Fix 'fault on load of %gs during retirn to userspace' to look for the
 correct instruction bytes.
Take the 'fault on load segment register' through the same path as 'fault
 on iret' so we don't have to fixup the broken stackframe that contains a
 mix of user and kernel registers,
Update comments about how the faults during return to userspace are processed.
Setting an invalid %gs in the saved context of a signal handler causes
 a SIGSEGV handler to be entered with what look like valid registers.


To generate a diff of this commit:
cvs rdiff -u -r1.241.4.1 -r1.241.4.1.2.1 src/sys/arch/i386/i386/trap.c
cvs rdiff -u -r1.42.6.2 -r1.42.6.2.2.1 src/sys/arch/i386/i386/vector.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/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.241.4.1 src/sys/arch/i386/i386/trap.c:1.241.4.1.2.1
--- src/sys/arch/i386/i386/trap.c:1.241.4.1	Fri Mar 27 17:25:15 2009
+++ src/sys/arch/i386/i386/trap.c	Thu May 20 05:56:29 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $	*/
+/*	$NetBSD: trap.c,v 1.241.4.1.2.1 2010/05/20 05:56:29 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.1 2009/03/27 17:25:15 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.241.4.1.2.1 2010/05/20 05:56:29 snj Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -131,6 +131,7 @@
 static inline int xmm_si_code(struct lwp *);
 void trap(struct trapframe *);
 void trap_tss(struct i386tss *, int, int);
+void trap_return_fault_return(struct trapframe *) __dead;
 
 #ifdef KVM86
 #include machine/kvm86.h
@@ -276,7 +277,7 @@
 	struct proc *p;
 	int type = frame-tf_trapno;
 	struct pcb *pcb;
-	extern char fusubail[], kcopy_fault[], trapreturn[], IDTVEC(osyscall)[];
+	extern char fusubail[], kcopy_fault[], IDTVEC(osyscall)[];
 	struct trapframe *vframe;
 	ksiginfo_t ksi;
 	void *onfault;
@@ -392,67 +393,76 @@
 
 		/*
 		 * Check for failure during return to user mode.
+		 * This can happen loading invalid values into the segment
+		 * registers, or during the 'iret' itself.
 		 *
 		 * We do this by looking at the instruction we faulted on.
 		 * The specific instructions we recognize only happen when
 		 * returning from a trap, syscall, or interrupt.
-		 *
-		 * At this point, there are (at least) two trap frames on
-		 * the kernel stack; we presume here that we faulted while
-		 * loading our registers out of the outer one.
 		 */
+
+		KSI_INIT_TRAP(ksi);
+		ksi.ksi_signo = SIGSEGV;
+		ksi.ksi_code = SEGV_ACCERR;
+		ksi.ksi_trap = type;
+
 		switch (*(u_char *)frame-tf_eip) {
 		case 0xcf:	/* iret */
-			vframe = (void *)((int)frame-tf_esp -
+			/*
+			 * The 'iret' instruction faulted, so we have the
+			 * 'user' registers saved after the kernel %eip:%cs:%fl
+			 * of the 'iret' and below that the user %eip:%cs:%fl
+			 * the 'iret' was processing.
+			 * We must delete the 3 words of kernel return address
+			 * from the stack to generate a normal stack frame
+			 * (eg for sending a SIGSEGV).
+			 */
+			vframe = (void *)((int *)frame + 3);
+			if (KERNELMODE(vframe-tf_cs, vframe-tf_eflags))
+goto we_re_toast;
+			memmove(vframe, frame,
 			offsetof(struct trapframe, tf_eip));
+			/* Set the faulting address to the user %eip */
+			ksi.ksi_addr = (void *)vframe-tf_eip;
 			break;
 		case 0x8e:
 			switch (*(uint32_t *)frame-tf_eip) {
-			case 0x0c245c8e:	/* movl 0xc(%esp,1),%ds */
-			case 0x0824448e:	/* movl 0x8(%esp,1),%es */
-			case 0x0424648e:	/* movl 0x4(%esp,1),%fs */
-			case 0x00246c8e:	/* movl 0x0(%esp,1),%gs */
+			case 0x8e242c8e:	/* mov (%esp,%gs), then */
+			case 0x0424648e:	/* mov 0x4(%esp),%fs */
+			case 0x0824448e:	/* mov 0x8(%esp),%es */
+			case 0x0c245c8e:	/* mov 0xc(%esp),%ds */
 break;
 			default:
 goto we_re_toast;
 			}
-			vframe = (void *)(int)frame-tf_esp;
+			/*
+			

CVS commit: [netbsd-5-0] src/doc

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:57:43 UTC 2010

Modified Files:
src/doc [netbsd-5-0]: CHANGES-5.0.3

Log Message:
Tickets 1388 and 1401.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/doc/CHANGES-5.0.3

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

Modified files:

Index: src/doc/CHANGES-5.0.3
diff -u src/doc/CHANGES-5.0.3:1.1.2.12 src/doc/CHANGES-5.0.3:1.1.2.13
--- src/doc/CHANGES-5.0.3:1.1.2.12	Fri Apr 23 04:21:59 2010
+++ src/doc/CHANGES-5.0.3	Thu May 20 05:57:43 2010
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0.3,v 1.1.2.12 2010/04/23 04:21:59 snj Exp $
+# $NetBSD: CHANGES-5.0.3,v 1.1.2.13 2010/05/20 05:57:43 snj Exp $
 
 A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3
 release:
@@ -227,3 +227,33 @@
 	marked as not being executable).
 	[jym, ticket #1380]
 
+sys/conf/copyright1.7
+
+	Welcome to 2010.
+	[tsutsui, ticket #1388]
+
+sys/arch/i386/i386/trap.c			1.251-1.253 via patch
+sys/arch/i386/i386/vector.S			1.50-1.51 via patch
+
+	If we fault on the 'iret' during return to userpace (eg if %eip is
+	outside the bounds of %cs) then hack the stack to contain a normal
+	fault frame for the signal setup code (etc).
+	Previously the code assumed that the original user trap frame was
+	still present - at it is for faults when loading the segment
+	registers.
+	--
+	If we fault on the iret during return to userspace, see if we need
+	to do a lazy update of %cs to make the stack executable.  If a
+	change is made, just retry the failing sequence.  Signal handlers
+	as gcc nested local functions now work!
+	--
+	Fix 'fault on load of %gs during retirn to userspace' to look for
+	the correct instruction bytes.  Take the 'fault on load segment
+	register' through the same path as 'fault on iret' so we don't have
+	to fixup the broken stackframe that contains a mix of user and
+	kernel registers. Update comments about how the faults during
+	return to userspace are processed.  Setting an invalid %gs in the
+	saved context of a signal handler causes a SIGSEGV handler to be
+	entered with what look like valid registers.
+	[riz, ticket #1401]
+



CVS commit: [netbsd-5] src/doc

2010-05-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu May 20 05:59:43 UTC 2010

Modified Files:
src/doc [netbsd-5]: CHANGES-5.1

Log Message:
Backout ticket 1357.

Pull up tickets 1353, 1375, 1381, 1384, 1388, 1396, 1400, and 1401.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.228 -r1.1.2.229 src/doc/CHANGES-5.1

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

Modified files:

Index: src/doc/CHANGES-5.1
diff -u src/doc/CHANGES-5.1:1.1.2.228 src/doc/CHANGES-5.1:1.1.2.229
--- src/doc/CHANGES-5.1:1.1.2.228	Sat Apr 24 07:03:20 2010
+++ src/doc/CHANGES-5.1	Thu May 20 05:59:43 2010
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1,v 1.1.2.228 2010/04/24 07:03:20 snj Exp $
+# $NetBSD: CHANGES-5.1,v 1.1.2.229 2010/05/20 05:59:43 snj Exp $
 
 A complete list of changes from the NetBSD 5.0 release to the NetBSD 5.1
 release:
@@ -17133,11 +17133,6 @@
 	under NetBSD dom0.
 	[jym, ticket #1334]
 
-sys/netinet/in.c1.137 via patch
-
-	Fixed a number of race conditions when receiving ipv4 packets.
-	[bouyer, ticket #1357]
-
 xsrc/external/mit/xorg-server/dist/render/glyph.c 1.2
 
 	Merge fdo git change 185185eeb44a277c324be0f58a4b4a469b56b69b.
@@ -17223,3 +17218,83 @@
 	Welcome to 5.1_RC1!
 	[snj]
 
+lib/libpthread/pthread.c			1.114, 1.115
+
+	Correctly set pt_lid in the child, after a fork
+	--
+	Fix the pthread pt_lid in the fork callback function that runs in
+	the child instead of a function that may be going away.
+	[explorer, ticket #1353]
+
+distrib/utils/sysinst/mbr.c			1.83
+
+	The 16bit bootmenu valid magic is slightly weak; collisions have
+	been seen in the wild. So, before accepting arbitrary strings from
+	there, validate at least slightly and ignore if the entries are
+	not properly 0 terminated or contain control characters.
+	[martin, ticket #1375]
+
+sys/net/bpf_filter.c1.36
+
+	The correct check for BPF_K is with BPF_SRC for BPF_ALU ops.
+	Fixes possible division-by-zero crashes by evil filter expressions
+	like len / 0 = 1.  Fixes PR kern/43185.
+	[drochner, ticket #1381]
+
+crypto/external/bsd/openssh/dist/ssh_config	1.3 via patch
+crypto/external/bsd/openssh/dist/ssh_config.5	1.3 via patch
+crypto/external/bsd/openssh/dist/sshd_config.5	1.4 via patch
+
+	Don't mention umac...@openssh.com MAC algorithm which is not
+	enabled in our SSH client and daemon as it causes crashes on
+	architectures which strict aligment requirements (e.g.,
+	NetBSD/sparc64).  PR bin/43221.
+	[drochner, ticket #1384]
+
+sys/conf/copyright1.7
+
+	Welcome to 2010.
+	[tsutsui, ticket #1388]
+
+distrib/utils/sysinst/mbr.c			1.84
+distrib/utils/sysinst/msg.mbr.de		1.10
+distrib/utils/sysinst/msg.mbr.en		1.14
+distrib/utils/sysinst/msg.mbr.es		1.5
+distrib/utils/sysinst/msg.mbr.fr		1.16
+distrib/utils/sysinst/msg.mbr.pl		1.12
+
+	Fix a varargs argument type mismatch on 32bit archs - change format
+	to explicitly use %lu and cast the passed value accordingly.
+	[martin, ticket #1396]
+
+distrib/amd64/floppies/common/boot.cfg		1.3
+
+	Update boot.cfg banner/menu to reflect that installation floppies
+	have ACPI support.
+	[dholland, ticket #1400]
+
+sys/arch/i386/i386/trap.c			1.251-1.253 via patch
+sys/arch/i386/i386/vector.S			1.50-1.51 via patch
+
+	If we fault on the 'iret' during return to userpace (eg if %eip is
+	outside the bounds of %cs) then hack the stack to contain a normal
+	fault frame for the signal setup code (etc).
+	Previously the code assumed that the original user trap frame was
+	still present - at it is for faults when loading the segment
+	registers.
+	--
+	If we fault on the iret during return to userspace, see if we need
+	to do a lazy update of %cs to make the stack executable.  If a
+	change is made, just retry the failing sequence.  Signal handlers
+	as gcc nested local functions now work!
+	--
+	Fix 'fault on load of %gs during retirn to userspace' to look for
+	the correct instruction bytes.  Take the 'fault on load segment
+	register' through the same path as 'fault on iret' so we don't have
+	to fixup the broken stackframe that contains a mix of user and
+	kernel registers. Update comments about how the faults during
+	return to userspace are processed.  Setting an invalid %gs in the
+	saved context of a signal handler causes a SIGSEGV handler to be
+	entered with what look like valid registers.
+	[riz, ticket #1401]
+