CVS commit: [netbsd-6] src

2014-02-03 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb  3 11:54:02 UTC 2014

Modified Files:
src/lib/libc/gen [netbsd-6]: posix_spawn.3
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_init.3
posix_spawn_fileactions.c
src/sys/compat/netbsd32 [netbsd-6]: netbsd32_execve.c
src/sys/kern [netbsd-6]: kern_exec.c

Log Message:
Pull up the following revisions(s) (requested by martin in ticket #1023):
lib/libc/gen/posix_spawn.3: revision 1.5
lib/libc/gen/posix_spawn_file_actions_addopen.3:revision 1.4
lib/libc/gen/posix_spawn_file_actions_init.3:   revision 1.4
lib/libc/gen/posix_spawn_fileactions.c: revision 1.3
sys/compat/netbsd32/netbsd32_execve.c:  revision 1.38
sys/kern/kern_exec.c:   revision 1.373

Limit the amount of kernel memory a posix_spawn syscall can use (for
handling the file action list) by limiting the maximum number of file
actions to twice the current file descriptor limit. Fix a few bugs in
the support functions and document the new limit. From Maxime Villard.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 src/lib/libc/gen/posix_spawn.3
cvs rdiff -u -r1.1 -r1.1.2.1 \
src/lib/libc/gen/posix_spawn_file_actions_addopen.3 \
src/lib/libc/gen/posix_spawn_file_actions_init.3
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/lib/libc/gen/posix_spawn_fileactions.c
cvs rdiff -u -r1.33.2.2 -r1.33.2.3 src/sys/compat/netbsd32/netbsd32_execve.c
cvs rdiff -u -r1.339.2.6 -r1.339.2.7 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/lib/libc/gen/posix_spawn.3
diff -u src/lib/libc/gen/posix_spawn.3:1.2 src/lib/libc/gen/posix_spawn.3:1.2.2.1
--- src/lib/libc/gen/posix_spawn.3:1.2	Mon Feb 13 16:35:59 2012
+++ src/lib/libc/gen/posix_spawn.3	Mon Feb  3 11:54:02 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn.3,v 1.2 2012/02/13 16:35:59 njoly Exp $
+.\ $NetBSD: posix_spawn.3,v 1.2.2.1 2014/02/03 11:54:02 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -182,6 +182,12 @@ flag set (see
 is closed.
 .El
 .Pp
+The maximum number of
+.Fa file_actions
+objects is limited to the
+.Dv RLIMIT_NOFILE
+rlimit times 2.
+.Pp
 The
 .Vt posix_spawnattr_t
 spawn attributes object type is defined in
@@ -420,6 +426,11 @@ or
 .Fn dup2 ,
 in addition to those described by
 .Fn open .
+Finally, if the number of
+.Fa file_actions
+objects exceeds the allowed limit,
+.Er EINVAL
+is returned.
 .El
 .Sh SEE ALSO
 .Xr close 2 ,

Index: src/lib/libc/gen/posix_spawn_file_actions_addopen.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1 src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1.2.1
--- src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawn_file_actions_addopen.3	Mon Feb  3 11:54:02 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.1 2012/02/11 23:31:24 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.1.2.1 2014/02/03 11:54:02 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -149,6 +149,10 @@ functions fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The value specified by
+.Fa file_actions
+is invalid.
+.It Bq Er EBADF
+The value specified by
 .Fa fildes
 or
 .Fa newfildes
Index: src/lib/libc/gen/posix_spawn_file_actions_init.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1 src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1.2.1
--- src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawn_file_actions_init.3	Mon Feb  3 11:54:02 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.1 2012/02/11 23:31:24 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.1.2.1 2014/02/03 11:54:02 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -81,6 +81,10 @@ function will fail if:
 .Bl -tag -width Er
 .It Bq Er ENOMEM
 Insufficient memory exists to initialize the spawn file actions object.
+.It Bq Er EINVAL
+The value specified by
+.Fa file_actions
+is invalid.
 .El
 .Sh SEE ALSO
 .Xr posix_spawn 3 ,

Index: src/lib/libc/gen/posix_spawn_fileactions.c
diff -u src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1 src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.2
--- src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1	Thu Apr 12 17:05:37 2012
+++ src/lib/libc/gen/posix_spawn_fileactions.c	Mon Feb  3 11:54:02 2014
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.1.2.1 2012/04/12 17:05:37 riz Exp $);
+__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.1.2.2 2014/02/03 11:54:02 sborrill Exp $);
 
 #include namespace.h
 
@@ -48,11 +48,11 @@ int
 

CVS commit: [netbsd-6] src/doc

2014-02-03 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb  3 11:55:03 UTC 2014

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1023


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.81 -r1.1.2.82 src/doc/CHANGES-6.2

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-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.81 src/doc/CHANGES-6.2:1.1.2.82
--- src/doc/CHANGES-6.2:1.1.2.81	Wed Jan 15 10:07:13 2014
+++ src/doc/CHANGES-6.2	Mon Feb  3 11:55:03 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.81 2014/01/15 10:07:13 bouyer Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.82 2014/02/03 11:55:03 sborrill Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -1262,3 +1262,17 @@ external/bsd/bind/dist/bin/named/query.c
 			   when serving NSEC3 signed zones.  [RT #35120]
 	[spz, ticket #1016]
 
+lib/libc/gen/posix_spawn.3			1.5
+lib/libc/gen/posix_spawn_file_actions_addopen.3	1.4
+lib/libc/gen/posix_spawn_file_actions_init.3	1.4
+lib/libc/gen/posix_spawn_fileactions.c		1.3
+sys/compat/netbsd32/netbsd32_execve.c		1.38
+sys/kern/kern_exec.c1.373
+
+	Limit the amount of kernel memory a posix_spawn syscall can use
+	(for handling the file action list) by limiting the maximum number
+	of file actions to twice the current file descriptor limit. Fix a
+	few bugs in the support functions and document the new limit. From
+	Maxime Villard.
+	[martin, ticket #1023]
+



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

2014-02-03 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb  3 11:56:46 UTC 2014

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.5

Log Message:
Ticket #1023


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/doc/CHANGES-6.0.5

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-6.0.5
diff -u src/doc/CHANGES-6.0.5:1.1.2.1 src/doc/CHANGES-6.0.5:1.1.2.2
--- src/doc/CHANGES-6.0.5:1.1.2.1	Mon Jan 27 21:25:27 2014
+++ src/doc/CHANGES-6.0.5	Mon Feb  3 11:56:46 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.5,v 1.1.2.1 2014/01/27 21:25:27 bouyer Exp $
+# $NetBSD: CHANGES-6.0.5,v 1.1.2.2 2014/02/03 11:56:46 sborrill Exp $
 
 A complete list of changes from the NetBSD 6.0.4 release to the NetBSD 6.0.5
 release:
@@ -10,3 +10,17 @@ sys/sys/param.h	patched by hand
 	Welcome to 6.0.4_PATCH.
 	[bouyer]
 
+lib/libc/gen/posix_spawn.3			1.5
+lib/libc/gen/posix_spawn_file_actions_addopen.3	1.4
+lib/libc/gen/posix_spawn_file_actions_init.3	1.4
+lib/libc/gen/posix_spawn_fileactions.c		1.3
+sys/compat/netbsd32/netbsd32_execve.c		1.38
+sys/kern/kern_exec.c1.373
+
+	Limit the amount of kernel memory a posix_spawn syscall can use
+	(for handling the file action list) by limiting the maximum number
+	of file actions to twice the current file descriptor limit. Fix a
+	few bugs in the support functions and document the new limit. From
+	Maxime Villard.
+	[martin, ticket #1023]
+



CVS commit: [netbsd-6-0] src

2014-02-03 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb  3 11:56:20 UTC 2014

Modified Files:
src/lib/libc/gen [netbsd-6-0]: posix_spawn.3
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_init.3
posix_spawn_fileactions.c
src/sys/compat/netbsd32 [netbsd-6-0]: netbsd32_execve.c
src/sys/kern [netbsd-6-0]: kern_exec.c

Log Message:
Pull up the following revisions(s) (requested by martin in ticket #1023):
lib/libc/gen/posix_spawn.3: revision 1.5
lib/libc/gen/posix_spawn_file_actions_addopen.3:revision 1.4
lib/libc/gen/posix_spawn_file_actions_init.3:   revision 1.4
lib/libc/gen/posix_spawn_fileactions.c: revision 1.3
sys/compat/netbsd32/netbsd32_execve.c:  revision 1.38
sys/kern/kern_exec.c:   revision 1.373

Limit the amount of kernel memory a posix_spawn syscall can use (for
handling the file action list) by limiting the maximum number of file
actions to twice the current file descriptor limit. Fix a few bugs in
the support functions and document the new limit. From Maxime Villard.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 src/lib/libc/gen/posix_spawn.3
cvs rdiff -u -r1.1 -r1.1.6.1 \
src/lib/libc/gen/posix_spawn_file_actions_addopen.3 \
src/lib/libc/gen/posix_spawn_file_actions_init.3
cvs rdiff -u -r1.1.2.1 -r1.1.2.1.4.1 \
src/lib/libc/gen/posix_spawn_fileactions.c
cvs rdiff -u -r1.33.2.1.4.1 -r1.33.2.1.4.2 \
src/sys/compat/netbsd32/netbsd32_execve.c
cvs rdiff -u -r1.339.2.5.4.1 -r1.339.2.5.4.2 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/lib/libc/gen/posix_spawn.3
diff -u src/lib/libc/gen/posix_spawn.3:1.2 src/lib/libc/gen/posix_spawn.3:1.2.6.1
--- src/lib/libc/gen/posix_spawn.3:1.2	Mon Feb 13 16:35:59 2012
+++ src/lib/libc/gen/posix_spawn.3	Mon Feb  3 11:56:20 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn.3,v 1.2 2012/02/13 16:35:59 njoly Exp $
+.\ $NetBSD: posix_spawn.3,v 1.2.6.1 2014/02/03 11:56:20 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -182,6 +182,12 @@ flag set (see
 is closed.
 .El
 .Pp
+The maximum number of
+.Fa file_actions
+objects is limited to the
+.Dv RLIMIT_NOFILE
+rlimit times 2.
+.Pp
 The
 .Vt posix_spawnattr_t
 spawn attributes object type is defined in
@@ -420,6 +426,11 @@ or
 .Fn dup2 ,
 in addition to those described by
 .Fn open .
+Finally, if the number of
+.Fa file_actions
+objects exceeds the allowed limit,
+.Er EINVAL
+is returned.
 .El
 .Sh SEE ALSO
 .Xr close 2 ,

Index: src/lib/libc/gen/posix_spawn_file_actions_addopen.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1 src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1.6.1
--- src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawn_file_actions_addopen.3	Mon Feb  3 11:56:20 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.1 2012/02/11 23:31:24 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.1.6.1 2014/02/03 11:56:20 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -149,6 +149,10 @@ functions fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The value specified by
+.Fa file_actions
+is invalid.
+.It Bq Er EBADF
+The value specified by
 .Fa fildes
 or
 .Fa newfildes
Index: src/lib/libc/gen/posix_spawn_file_actions_init.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1 src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1.6.1
--- src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawn_file_actions_init.3	Mon Feb  3 11:56:20 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.1 2012/02/11 23:31:24 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.1.6.1 2014/02/03 11:56:20 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -81,6 +81,10 @@ function will fail if:
 .Bl -tag -width Er
 .It Bq Er ENOMEM
 Insufficient memory exists to initialize the spawn file actions object.
+.It Bq Er EINVAL
+The value specified by
+.Fa file_actions
+is invalid.
 .El
 .Sh SEE ALSO
 .Xr posix_spawn 3 ,

Index: src/lib/libc/gen/posix_spawn_fileactions.c
diff -u src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1 src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1.4.1
--- src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1	Thu Apr 12 17:05:37 2012
+++ src/lib/libc/gen/posix_spawn_fileactions.c	Mon Feb  3 11:56:20 2014
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.1.2.1 2012/04/12 17:05:37 riz Exp $);
+__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.1.2.1.4.1 2014/02/03 11:56:20 sborrill Exp $);
 
 #include 

CVS commit: [netbsd-6-1] src

2014-02-03 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Feb  3 11:57:24 UTC 2014

Modified Files:
src/lib/libc/gen [netbsd-6-1]: posix_spawn.3
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_init.3
posix_spawn_fileactions.c
src/sys/compat/netbsd32 [netbsd-6-1]: netbsd32_execve.c
src/sys/kern [netbsd-6-1]: kern_exec.c

Log Message:
Pull up the following revisions(s) (requested by martin in ticket #1023):
lib/libc/gen/posix_spawn.3: revision 1.5
lib/libc/gen/posix_spawn_file_actions_addopen.3:revision 1.4
lib/libc/gen/posix_spawn_file_actions_init.3:   revision 1.4
lib/libc/gen/posix_spawn_fileactions.c: revision 1.3
sys/compat/netbsd32/netbsd32_execve.c:  revision 1.38
sys/kern/kern_exec.c:   revision 1.373

Limit the amount of kernel memory a posix_spawn syscall can use (for
handling the file action list) by limiting the maximum number of file
actions to twice the current file descriptor limit. Fix a few bugs in
the support functions and document the new limit. From Maxime Villard.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.8.1 src/lib/libc/gen/posix_spawn.3
cvs rdiff -u -r1.1 -r1.1.8.1 \
src/lib/libc/gen/posix_spawn_file_actions_addopen.3 \
src/lib/libc/gen/posix_spawn_file_actions_init.3
cvs rdiff -u -r1.1.2.1 -r1.1.2.1.6.1 \
src/lib/libc/gen/posix_spawn_fileactions.c
cvs rdiff -u -r1.33.2.2 -r1.33.2.2.2.1 \
src/sys/compat/netbsd32/netbsd32_execve.c
cvs rdiff -u -r1.339.2.6 -r1.339.2.6.2.1 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/lib/libc/gen/posix_spawn.3
diff -u src/lib/libc/gen/posix_spawn.3:1.2 src/lib/libc/gen/posix_spawn.3:1.2.8.1
--- src/lib/libc/gen/posix_spawn.3:1.2	Mon Feb 13 16:35:59 2012
+++ src/lib/libc/gen/posix_spawn.3	Mon Feb  3 11:57:24 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn.3,v 1.2 2012/02/13 16:35:59 njoly Exp $
+.\ $NetBSD: posix_spawn.3,v 1.2.8.1 2014/02/03 11:57:24 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -182,6 +182,12 @@ flag set (see
 is closed.
 .El
 .Pp
+The maximum number of
+.Fa file_actions
+objects is limited to the
+.Dv RLIMIT_NOFILE
+rlimit times 2.
+.Pp
 The
 .Vt posix_spawnattr_t
 spawn attributes object type is defined in
@@ -420,6 +426,11 @@ or
 .Fn dup2 ,
 in addition to those described by
 .Fn open .
+Finally, if the number of
+.Fa file_actions
+objects exceeds the allowed limit,
+.Er EINVAL
+is returned.
 .El
 .Sh SEE ALSO
 .Xr close 2 ,

Index: src/lib/libc/gen/posix_spawn_file_actions_addopen.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1 src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1.8.1
--- src/lib/libc/gen/posix_spawn_file_actions_addopen.3:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawn_file_actions_addopen.3	Mon Feb  3 11:57:24 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.1 2012/02/11 23:31:24 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_addopen.3,v 1.1.8.1 2014/02/03 11:57:24 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -149,6 +149,10 @@ functions fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
 The value specified by
+.Fa file_actions
+is invalid.
+.It Bq Er EBADF
+The value specified by
 .Fa fildes
 or
 .Fa newfildes
Index: src/lib/libc/gen/posix_spawn_file_actions_init.3
diff -u src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1 src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1.8.1
--- src/lib/libc/gen/posix_spawn_file_actions_init.3:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawn_file_actions_init.3	Mon Feb  3 11:57:24 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.1 2012/02/11 23:31:24 martin Exp $
+.\ $NetBSD: posix_spawn_file_actions_init.3,v 1.1.8.1 2014/02/03 11:57:24 sborrill Exp $
 .\
 .\ Copyright (c) 2008 Ed Schouten e...@freebsd.org
 .\ All rights reserved.
@@ -81,6 +81,10 @@ function will fail if:
 .Bl -tag -width Er
 .It Bq Er ENOMEM
 Insufficient memory exists to initialize the spawn file actions object.
+.It Bq Er EINVAL
+The value specified by
+.Fa file_actions
+is invalid.
 .El
 .Sh SEE ALSO
 .Xr posix_spawn 3 ,

Index: src/lib/libc/gen/posix_spawn_fileactions.c
diff -u src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1 src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1.6.1
--- src/lib/libc/gen/posix_spawn_fileactions.c:1.1.2.1	Thu Apr 12 17:05:37 2012
+++ src/lib/libc/gen/posix_spawn_fileactions.c	Mon Feb  3 11:57:24 2014
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.1.2.1 2012/04/12 17:05:37 riz Exp $);
+__RCSID($NetBSD: posix_spawn_fileactions.c,v 1.1.2.1.6.1 2014/02/03 11:57:24 sborrill Exp $);
 
 #include 

CVS commit: src/sys

2014-02-03 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Feb  3 13:20:21 UTC 2014

Modified Files:
src/sys/compat/netbsd32: netbsd32_netbsd.c
src/sys/uvm: uvm_swap.c uvm_swap.h

Log Message:
Properly translate struct swapent for COMPAT_NETBSD32


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.165 -r1.166 src/sys/uvm/uvm_swap.c
cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/uvm_swap.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.183 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.184
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.183	Sat Jan 25 03:31:12 2014
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Mon Feb  3 13:20:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.183 2014/01/25 03:31:12 christos Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.184 2014/02/03 13:20:20 manu Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_netbsd.c,v 1.183 2014/01/25 03:31:12 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_netbsd.c,v 1.184 2014/02/03 13:20:20 manu Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ddb.h
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, $NetBSD: netbsd32_net
 #include sys/mbuf.h
 #include sys/mman.h
 #include sys/stat.h
+#include sys/swap.h
 #include sys/time.h
 #include sys/signalvar.h
 #include sys/ptrace.h
@@ -73,6 +74,7 @@ __KERNEL_RCSID(0, $NetBSD: netbsd32_net
 #include sys/vfs_syscalls.h
 
 #include uvm/uvm_extern.h
+#include uvm/uvm_swap.h
 
 #include sys/syscallargs.h
 #include sys/proc.h
@@ -1748,6 +1750,51 @@ netbsd32___posix_rename(struct lwp *l, c
 	return (sys___posix_rename(l, ua, retval));
 }
 
+static int
+netbsd32_swapctl_stats(struct lwp *l, struct sys_swapctl_args *uap, register_t *retval)
+{
+	struct swapent *ksep;
+	struct netbsd32_swapent *usep32;
+	struct netbsd32_swapent se32;
+	int count = SCARG(uap, misc);
+	int i, error = 0;
+	size_t ksep_len;
+
+	/* Make sure userland cannot exhaust kernel memory */
+	if ((size_t)count  (size_t)uvmexp.nswapdev)
+		count = uvmexp.nswapdev;
+
+	ksep_len = sizeof(*ksep) * count;
+	ksep = kmem_alloc(ksep_len, KM_SLEEP);
+	usep32 = (struct netbsd32_swapent *)SCARG(uap, arg);
+
+	uvm_swap_stats(SWAP_STATS, ksep, count, retval);
+	count = *retval;
+
+	if (count  1)
+		goto out;
+
+	for (i = 0; i  count; i++) {
+		se32.se_dev = ksep[i].se_dev;
+		se32.se_flags = ksep[i].se_flags;
+		se32.se_nblks = ksep[i].se_nblks;
+		se32.se_inuse = ksep[i].se_inuse;
+		se32.se_priority = ksep[i].se_priority;
+		memcpy(se32.se_path, ksep[i].se_path,
+			sizeof(se32.se_path));
+
+		error = copyout(se32, usep32 + i, sizeof(se32));
+		if (error)
+			break;
+	}
+
+	
+out:
+	kmem_free(ksep, ksep_len);
+
+	return error;
+}
+
 int
 netbsd32_swapctl(struct lwp *l, const struct netbsd32_swapctl_args *uap, register_t *retval)
 {
@@ -1761,6 +1808,11 @@ netbsd32_swapctl(struct lwp *l, const st
 	NETBSD32TO64_UAP(cmd);
 	NETBSD32TOP_UAP(arg, void);
 	NETBSD32TO64_UAP(misc);
+
+	/* SWAP_STATS50 and SWAP_STATS13 structures need no translation */
+	if (SCARG(ua, cmd) == SWAP_STATS)
+		return netbsd32_swapctl_stats(l, ua, retval);
+	
 	return (sys_swapctl(l, ua, retval));
 }
 

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.165 src/sys/uvm/uvm_swap.c:1.166
--- src/sys/uvm/uvm_swap.c:1.165	Sat Nov 23 14:50:40 2013
+++ src/sys/uvm/uvm_swap.c	Mon Feb  3 13:20:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.165 2013/11/23 14:50:40 christos Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.166 2014/02/03 13:20:21 manu Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_swap.c,v 1.165 2013/11/23 14:50:40 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_swap.c,v 1.166 2014/02/03 13:20:21 manu Exp $);
 
 #include opt_uvmhist.h
 #include opt_compat_netbsd.h
@@ -237,8 +237,6 @@ static void		 swaplist_trim(void);
 static int swap_on(struct lwp *, struct swapdev *);
 static int swap_off(struct lwp *, struct swapdev *);
 
-static void uvm_swap_stats(int, struct swapent *, int, register_t *);
-
 static void sw_reg_strategy(struct swapdev *, struct buf *, int);
 static void sw_reg_biodone(struct buf *);
 static void sw_reg_iodone(struct work *wk, void *dummy);
@@ -733,7 +731,7 @@ out:
  * is not known at build time. Hence it would not be possible to
  * ensure it would fit in the stackgap in any case.
  */
-static void
+void
 uvm_swap_stats(int cmd, struct swapent *sep, int sec, register_t *retval)
 {
 	struct swappri *spp;

Index: src/sys/uvm/uvm_swap.h
diff -u src/sys/uvm/uvm_swap.h:1.19 src/sys/uvm/uvm_swap.h:1.20
--- src/sys/uvm/uvm_swap.h:1.19	Sat Nov 23 14:32:13 2013
+++ src/sys/uvm/uvm_swap.h	Mon Feb  3 

CVS commit: src/lib/libm/compiler_rt

2014-02-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Feb  3 13:30:10 UTC 2014

Modified Files:
src/lib/libm/compiler_rt: Makefile.inc

Log Message:
For ancient GCC, disable the missing prototype warning completely.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/compiler_rt/Makefile.inc

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

Modified files:

Index: src/lib/libm/compiler_rt/Makefile.inc
diff -u src/lib/libm/compiler_rt/Makefile.inc:1.3 src/lib/libm/compiler_rt/Makefile.inc:1.4
--- src/lib/libm/compiler_rt/Makefile.inc:1.3	Fri Jan 31 22:17:50 2014
+++ src/lib/libm/compiler_rt/Makefile.inc	Mon Feb  3 13:30:10 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.3 2014/01/31 22:17:50 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.4 2014/02/03 13:30:10 joerg Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -30,6 +30,8 @@ SRCS+=	${src:R}.S
 SRCS+=	${src}
 .if ${HAVE_GCC:U} != 4
 COPTS.${src}+=	-Wno-error=missing-prototypes
+.else
+COPTS.${src}+=	-Wno-missing-prototypes
 .endif
 .  endif
 .endfor



CVS commit: src/external/gpl3/gdb/dist/gdb

2014-02-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Feb  3 14:15:07 UTC 2014

Modified Files:
src/external/gpl3/gdb/dist/gdb: inf-ptrace.c

Log Message:
Try improving a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gdb/dist/gdb/inf-ptrace.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/gpl3/gdb/dist/gdb/inf-ptrace.c
diff -u src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.8 src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.9
--- src/external/gpl3/gdb/dist/gdb/inf-ptrace.c:1.8	Sun Feb  2 23:17:54 2014
+++ src/external/gpl3/gdb/dist/gdb/inf-ptrace.c	Mon Feb  3 14:15:07 2014
@@ -367,7 +367,7 @@ inf_ptrace_resume (struct target_ops *op
 #ifdef __NetBSD__
   /*
* On NetBSD the data field of PT_STEP contains the thread
-   * be stepped and all other threads are continued if  0
+   * to be stepped; all other threads are continued if this value is  0
*/
   sig = ptid_get_lwp(ptid);
 #else



CVS commit: src/lib/libpthread

2014-02-03 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Feb  3 15:51:01 UTC 2014

Modified Files:
src/lib/libpthread: pthread_mutex.c

Log Message:
pthread__mutex_lock_slow: fix the handling of a potential race with the
non-interlocked CAS in the fast unlock path -- it is unsafe to test for
the waiters-bit while the owner thread is running, we have to spin for
the owner or its state change to be sure about the presence of the bit.
Split off the logic into the pthread__mutex_setwaiters() routine.

This is a partial fix to the named lockup problem (also see PR/44756).
It seems there is another race which can be reproduced on faster CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/lib/libpthread/pthread_mutex.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_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.58 src/lib/libpthread/pthread_mutex.c:1.59
--- src/lib/libpthread/pthread_mutex.c:1.58	Fri Jan 31 20:44:01 2014
+++ src/lib/libpthread/pthread_mutex.c	Mon Feb  3 15:51:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.58 2014/01/31 20:44:01 christos Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.59 2014/02/03 15:51:01 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread_mutex.c,v 1.58 2014/01/31 20:44:01 christos Exp $);
+__RCSID($NetBSD: pthread_mutex.c,v 1.59 2014/02/03 15:51:01 rmind Exp $);
 
 #include sys/types.h
 #include sys/lwpctl.h
@@ -208,6 +208,55 @@ pthread__mutex_spin(pthread_mutex_t *ptm
 	return owner;
 }
 
+NOINLINE static void
+pthread__mutex_setwaiters(pthread_t self, pthread_mutex_t *ptm)
+{
+	void *new, *owner;
+
+	/*
+	 * Note that the mutex can become unlocked before we set
+	 * the waiters bit.  If that happens it's not safe to sleep
+	 * as we may never be awoken: we must remove the current
+	 * thread from the waiters list and try again.
+	 *
+	 * Because we are doing this atomically, we can't remove
+	 * one waiter: we must remove all waiters and awken them,
+	 * then sleep in _lwp_park() until we have been awoken. 
+	 *
+	 * Issue a memory barrier to ensure that we are reading
+	 * the value of ptm_owner/pt_mutexwait after we have entered
+	 * the waiters list (the CAS itself must be atomic).
+	 */
+again:
+	membar_consumer();
+	owner = ptm-ptm_owner;
+
+	if (MUTEX_OWNER(owner) == 0) {
+		pthread__mutex_wakeup(self, ptm);
+		return;
+	}
+	if (!MUTEX_HAS_WAITERS(owner)) {
+		new = (void *)((uintptr_t)owner | MUTEX_WAITERS_BIT);
+		if (atomic_cas_ptr(ptm-ptm_owner, owner, new) != owner) {
+			goto again;
+		}
+	}
+
+	/*
+	 * Note that pthread_mutex_unlock() can do a non-interlocked CAS.
+	 * We cannot know if the presence of the waiters bit is stable
+	 * while the holding thread is running.  There are many assumptions;
+	 * see sys/kern/kern_mutex.c for details.  In short, we must spin if
+	 * we see that the holder is running again.
+	 */
+	membar_sync();
+	pthread__mutex_spin(ptm, owner);
+
+	if (membar_consumer(), !MUTEX_HAS_WAITERS(ptm-ptm_owner)) {
+		goto again;
+	}
+}
+
 NOINLINE static int
 pthread__mutex_lock_slow(pthread_mutex_t *ptm)
 {
@@ -277,48 +326,8 @@ pthread__mutex_lock_slow(pthread_mutex_t
 				break;
 		}
 
-		/*
-		 * Set the waiters bit and block.
-		 *
-		 * Note that the mutex can become unlocked before we set
-		 * the waiters bit.  If that happens it's not safe to sleep
-		 * as we may never be awoken: we must remove the current
-		 * thread from the waiters list and try again.
-		 *
-		 * Because we are doing this atomically, we can't remove
-		 * one waiter: we must remove all waiters and awken them,
-		 * then sleep in _lwp_park() until we have been awoken. 
-		 *
-		 * Issue a memory barrier to ensure that we are reading
-		 * the value of ptm_owner/pt_mutexwait after we have entered
-		 * the waiters list (the CAS itself must be atomic).
-		 */
-		membar_consumer();
-		for (owner = ptm-ptm_owner;; owner = next) {
-			if (MUTEX_HAS_WAITERS(owner))
-break;
-			if (MUTEX_OWNER(owner) == 0) {
-pthread__mutex_wakeup(self, ptm);
-break;
-			}
-			new = (void *)((uintptr_t)owner | MUTEX_WAITERS_BIT);
-			next = atomic_cas_ptr(ptm-ptm_owner, owner, new);
-			if (next == owner) {
-/*
- * pthread_mutex_unlock() can do a
- * non-interlocked CAS.  We cannot
- * know if our attempt to set the
- * waiters bit has succeeded while
- * the holding thread is running.
- * There are many assumptions; see
- * sys/kern/kern_mutex.c for details.
- * In short, we must spin if we see
- * that the holder is running again.
- */
-membar_sync();
-next = pthread__mutex_spin(ptm, owner);
-			}
-		}
+		/* Set the waiters bit and block. */
+		pthread__mutex_setwaiters(self, ptm);
 
 		/*
 		 * We may have been awoken by the current thread 

CVS commit: src/sys/compat/netbsd32

2014-02-03 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Feb  3 17:03:16 UTC 2014

Modified Files:
src/sys/compat/netbsd32: netbsd32.h

Log Message:
 Properly translate struct swapent for COMPAT_NETBSD32  (missing commit)


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/compat/netbsd32/netbsd32.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.98 src/sys/compat/netbsd32/netbsd32.h:1.99
--- src/sys/compat/netbsd32/netbsd32.h:1.98	Fri Jan 24 22:10:47 2014
+++ src/sys/compat/netbsd32/netbsd32.h	Mon Feb  3 17:03:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.98 2014/01/24 22:10:47 christos Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.99 2014/02/03 17:03:16 manu Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -384,6 +384,16 @@ struct netbsd32_loadavg {
 	netbsd32_long	fscale;
 };
 
+/* from sys/swap.h */
+struct netbsd32_swapent {
+	netbsd32_dev_t	se_dev;		/* device id */
+	int	se_flags;		/* flags */
+	int	se_nblks;		/* total blocks */
+	int	se_inuse;		/* blocks in use */
+	int	se_priority;		/* priority of this device */
+	char	se_path[PATH_MAX+1];	/* path	name */
+};
+
 /* from sys/ipc.h */
 typedef netbsd32_pointer_t netbsd32_ipc_permp_t;
 struct netbsd32_ipc_perm {



CVS commit: src/sys/arch/mips/mips

2014-02-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Feb  3 19:18:59 UTC 2014

Modified Files:
src/sys/arch/mips/mips: bus_dma.c

Log Message:
Provide a simple version of _bus_dmamap_load_raw.  If each segments can
be mapped by XKPHYS/KSEGn, then the load will succeed.  If it would
require a bounce buffer or being mapped into the kernel's address space,
the load will fail.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/mips/mips/bus_dma.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/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.28 src/sys/arch/mips/mips/bus_dma.c:1.29
--- src/sys/arch/mips/mips/bus_dma.c:1.28	Fri Aug 23 07:15:08 2013
+++ src/sys/arch/mips/mips/bus_dma.c	Mon Feb  3 19:18:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.28 2013/08/23 07:15:08 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.29 2014/02/03 19:18:59 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.28 2013/08/23 07:15:08 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.29 2014/02/03 19:18:59 matt Exp $);
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -624,7 +624,52 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 bus_dma_segment_t *segs, int nsegs, bus_size_t size, int flags)
 {
 
-	panic(_bus_dmamap_load_raw: not implemented);
+	struct vmspace * const vm = vmspace_kernel();
+	const bool coherent_p = (mips_options.mips_cpu_flags  CPU_MIPS_D_CACHE_COHERENT);
+	const bool cached_p = coherent_p || (flags  BUS_DMA_COHERENT) == 0;
+	bus_size_t mapsize = 0;
+	bool first = true;
+	int curseg = 0;
+	int error = 0;
+
+	for (; error == 0  nsegs--  0; segs++) {
+		void *kva;
+#ifdef _LP64
+		if (cached_p) {
+			kva = (void *)MIPS_PHYS_TO_XKPHYS_CACHED(segs-ds_addr);
+		} else {
+			kva = (void *)MIPS_PHYS_TO_XKPHYS_UNCACHED(segs-ds_addr);
+		}
+#else
+		if (ds-ds_addr = MIPS_PHYS_MASK)
+			return EFBIG;
+		if (cached_p) {
+			kva = (void *)MIPS_PHYS_TO_KSEG0(segs-ds_addr);
+		} else {
+			kva = (void *)MIPS_PHYS_TO_KSEG1(segs-ds_addr);
+		}
+#endif	/* _LP64 */
+		mapsize += segs-ds_len;
+		error = _bus_dmamap_load_buffer(t, map, kva, segs-ds_len,
+		vm, flags, curseg, first);
+		first = false;
+	}
+	if (error == 0) {
+		map-dm_mapsize = mapsize;
+		map-dm_nsegs = curseg + 1;
+		map-_dm_vmspace = vm;		/* always kernel */
+		/*
+		 * If our cache is coherent, then the map must be coherent too.
+		 */
+		if (coherent_p)
+			map-_dm_flags |= _BUS_DMAMAP_COHERENT;
+		return 0;
+	}
+	/*
+	 * If bus_dmamem_alloc didn't return memory that didn't need bouncing
+	 * that's a bug which we will not workaround.
+	 */
+	return error;
 }
 
 /*



CVS commit: src/usr.bin/cut

2014-02-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Feb  3 20:22:19 UTC 2014

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

Log Message:
From Igor Sobrado in private email (based on his OpenBSD commit):

improve POSIX compliance by continuing to process the remaining file
operands after not finding an input file.

from the IEEE Std 1003.1-2008 (``POSIX.1'') rationale:

Unlike other utilities, some historical implementations of cut
exit after not finding an input file, rather than continuing to
process the remaining file operands.  This behavior is prohibited
by this volume of POSIX.1-2008, where only the exit status is
affected by this problem.

joint work with jmc@, who identified the compliance issue, and millert@

ok millert@, jmc@


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/cut/cut.c

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

Modified files:

Index: src/usr.bin/cut/cut.c
diff -u src/usr.bin/cut/cut.c:1.28 src/usr.bin/cut/cut.c:1.29
--- src/usr.bin/cut/cut.c:1.28	Wed Jun 20 17:53:39 2012
+++ src/usr.bin/cut/cut.c	Mon Feb  3 20:22:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cut.c,v 1.28 2012/06/20 17:53:39 wiz Exp $	*/
+/*	$NetBSD: cut.c,v 1.29 2014/02/03 20:22:19 wiz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT(@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = @(#)cut.c	8.3 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: cut.c,v 1.28 2012/06/20 17:53:39 wiz Exp $);
+__RCSID($NetBSD: cut.c,v 1.29 2014/02/03 20:22:19 wiz Exp $);
 #endif /* not lint */
 
 #include ctype.h
@@ -76,7 +76,7 @@ main(int argc, char *argv[])
 {
 	FILE *fp;
 	void (*fcn)(FILE *, const char *);
-	int ch;
+	int ch, rval;
 
 	fcn = NULL;
 	(void)setlocale(LC_ALL, );
@@ -126,20 +126,24 @@ main(int argc, char *argv[])
 	else if (bflag  cflag)
 		usage();
 
+	rval = 0;
 	if (*argv)
 		for (; *argv; ++argv) {
 			if (strcmp(*argv, -) == 0)
 fcn(stdin, stdin);
 			else {
-if ((fp = fopen(*argv, r)) == NULL)
-	err(1, %s, *argv);
-fcn(fp, *argv);
-(void)fclose(fp);
+if ((fp = fopen(*argv, r))) {
+	fcn(fp, *argv);
+	(void)fclose(fp);
+} else {
+	rval = 1;
+	warn(%s, *argv);
+}
 			}
 		}
 	else
 		fcn(stdin, stdin);
-	return 0;
+	return(rval);
 }
 
 static size_t autostart, autostop, maxval;



CVS commit: src/lib/libm

2014-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb  3 21:22:21 UTC 2014

Modified Files:
src/lib/libm/arch/vax: n_scalbn.S n_support.S
src/lib/libm/noieee_src: n_fmax.c

Log Message:
Provide scalbnl, scalbnf, logbl, logbf, fmaxl for vax.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/arch/vax/n_scalbn.S
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/arch/vax/n_support.S
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/noieee_src/n_fmax.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/libm/arch/vax/n_scalbn.S
diff -u src/lib/libm/arch/vax/n_scalbn.S:1.4 src/lib/libm/arch/vax/n_scalbn.S:1.5
--- src/lib/libm/arch/vax/n_scalbn.S:1.4	Fri May 24 12:45:40 2013
+++ src/lib/libm/arch/vax/n_scalbn.S	Mon Feb  3 21:22:21 2014
@@ -30,9 +30,11 @@
 #include machine/asm.h
 #include sys/errno.h
 
-RCSID($NetBSD: n_scalbn.S,v 1.4 2013/05/24 12:45:40 martin Exp $)
+RCSID($NetBSD: n_scalbn.S,v 1.5 2014/02/03 21:22:21 martin Exp $)
 
 WEAK_ALIAS(scalbn,_scalbn)
+WEAK_ALIAS(scalbnl,_scalbnl)
+WEAK_ALIAS(scalbnf,_scalbnf)
 WEAK_ALIAS(ldexp,_scalbn)
 WEAK_ALIAS(ldexpf,_scalbnf)
 WEAK_ALIAS(ldexpl,_scalbnl)

Index: src/lib/libm/arch/vax/n_support.S
diff -u src/lib/libm/arch/vax/n_support.S:1.6 src/lib/libm/arch/vax/n_support.S:1.7
--- src/lib/libm/arch/vax/n_support.S:1.6	Thu Aug  7 16:44:45 2003
+++ src/lib/libm/arch/vax/n_support.S	Mon Feb  3 21:22:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: n_support.S,v 1.6 2003/08/07 16:44:45 agc Exp $	*/
+/*	$NetBSD: n_support.S,v 1.7 2014/02/03 21:22:21 martin Exp $	*/
 /*
  * Copyright (c) 1985, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,6 +31,8 @@
  */
 #include machine/asm.h
 
+WEAK_ALIAS(logbl,logb)
+
 	.text
 _sccsid:
 	.asciz @(#)support.s\t1.3 (Berkeley) 8/21/85; 8.1 (ucb.elefunt) 6/4/93
@@ -59,6 +61,15 @@ ENTRY(copysign, 0)
 Lz:	ret
 
 /*
+ * float logbf(float x);
+ */
+ENTRY(logbf, 0)
+	cvtfd   4(%ap),-(%sp)
+	calls   $2,_C_LABEL(logb)
+	cvtdf   %r0,%r0
+	ret
+
+/*
  * double logb(double x);
  */
 ENTRY(logb, 0)

Index: src/lib/libm/noieee_src/n_fmax.c
diff -u src/lib/libm/noieee_src/n_fmax.c:1.1 src/lib/libm/noieee_src/n_fmax.c:1.2
--- src/lib/libm/noieee_src/n_fmax.c:1.1	Sun Jan  9 02:32:13 2011
+++ src/lib/libm/noieee_src/n_fmax.c	Mon Feb  3 21:22:21 2014
@@ -26,11 +26,15 @@
 
 #include sys/cdefs.h
 #if defined(LIBM_SCCS)  !defined(lint)
-__RCSID($NetBSD: n_fmax.c,v 1.1 2011/01/09 02:32:13 jakllsch Exp $);
+__RCSID($NetBSD: n_fmax.c,v 1.2 2014/02/03 21:22:21 martin Exp $);
 #endif
 
 #include math.h
 
+#ifdef __weak_alias
+__weak_alias(fmaxl, fmax);
+#endif
+
 double
 fmax(double x, double y)
 {



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

2014-02-03 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon Feb  3 23:00:32 UTC 2014

Modified Files:
src/sys/arch/i386/isa: npx.c

Log Message:
Since we always run with CR0.NE set (internal fpu using vector 0x10)
npxintr() is only generated when a process executes an FP instruction
and the TS set interrupt takes precedence - so we know the current lwp
owns the fp registers.
It is also then impossible to get a splurious error while saving
the registers.
Ths lets the npxintr() code be simplified somewhat.
XXX: I'm not at all sure it really DTRT if the process actually wished
to fixup anything in the signal handler (or even if the signal is masked).


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/i386/isa/npx.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/i386/isa/npx.c
diff -u src/sys/arch/i386/isa/npx.c:1.150 src/sys/arch/i386/isa/npx.c:1.151
--- src/sys/arch/i386/isa/npx.c:1.150	Sun Feb  2 22:41:20 2014
+++ src/sys/arch/i386/isa/npx.c	Mon Feb  3 23:00:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npx.c,v 1.150 2014/02/02 22:41:20 dsl Exp $	*/
+/*	$NetBSD: npx.c,v 1.151 2014/02/03 23:00:32 dsl Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npx.c,v 1.150 2014/02/02 22:41:20 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: npx.c,v 1.151 2014/02/03 23:00:32 dsl Exp $);
 
 #if 0
 #define IPRINTF(x)	printf x
@@ -127,6 +127,11 @@ __KERNEL_RCSID(0, $NetBSD: npx.c,v 1.15
  * an external fpu, only the one that is part of the cpu fabric.
  * A 486 might not have an fpu, but the 487 is a full 486.
  *
+ * Since we set CR0.NE a FP exception can only happen when a user process
+ * executes a FP instruction. The DNA exception takes precedence, so
+ * the execption can only happen when the lwp already owns the fpu.
+ * In particular the exceptions won't happen in-kernel while saving state.
+ *
  * We do lazy initialization and switching using the TS bit in cr0 and the
  * MDL_USEDFPU bit in mdlwp.
  *
@@ -161,19 +166,6 @@ extern int i386_fpu_fdivbug;
 
 struct npx_softc		*npx_softc;
 
-static inline void
-fpu_save(union savefpu *addr)
-{
-	if (i386_use_fxsave)
-	{
-fxsave(addr-sv_xmm);
-
-		/* FXSAVE doesn't FNINIT like FNSAVE does -- so do it here. */
-		fninit();
-	} else
-		fnsave(addr-sv_87);
-}
-
 #ifndef XEN
 /* Initialise fpu, might be boot cpu or a later cpu coming online */
 void
@@ -221,7 +213,11 @@ fpuinit(struct cpu_info *ci)
  * best a handler could do an fninit followed by an fldcw of a static value.
  * fnclex would be of little use because it would leave junk on the FPU stack.
  *
- * Only called dircetly from i386_trap.S
+ * Only called directly from i386_trap.S (with interrupts disabled)
+ *
+ * Since we have CR0.NE set this can only happen as a result of
+ * executing an FP instruction (and after CR0.TS has been checked).
+ * This means this must be from userspace on the current lwp.
  */
 int npxintr(void *, struct intrframe *);
 int
@@ -231,27 +227,25 @@ npxintr(void *arg, struct intrframe *fra
 	struct lwp *l = ci-ci_fpcurlwp;
 	union savefpu *addr;
 	struct pcb *pcb;
+	uint32_t statbits;
 	ksiginfo_t ksi;
 
+	if (!USERMODE(frame-if_cs, frame-if_eflags))
+		panic(fpu trap from kernel\n);
+
 	kpreempt_disable();
 #ifndef XEN
 	KASSERT((x86_read_psl()  PSL_I) == 0);
 	x86_enable_intr();
 #endif
 
-	curcpu()-ci_data.cpu_ntrap++;
 	IPRINTF((%s: fp intr\n, device_xname(ci-ci_dev)));
 
 	/*
-	 * If we're saving, ignore the interrupt.  The FPU will generate
-	 * another one when we restore the state later.
+	 * At this point, fpcurlwp should be curlwp.  If it wasn't, the TS
+	 * bit should be set, and we should have gotten a DNA exception.
 	 */
-	if (ci-ci_fpsaving) {
-		kpreempt_enable();
-		return (1);
-	}
-
-	if (l == NULL || !i386_fpu_present) {
+	if (l != curlwp || !i386_fpu_present) {
 		printf(npxintr: l = %p, curproc = %p, fpu_present = %d\n,
 		l, curproc, i386_fpu_present);
 		printf(npxintr: came from nowhere);
@@ -259,89 +253,77 @@ npxintr(void *arg, struct intrframe *fra
 		return 1;
 	}
 
-	/*
-	 * At this point, fpcurlwp should be curlwp.  If it wasn't, the TS
-	 * bit should be set, and we should have gotten a DNA exception.
-	 */
-	KASSERT(l == curlwp);
+	/* Find the address of fpcurproc's saved FPU state. */
 	pcb = lwp_getpcb(l);
-
-	/*
-	 * Find the address of fpcurproc's saved FPU state.  (Given the
-	 * invariant above, this is always the one in curpcb.)
-	 */
 	addr = pcb-pcb_savefpu;
 
 	/*
-	 * Save state.  This does an implied fninit.  It had better not halt
-	 * the CPU or we'll hang.
+	 * XXX: (dsl) I think this is all borked.
+	 * We need to save the status word (which contains the cause)
+	 * of the fault, and clear the relevant error bits so that
+	 * the fp instruction doesn't trap again when the signal handler
+	 * returns (or if the 

CVS commit: src/sys

2014-02-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Feb  3 23:11:41 UTC 2014

Modified Files:
src/sys/modules/crypto: Makefile
src/sys/opencrypto: cryptodev.c
src/sys/rump/dev/lib/libopencrypto: Makefile
Removed Files:
src/sys/modules/crypto: crypto.ioconf
src/sys/rump/dev/lib/libopencrypto: CRYPTO.ioconf

Log Message:
Undo previous - it still needs a lot more work.

For now, we'll use the hand-crafted cf* structures and directly
call all the config routines.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/crypto/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/modules/crypto/crypto.ioconf
cvs rdiff -u -r1.76 -r1.77 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.1 -r0 src/sys/rump/dev/lib/libopencrypto/CRYPTO.ioconf
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/dev/lib/libopencrypto/Makefile

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

Modified files:

Index: src/sys/modules/crypto/Makefile
diff -u src/sys/modules/crypto/Makefile:1.2 src/sys/modules/crypto/Makefile:1.3
--- src/sys/modules/crypto/Makefile:1.2	Fri Jan 31 18:12:15 2014
+++ src/sys/modules/crypto/Makefile	Mon Feb  3 23:11:40 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2014/01/31 18:12:15 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.3 2014/02/03 23:11:40 pgoyette Exp $
 
 .include ../Makefile.inc
 
@@ -6,8 +6,6 @@ CPPFLAGS+=	-DCOMPAT_50
 
 .PATH:	${S}/opencrypto
 
-IOCONF=	crypto.ioconf
-
 KMOD=	crypto
 SRCS=	cryptodev.c ocryptodev.c
 

Index: src/sys/opencrypto/cryptodev.c
diff -u src/sys/opencrypto/cryptodev.c:1.76 src/sys/opencrypto/cryptodev.c:1.77
--- src/sys/opencrypto/cryptodev.c:1.76	Fri Jan 31 18:11:32 2014
+++ src/sys/opencrypto/cryptodev.c	Mon Feb  3 23:11:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.c,v 1.76 2014/01/31 18:11:32 pgoyette Exp $ */
+/*	$NetBSD: cryptodev.c,v 1.77 2014/02/03 23:11:40 pgoyette Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $	*/
 /*	$OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $	*/
 
@@ -64,7 +64,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cryptodev.c,v 1.76 2014/01/31 18:11:32 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: cryptodev.c,v 1.77 2014/02/03 23:11:40 pgoyette Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -2138,7 +2138,20 @@ CFATTACH_DECL2_NEW(crypto, 0, crypto_mat
 NULL, NULL, NULL);
 
 #ifdef _MODULE
-#include ioconf.c
+static int cryptoloc[] = { -1, -1 };
+
+static struct cfdata crypto_cfdata[] = {
+	{
+		.cf_name = crypto,
+		.cf_atname = crypto,
+		.cf_unit = 0,
+		.cf_fstate = 0,
+		.cf_loc = cryptoloc,
+		.cf_flags = 0,
+		.cf_pspec = NULL,
+	},
+	{ NULL, NULL, 0, 0, NULL, 0, NULL }
+};
 #endif
 
 static int
@@ -2146,46 +2159,66 @@ crypto_modcmd(modcmd_t cmd, void *arg)
 {
 	int error = 0;
 #ifdef _MODULE
-	device_t dev;
 	devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR;
 #endif
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
-		error = config_init_component(cfdriver_ioconf_crypto,
-	  cfattach_ioconf_crypto,
-	  cfdata_ioconf_crypto);
-		if (error)
+
+		error = config_cfdriver_attach(crypto_cd);
+		if (error) {
 			return error;
+		}
+
+		error = config_cfattach_attach(crypto_cd.cd_name, crypto_ca);
+		if (error) {
+			config_cfdriver_detach(crypto_cd);
+			aprint_error(%s: unable to register cfattach\n,
+crypto_cd.cd_name);
+
+			return error;
+		}
+
+		error = config_cfdata_attach(crypto_cfdata, 1);
+		if (error) {
+			config_cfattach_detach(crypto_cd.cd_name, crypto_ca);
+			config_cfdriver_detach(crypto_cd);
+			aprint_error(%s: unable to register cfdata\n,
+crypto_cd.cd_name);
+
+			return error;
+		}
 
 		error = devsw_attach(crypto_cd.cd_name, NULL, bmajor,
- crypto_cdevsw, cmajor);
+		crypto_cdevsw, cmajor);
 		if (error) {
-			config_fini_component(cfdriver_ioconf_crypto,
-	  cfattach_ioconf_crypto,
-	  cfdata_ioconf_crypto);
+			error = config_cfdata_detach(crypto_cfdata);
+			if (error) {
+return error;
+			}
+			config_cfattach_detach(crypto_cd.cd_name, crypto_ca);
+			config_cfdriver_detach(crypto_cd);
 			aprint_error(%s: unable to register devsw\n,
 crypto_cd.cd_name);
 
 			return error;
 		}
 
-		dev = config_attach_pseudo(cfdata_ioconf_crypto);
-		if (dev)
-			aprint_normal_dev(dev, attached\n);
+		(void)config_attach_pseudo(crypto_cfdata);
 #endif
 
 		return error;
 	case MODULE_CMD_FINI:
 #ifdef _MODULE
-		error = devsw_detach(NULL, crypto_cdevsw);
+		error = config_cfdata_detach(crypto_cfdata);
 		if (error) {
 			return error;
 		}
-		error = config_fini_component(cfdriver_ioconf_crypto,
-	  cfattach_ioconf_crypto,
-	  cfdata_ioconf_crypto);
+
+		config_cfattach_detach(crypto_cd.cd_name, crypto_ca);
+		config_cfdriver_detach(crypto_cd);
+		devsw_detach(NULL, crypto_cdevsw);
 #endif
 
 		return error;

Index: src/sys/rump/dev/lib/libopencrypto/Makefile

CVS commit: src/doc

2014-02-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  4 00:52:47 UTC 2014

Modified Files:
src/doc: CHANGES

Log Message:
consistency fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.1884 -r1.1885 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.1884 src/doc/CHANGES:1.1885
--- src/doc/CHANGES:1.1884	Tue Jan 28 12:32:00 2014
+++ src/doc/CHANGES	Mon Feb  3 19:52:47 2014
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1884 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1885 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -267,7 +267,7 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 		CPUs (which implement a subset of m68k instructions and
 		addressing modes). [matt 20130719]
 	bind: update to 9.9.3-P2 to fix CVE-2013-4854 remote query can cause
-		named to terminate [christos 2013-07-27]
+		named to terminate [christos 20130727]
 	iwn(4): Add support for Centrino Wireless-N 1030 and Centrino
 		Advanced-N 6230 [prlw1 20130728]
 	dhcpcd(8): Import dhcpcd-6.0.5 [roy 20130803]
@@ -325,9 +325,9 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 		[tsutsui 20131227]
 	wm(4): Add support for I354 (C2000 Internal) Ethernet
 		[msaitoh 20131230]
-	tcpdump(8): Import 4.5.1 [christos 2013131231]
+	tcpdump(8): Import 4.5.1 [christos 20131231]
 	libpcap: Import 1.5.2 [christos 20131231]
-	bind: update to 9.9.5b1 [christos 2013-12-31]
+	bind: update to 9.9.5b1 [christos 20131231]
 	wpa: Import wpa_supplicant and hostapd 2.0 [christos 20140102]
 	dhcpcd: Import dhcpcd-6.2.0 [roy 20140103]
 	luna68k: Make bootloader to detect booted device on ROM monitor's



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

2014-02-03 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Tue Feb  4 01:46:39 UTC 2014

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

Log Message:
When building up a PGP public key from an ssh key, do not use the key
file's mtime as the birthtime of the signature - rather, just zero
this value (the key birthtime is an inherent part of calculating the
key id)

This allows public key files to be copied to other file systems, machines
or directories, and still produce the same key id.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 \
src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.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/ssh2pgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.23
--- src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c:1.22	Sat Jan  1 19:53:53 2011
+++ src/crypto/external/bsd/netpgp/dist/src/lib/ssh2pgp.c	Tue Feb  4 01:46:38 2014
@@ -276,7 +276,7 @@ pgp_ssh2pubkey(pgp_io_t *io, const char 
 	(void) memset(key, 0x0, sizeof(*key));
 	pubkey = key-key.seckey.pubkey;
 	pubkey-version = PGP_V4;
-	pubkey-birthtime = st.st_mtime;
+	pubkey-birthtime = 0;
 	/* get key type */
 	ok = 1;
 	switch (pubkey-alg = findstr(pkatypes, buf)) {