CVS commit: src/sys/dev/pad

2017-06-30 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Jul  1 05:50:10 UTC 2017

Modified Files:
src/sys/dev/pad: pad.c padvar.h

Log Message:
sc_audiodev should be defined as a device_t as this is what audio_attach_mi
returns.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pad/padvar.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/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.37 src/sys/dev/pad/pad.c:1.38
--- src/sys/dev/pad/pad.c:1.37	Mon Jun 19 23:54:00 2017
+++ src/sys/dev/pad/pad.c	Sat Jul  1 05:50:10 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.37 2017/06/19 23:54:00 nat Exp $ */
+/* $NetBSD: pad.c,v 1.38 2017/07/01 05:50:10 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.37 2017/06/19 23:54:00 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.38 2017/07/01 05:50:10 nat Exp $");
 
 #include 
 #include 
@@ -277,7 +277,7 @@ pad_attach(device_t parent, device_t sel
 	sc->sc_swvol = 255;
 	sc->sc_buflen = 0;
 	sc->sc_rpos = sc->sc_wpos = 0;
-	sc->sc_audiodev = (void *)audio_attach_mi(_hw_if, sc, sc->sc_dev);
+	sc->sc_audiodev = audio_attach_mi(_hw_if, sc, sc->sc_dev);
 
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");

Index: src/sys/dev/pad/padvar.h
diff -u src/sys/dev/pad/padvar.h:1.9 src/sys/dev/pad/padvar.h:1.10
--- src/sys/dev/pad/padvar.h:1.9	Tue Jun  6 07:31:40 2017
+++ src/sys/dev/pad/padvar.h	Sat Jul  1 05:50:10 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: padvar.h,v 1.9 2017/06/06 07:31:40 nat Exp $ */
+/* $NetBSD: padvar.h,v 1.10 2017/07/01 05:50:10 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -41,7 +41,7 @@ typedef struct pad_softc {
 	kmutex_t	sc_lock;
 	kmutex_t	sc_intr_lock;
 
-	struct audio_softc *sc_audiodev;
+	device_t	sc_audiodev;
 	int		sc_blksize;
 
 #define PAD_BLKSIZE	8192



CVS commit: src/sys/dev/pad

2017-06-30 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Jul  1 05:50:10 UTC 2017

Modified Files:
src/sys/dev/pad: pad.c padvar.h

Log Message:
sc_audiodev should be defined as a device_t as this is what audio_attach_mi
returns.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pad/padvar.h

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



CVS commit: src/sys/dev

2017-06-30 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Jul  1 05:44:52 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
Broadcast all conditional variables if in being deactivated so no readers
or writers get stuck.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.366 src/sys/dev/audio.c:1.367
--- src/sys/dev/audio.c:1.366	Sun Jun 25 10:28:22 2017
+++ src/sys/dev/audio.c	Sat Jul  1 05:44:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.366 2017/06/25 10:28:22 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.367 2017/07/01 05:44:52 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.366 2017/06/25 10:28:22 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.367 2017/07/01 05:44:52 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -897,6 +897,10 @@ audioactivate(device_t self, enum devact
 		sc->sc_dying = true;
 		mutex_enter(sc->sc_intr_lock);
 		cv_broadcast(>sc_condvar);
+		cv_broadcast(>sc_rcondvar);
+		cv_broadcast(>sc_wchan);
+		cv_broadcast(>sc_rchan);
+		cv_broadcast(>sc_lchan);
 		mutex_exit(sc->sc_intr_lock);
 		mutex_exit(sc->sc_lock);
 		return 0;



CVS commit: src/sys/dev

2017-06-30 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Jul  1 05:44:52 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
Broadcast all conditional variables if in being deactivated so no readers
or writers get stuck.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 src/sys/dev/audio.c

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



CVS commit: src/sys/dev

2017-06-30 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Jul  1 05:32:24 UTC 2017

Modified Files:
src/sys/dev: audiobell.c

Log Message:
Don't keep writing data if an error has occurred.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/audiobell.c

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



CVS commit: src/sys/dev

2017-06-30 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Jul  1 05:32:24 UTC 2017

Modified Files:
src/sys/dev: audiobell.c

Log Message:
Don't keep writing data if an error has occurred.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/audiobell.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/audiobell.c
diff -u src/sys/dev/audiobell.c:1.24 src/sys/dev/audiobell.c:1.25
--- src/sys/dev/audiobell.c:1.24	Tue Jun 27 09:44:13 2017
+++ src/sys/dev/audiobell.c	Sat Jul  1 05:32:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiobell.c,v 1.24 2017/06/27 09:44:13 nat Exp $	*/
+/*	$NetBSD: audiobell.c,v 1.25 2017/07/01 05:32:24 nat Exp $	*/
 
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.24 2017/06/27 09:44:13 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.25 2017/07/01 05:32:24 nat Exp $");
 
 #include 
 #include 
@@ -170,7 +170,8 @@ audiobell(void *v, u_int pitch, u_int pe
 		auio.uio_rw = UIO_WRITE;
 		UIO_SETUP_SYSSPACE();
 
-		audiobellwrite(fp, NULL, , NULL, 0);
+		if (audiobellwrite(fp, NULL, , NULL, 0) != 0)
+			break;
 		len -= size;
 	}
 out:



CVS commit: src/bin/sh

2017-06-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jul  1 05:11:58 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Sort options (our default is 0..9AaBbZz).
Fix markup problems and a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.158 src/bin/sh/sh.1:1.159
--- src/bin/sh/sh.1:1.158	Fri Jun 30 23:48:50 2017
+++ src/bin/sh/sh.1	Sat Jul  1 05:11:57 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.158 2017/06/30 23:48:50 kre Exp $
+.\"	$NetBSD: sh.1,v 1.159 2017/07/01 05:11:57 wiz Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -34,7 +34,7 @@
 .Dd July 1, 2017
 .Dt SH 1
 .\" everything except c o and s (keep them ordered)
-.ds flags abCeEfFhiILmnpquvVx
+.ds flags abCEeFfhIiLmnpquVvx
 .Os
 .Sh NAME
 .Nm sh
@@ -199,7 +199,7 @@ was given, then the shell treats the fir
 as the name of a file from which to read commands (a shell script).
 This also becomes $0 and the remaining arguments are set as the
 positional parameters of the shell ($1, $2, etc).
-Otheriwse, if
+Otherwise, if
 .Fl c
 was given, then the first argument, which must exist,
 is taken to be a string of
@@ -267,6 +267,9 @@ while this flag is set.
 .It Fl b Em notify
 Enable asynchronous notification of background job completion.
 (Not implemented.)
+.It Fl C Em noclobber
+Don't overwrite existing files with
+.Dq > .
 .It Fl c
 Read commands from the
 .Ar command_string
@@ -280,9 +283,14 @@ is only available at invocation, it cann
 .Ic set ,
 and there is no form using
 .Dq \&+ .
-.It Fl C Em noclobber
-Don't overwrite existing files with
-.Dq > .
+.It Fl E Em emacs
+Enable the built-in emacs style
+command line editor (disables
+.Fl V
+if it has been set).
+(See the
+.Sx Command Line Editing
+section below.)
 .It Fl e Em errexit
 If not interactive, exit immediately if any untested command fails.
 If interactive, and an untested command fails,
@@ -308,16 +316,6 @@ With pipelines, only the status of the e
 is tested when
 .Fl e
 is set to determine if the shell should exit.
-.It Fl E Em emacs
-Enable the built-in emacs style
-command line editor (disables
-.Fl V
-if it has been set).
-(See the
-.Sx Command Line Editing
-section below.)
-.It Fl f Em noglob
-Disable pathname expansion.
 .It Fl F Em fork
 Cause the shell to always use
 .Xr fork 2
@@ -333,17 +331,19 @@ can be compiled to always use
 in which case altering the
 .Fl F
 flag has no effect.
+.It Fl f Em noglob
+Disable pathname expansion.
 .It Fl h Em trackall
 Functions defined while this option is set will have paths bound to
 commands to be executed by the function at the time of the definition.
 When off when a function is defined,
 the file system is searched for commands each time the function is invoked.
 (Not implemented.)
-.It Fl i Em interactive
-Force the shell to behave interactively.
 .It Fl I Em ignoreeof
 Ignore EOFs from input when interactive.
 (After a large number of consecutive EOFs the shell will exit anyway.)
+.It Fl i Em interactive
+Force the shell to behave interactively.
 .It Fl L Em local_lineno
 When set, before a function is defined,
 causes the variable
@@ -369,7 +369,9 @@ This is useful for checking the syntax o
 If
 .Fl n
 becomes set in an interactive shell, it will automatically be
-cleared just before the next time the command line prompt (PS1) is written.
+cleared just before the next time the command line prompt
+.Pq Ev PS1
+is written.
 .It Fl p Em nopriv
 Do not attempt to reset effective UID if it does not match UID.
 This is not set by default to help avoid incorrect usage by setuid
@@ -421,14 +423,6 @@ or
 operators test if the variable is set, before attempting to
 obtain its value, and hence are unaffected by
 .Fl u .
-.It Fl v Em verbose
-The shell writes its input to standard error as it is read.
-Useful for debugging.
-.It Fl x Em xtrace
-Write each command to standard error (preceded by the expanded value of
-.Dq $PS4 )
-before it is executed.
-Useful for debugging.
 .It Fl V Em vi
 Enable the built-in
 .Xr vi 1
@@ -438,6 +432,14 @@ if it has been set).
 (See the
 .Sx Command Line Editing
 section below.)
+.It Fl v Em verbose
+The shell writes its input to standard error as it is read.
+Useful for debugging.
+.It Fl x Em xtrace
+Write each command to standard error (preceded by the expanded value of
+.Dq $PS4 )
+before it is executed.
+Useful for debugging.
 .It "\ \ " Em cdprint
 Make an interactive shell always print the new directory name when
 changed by the
@@ -472,7 +474,7 @@ built-in command are passed on to utilit
 in posix mode),
 and whether the shell treats
 an empty brace-list compound statement as a syntax error
-(expected by posix) or permits it.
+(expected by POSIX) or permits it.
 Such statements
 .Dq "{ }"
 can be useful 

CVS commit: src/bin/sh

2017-06-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Jul  1 05:11:58 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Sort options (our default is 0..9AaBbZz).
Fix markup problems and a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:48:50 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Correct a markup typo (why did I not see this before the prev commit??)


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:48:50 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Correct a markup typo (why did I not see this before the prev commit??)


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.157 src/bin/sh/sh.1:1.158
--- src/bin/sh/sh.1:1.157	Fri Jun 30 23:07:29 2017
+++ src/bin/sh/sh.1	Fri Jun 30 23:48:50 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.157 2017/06/30 23:07:29 kre Exp $
+.\"	$NetBSD: sh.1,v 1.158 2017/06/30 23:48:50 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -218,7 +218,7 @@ usually be the name of the shell itself.
 If
 .Fl s
 was given, or if neither
-.Fc c
+.Fl c
 nor any additional (non-option) arguments were present,
 the shell reads commands from its standard input.
 .Ss Argument List Processing



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:07:29 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Omnibus manual update for prompt expansions and new variables.  Throw in
some random cleanups as a bonus.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.156 src/bin/sh/sh.1:1.157
--- src/bin/sh/sh.1:1.156	Wed Jun 28 13:46:06 2017
+++ src/bin/sh/sh.1	Fri Jun 30 23:07:29 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.156 2017/06/28 13:46:06 kre Exp $
+.\"	$NetBSD: sh.1,v 1.157 2017/06/30 23:07:29 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,9 +31,10 @@
 .\"
 .\"	@(#)sh.1	8.6 (Berkeley) 5/4/95
 .\"
-.Dd June 28, 2017
+.Dd July 1, 2017
 .Dt SH 1
-.ds flags abCEeFfhnuvxIimpqV
+.\" everything except c o and s (keep them ordered)
+.ds flags abCeEfFhiILmnpquvVx
 .Os
 .Sh NAME
 .Nm sh
@@ -54,6 +55,7 @@
 .Nm
 .Fl c
 .Bk -words
+.Op Fl s
 .Op Fl \*[flags]
 .Op Cm +\*[flags]
 .Ek
@@ -83,7 +85,7 @@
 is the standard command interpreter for the system.
 The current version of
 .Nm
-is in the process of being changed to conform with the
+is in the process of being changed to conform more closely to the
 .Tn POSIX
 1003.2 and 1003.2a specifications for the shell.
 This version has many
@@ -95,8 +97,8 @@ to be a tutorial or a complete specifica
 .Ss Overview
 The shell is a command that reads lines from either a file or the
 terminal, interprets them, and generally executes other commands.
-It is the program that is running when a user logs into the system
-(although a user can select a different shell with the
+A shell is the program that is running when a user logs into the system.
+(Users can select which shell is executed for them at login with the
 .Xr chsh 1
 command).
 The shell implements a language that has flow control
@@ -188,12 +190,37 @@ below (these commands are described late
 .Li esac
 .El
 .Pp
-If command line arguments besides the options have been specified, then
-the shell treats the first argument as the name of a file from which to
-read commands (a shell script), and the remaining arguments are set as the
+If command line arguments besides the options have been specified, and
+neither
+.Fl c
+nor
+.Fl s
+was given, then the shell treats the first argument
+as the name of a file from which to read commands (a shell script).
+This also becomes $0 and the remaining arguments are set as the
 positional parameters of the shell ($1, $2, etc).
-Otherwise, the shell
-reads commands from its standard input.
+Otheriwse, if
+.Fl c
+was given, then the first argument, which must exist,
+is taken to be a string of
+.Nm
+commands to execute.
+Then if any additional arguments follow the command string,
+those arguments become $0, $1, ...
+Otherwise, if additional arguments were given
+(which implies that
+.Fl s
+was set)
+those arguments become $1, $2, ...
+If $0 has not been set by the preceding processing, it
+will be set to argv[0] as passed to the shell, which will
+usually be the name of the shell itself.
+If
+.Fl s
+was given, or if neither
+.Fc c
+nor any additional (non-option) arguments were present,
+the shell reads commands from its standard input.
 .Ss Argument List Processing
 Currently, all of the single letter options that can meaningfully
 be set using the
@@ -206,6 +233,14 @@ The set
 .Fl o
 name is provided next to the single letter option in
 the description below.
+Some options have only a long name, they are described after
+the flag options, they are used with
+.Fl o
+or
+.Cm +o
+only, either on the command line, or with the
+.Ic set
+built-in command.
 Other options described are for the command line only.
 Specifying a dash
 .Dq -
@@ -218,26 +253,28 @@ unless otherwise stated, with the
 built-in (described later).
 .\"
 .\" strlen("quietprofile") == strlen("local_lineno"): pick the latter
-.\" to give the indent as the _ in that case, and the fi ligature in
-.\" the former combine to make local_lineno slightly wider when printed
+.\" to give the indent as the _ in local_lineno, and the fi ligature in
+.\" quietprofile combine to make "local_lineno' slightly wider when printed
 .\" (in italics) in a variable width font.   Probably should test the actual
 .\" widths and use the wider, but I am not sure if mandoc is up to that...
 .\" (and I don't know how to get at the font that will be used easily anyway!)
+.\" The X's just provide a little extra space.
 .Bl -tag -width \-WXXlocal_linenoXX -offset indent
 .\"
 .It Fl a Em allexport
-Export all variables assigned to.
+Automatically export any variable to which a value is assigned
+while this flag is set.
 .It Fl b Em notify
 Enable asynchronous notification of background job completion.
 (Not implemented.)
 .It Fl c
 

CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:07:29 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Omnibus manual update for prompt expansions and new variables.  Throw in
some random cleanups as a bonus.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:05:45 UTC 2017

Modified Files:
src/bin/sh: Makefile var.c var.h

Log Message:
Implement a bunch of new shell environment variables. many mostly useful
in prompts when expanded at prompt time, but all available for general use.
Many of the new ones are not available in SMALL shells (they work as normal
if assigned, but the shell does not set or use them - and there is no magic
in a SMALL shell (usually for install media.))


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/bin/sh/Makefile
cvs rdiff -u -r1.62 -r1.63 src/bin/sh/var.c
cvs rdiff -u -r1.34 -r1.35 src/bin/sh/var.h

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

Modified files:

Index: src/bin/sh/Makefile
diff -u src/bin/sh/Makefile:1.112 src/bin/sh/Makefile:1.113
--- src/bin/sh/Makefile:1.112	Thu Jun  8 02:25:43 2017
+++ src/bin/sh/Makefile	Fri Jun 30 23:05:45 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.112 2017/06/08 02:25:43 kre Exp $
+#	$NetBSD: Makefile,v 1.113 2017/06/30 23:05:45 kre Exp $
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 
 .include 
@@ -24,6 +24,7 @@ SCRIPT_ENV= \
 	SED=${TOOL_SED:Q}
 
 CPPFLAGS+=-DSHELL -I. -I${.CURDIR}
+CPPFLAGS+= -DUSE_LRAND48
 #XXX: For testing only.
 #CPPFLAGS+=-DDEBUG=3
 #COPTS+=-g
@@ -90,6 +91,7 @@ SUBDIR+=USD.doc
 
 COPTS.printf.c = -Wno-format-nonliteral
 COPTS.jobs.c = -Wno-format-nonliteral
+COPTS.var.c = -Wno-format-nonliteral
 
 .include 
 .include 

Index: src/bin/sh/var.c
diff -u src/bin/sh/var.c:1.62 src/bin/sh/var.c:1.63
--- src/bin/sh/var.c:1.62	Wed Jun 28 13:46:06 2017
+++ src/bin/sh/var.c	Fri Jun 30 23:05:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.62 2017/06/28 13:46:06 kre Exp $	*/
+/*	$NetBSD: var.c,v 1.63 2017/06/30 23:05:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: var.c,v 1.62 2017/06/28 13:46:06 kre Exp $");
+__RCSID("$NetBSD: var.c,v 1.63 2017/06/30 23:05:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -47,6 +47,9 @@ __RCSID("$NetBSD: var.c,v 1.62 2017/06/2
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 /*
  * Shell variables.
@@ -68,6 +71,7 @@ __RCSID("$NetBSD: var.c,v 1.62 2017/06/2
 #include "mystring.h"
 #include "parser.h"
 #include "show.h"
+#include "machdep.h"
 #ifndef SMALL
 #include "myhistedit.h"
 #endif
@@ -90,6 +94,14 @@ struct varinit {
 
 char *get_lineno(struct var *);
 
+#ifndef SMALL
+char *get_tod(struct var *);
+char *get_hostname(struct var *);
+char *get_seconds(struct var *);
+char *get_euser(struct var *);
+char *get_random(struct var *);
+#endif
+
 struct localvar *localvars;
 
 #ifndef SMALL
@@ -108,6 +120,15 @@ struct var vps4;
 struct var vvers;
 struct var voptind;
 struct var line_num;
+#ifndef SMALL
+struct var tod;
+struct var host_name;
+struct var seconds;
+struct var euname;
+struct var random_num;
+
+intmax_t sh_start_time;
+#endif
 
 struct var line_num;
 int line_number;
@@ -150,6 +171,18 @@ const struct varinit varinit[] = {
 	   { .set_func= getoptsreset } },
 	{ _num,	VSTRFIXED|VTEXTFIXED|VFUNCREF,	"LINENO=1",
 	   { .ref_func= get_lineno } },
+#ifndef SMALL
+	{ ,		VSTRFIXED|VTEXTFIXED|VFUNCREF,	"ToD=",
+	   { .ref_func= get_tod } },
+	{ _name,	VSTRFIXED|VTEXTFIXED|VFUNCREF,	"HOSTNAME=",
+	   { .ref_func= get_hostname } },
+	{ ,	VSTRFIXED|VTEXTFIXED|VFUNCREF,	"SECONDS=",
+	   { .ref_func= get_seconds } },
+	{ ,	VSTRFIXED|VTEXTFIXED|VFUNCREF,	"EUSER=",
+	   { .ref_func= get_euser } },
+	{ _num,	VSTRFIXED|VTEXTFIXED|VFUNCREF,	"RANDOM=",
+	   { .ref_func= get_random } },
+#endif
 	{ NULL,	0,NULL,
 	   { NULL } }
 };
@@ -166,6 +199,7 @@ STATIC struct var *find_var(const char *
 #ifdef mkinit
 INCLUDE 
 INCLUDE 
+INCLUDE 
 INCLUDE "var.h"
 INCLUDE "version.h"
 MKINIT char **environ;
@@ -173,7 +207,18 @@ INIT {
 	char **envp;
 	char buf[64];
 
+#ifndef SMALL
+	sh_start_time = (intmax_t)time((time_t *)0);
+#endif
+	/*
+	 * Set up our default variables and their values.
+	 */
 	initvar();
+
+	/*
+	 * Import variables from the environment, which will
+	 * override anything initialised just previously.
+	 */
 	for (envp = environ ; *envp ; envp++) {
 		if (strchr(*envp, '=')) {
 			setvareq(*envp, VEXPORT|VTEXTFIXED);
@@ -185,12 +230,20 @@ INIT {
 	 *
 	 * PPID is readonly
 	 * Always default IFS
+	 * PSc indicates the root/non-root status of this shell.
 	 * NETBSD_SHELL is a constant (readonly), and is never exported
+	 * START_TIME belongs only to this shell.
 	 * LINENO is simply magic...
 	 */
 	snprintf(buf, sizeof(buf), "%d", (int)getppid());
 	setvar("PPID", buf, VREADONLY);
 	setvar("IFS", ifs_default, VTEXTFIXED);
+	setvar("PSc", (geteuid() == 0 ? "#" : "$"), VTEXTFIXED);
+
+#ifndef SMALL
+	snprintf(buf, sizeof(buf), "%jd", sh_start_time);
+	setvar("START_TIME", buf, VTEXTFIXED);
+#endif
 
 	setvar("NETBSD_SHELL", NETBSD_SHELL
 #ifdef 

CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:05:45 UTC 2017

Modified Files:
src/bin/sh: Makefile var.c var.h

Log Message:
Implement a bunch of new shell environment variables. many mostly useful
in prompts when expanded at prompt time, but all available for general use.
Many of the new ones are not available in SMALL shells (they work as normal
if assigned, but the shell does not set or use them - and there is no magic
in a SMALL shell (usually for install media.))


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/bin/sh/Makefile
cvs rdiff -u -r1.62 -r1.63 src/bin/sh/var.c
cvs rdiff -u -r1.34 -r1.35 src/bin/sh/var.h

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



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:02:56 UTC 2017

Modified Files:
src/bin/sh: expand.c input.c input.h option.list parser.c parser.h

Log Message:
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic
expansions, and if enabled by the promptcmds option, command substitutions.)


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/bin/sh/expand.c
cvs rdiff -u -r1.58 -r1.59 src/bin/sh/input.c
cvs rdiff -u -r1.19 -r1.20 src/bin/sh/input.h
cvs rdiff -u -r1.4 -r1.5 src/bin/sh/option.list
cvs rdiff -u -r1.139 -r1.140 src/bin/sh/parser.c
cvs rdiff -u -r1.22 -r1.23 src/bin/sh/parser.h

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

Modified files:

Index: src/bin/sh/expand.c
diff -u src/bin/sh/expand.c:1.118 src/bin/sh/expand.c:1.119
--- src/bin/sh/expand.c:1.118	Mon Jun 19 02:46:50 2017
+++ src/bin/sh/expand.c	Fri Jun 30 23:02:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.118 2017/06/19 02:46:50 kre Exp $	*/
+/*	$NetBSD: expand.c,v 1.119 2017/06/30 23:02:56 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.118 2017/06/19 02:46:50 kre Exp $");
+__RCSID("$NetBSD: expand.c,v 1.119 2017/06/30 23:02:56 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -177,7 +177,7 @@ expandarg(union node *arg, struct arglis
 	line_number = arg->narg.lineno;
 	argstr(arg->narg.text, flag);
 	if (arglist == NULL) {
-		NULLTERM_4_TRACE(expdest);
+		STACKSTRNUL(expdest);
 		CTRACE(DBG_EXPAND, ("expandarg: no arglist, done (%d) \"%s\"\n",
 		expdest - stackblock(), stackblock()));
 		return;			/* here document expanded */
@@ -597,8 +597,10 @@ expbackq(union node *cmd, int quoted, in
 		if (--in.nleft < 0) {
 			if (in.fd < 0)
 break;
+			INTON;
 			while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR)
 continue;
+			INTOFF;
 			VTRACE(DBG_EXPAND, ("expbackq: read returns %d\n", i));
 			if (i <= 0)
 break;

Index: src/bin/sh/input.c
diff -u src/bin/sh/input.c:1.58 src/bin/sh/input.c:1.59
--- src/bin/sh/input.c:1.58	Wed Jun  7 05:08:32 2017
+++ src/bin/sh/input.c	Fri Jun 30 23:02:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: input.c,v 1.58 2017/06/07 05:08:32 kre Exp $	*/
+/*	$NetBSD: input.c,v 1.59 2017/06/30 23:02:56 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)input.c	8.3 (Berkeley) 6/9/95";
 #else
-__RCSID("$NetBSD: input.c,v 1.58 2017/06/07 05:08:32 kre Exp $");
+__RCSID("$NetBSD: input.c,v 1.59 2017/06/30 23:02:56 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -471,6 +471,7 @@ setinputfd(int fd, int push)
 		parsefile->buf = ckmalloc(BUFSIZ);
 	parselleft = parsenleft = 0;
 	plinno = 1;
+	CTRACE(DBG_INPUT, ("setinputfd(%d, %d); plinno=1\n", fd, push));
 }
 
 
@@ -489,7 +490,7 @@ setinputstring(char *string, int push, i
 	parselleft = parsenleft = strlen(string);
 	parsefile->buf = NULL;
 	plinno = line1;
-	TRACE(("setinputstring(\"%.20s%s\" (%d), %d, %d)\n", string,
+	CTRACE(DBG_INPUT, ("setinputstring(\"%.20s%s\" (%d), %d, %d)\n", string,
 	(parsenleft > 20 ? "..." : ""), parsenleft, push, line1));
 	INTON;
 }
@@ -506,6 +507,10 @@ pushfile(void)
 {
 	struct parsefile *pf;
 
+	VTRACE(DBG_INPUT, ("pushfile(): fd=%d nl=%d ll=%d \"%.*s\" plinno=%d\n",
+	parsefile->fd, parsenleft, parselleft,
+	parsenleft, parsenextc, plinno));
+
 	parsefile->nleft = parsenleft;
 	parsefile->lleft = parselleft;
 	parsefile->nextc = parsenextc;
@@ -536,10 +541,40 @@ popfile(void)
 	parsenleft = parsefile->nleft;
 	parselleft = parsefile->lleft;
 	parsenextc = parsefile->nextc;
+	VTRACE(DBG_INPUT,
+	("popfile(): fd=%d nl=%d ll=%d \"%.*s\" plinno:%d->%d\n",
+	parsefile->fd, parsenleft, parselleft,
+	parsenleft, parsenextc, plinno, parsefile->linno));
 	plinno = parsefile->linno;
 	INTON;
 }
 
+/*
+ * Return current file (to go back to it later using popfilesupto()).
+ */
+
+struct parsefile *
+getcurrentfile(void)
+{
+	return parsefile;
+}
+
+
+/*
+ * Pop files until the given file is on top again. Useful for regular
+ * builtins that read shell commands from files or strings.
+ * If the given file is not an active file, an error is raised.
+ */
+
+void
+popfilesupto(struct parsefile *file)
+{
+	while (parsefile != file && parsefile != )
+		popfile();
+	if (parsefile != file)
+		error("popfilesupto() misused");
+}
+
 
 /*
  * Return to top level.

Index: src/bin/sh/input.h
diff -u src/bin/sh/input.h:1.19 src/bin/sh/input.h:1.20
--- src/bin/sh/input.h:1.19	Wed Jun  7 04:44:17 2017
+++ src/bin/sh/input.h	Fri Jun 30 23:02:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: input.h,v 1.19 2017/06/07 04:44:17 kre Exp $	*/
+/*	$NetBSD: input.h,v 1.20 2017/06/30 23:02:56 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -45,8 +45,10 @@ extern int plinno;
 extern int parsenleft;		/* number of characters left in 

CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:02:56 UTC 2017

Modified Files:
src/bin/sh: expand.c input.c input.h option.list parser.c parser.h

Log Message:
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic
expansions, and if enabled by the promptcmds option, command substitutions.)


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/bin/sh/expand.c
cvs rdiff -u -r1.58 -r1.59 src/bin/sh/input.c
cvs rdiff -u -r1.19 -r1.20 src/bin/sh/input.h
cvs rdiff -u -r1.4 -r1.5 src/bin/sh/option.list
cvs rdiff -u -r1.139 -r1.140 src/bin/sh/parser.c
cvs rdiff -u -r1.22 -r1.23 src/bin/sh/parser.h

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



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:01:21 UTC 2017

Modified Files:
src/bin/sh: eval.c redir.c redir.h

Log Message:
Include redirections in trace output from "set -x"


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/bin/sh/eval.c
cvs rdiff -u -r1.57 -r1.58 src/bin/sh/redir.c
cvs rdiff -u -r1.23 -r1.24 src/bin/sh/redir.h

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

Modified files:

Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.150 src/bin/sh/eval.c:1.151
--- src/bin/sh/eval.c:1.150	Mon Jun 19 03:21:31 2017
+++ src/bin/sh/eval.c	Fri Jun 30 23:01:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.150 2017/06/19 03:21:31 kre Exp $	*/
+/*	$NetBSD: eval.c,v 1.151 2017/06/30 23:01:21 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.150 2017/06/19 03:21:31 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.151 2017/06/30 23:01:21 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -276,9 +276,24 @@ evaltree(union node *n, int flags)
 		break;
 	case NREDIR:
 		expredir(n->nredir.redirect);
+		if (xflag && n->nredir.redirect) {
+			union node *rn;
+
+			out2str(expandstr(ps4val(), line_number));
+			out2str("using redirections:");
+			for (rn = n->nredir.redirect; rn; rn = rn->nfile.next)
+(void) outredir(, rn, ' ');
+			out2str(" do\n");
+			flushout();
+		}
 		redirect(n->nredir.redirect, REDIR_PUSH | REDIR_KEEP);
 		evaltree(n->nredir.n, flags);
 		popredir();
+		if (xflag && n->nredir.redirect) {
+			out2str(expandstr(ps4val(), line_number));
+			out2str("done\n");
+			flushout();
+		}
 		break;
 	case NSUBSHELL:
 		evalsubshell(n, flags & ~EV_MORE);
@@ -422,7 +437,7 @@ evalfor(union node *n, int flags)
 			f |= EV_MORE;
 
 		if (xflag) {
-			out2str(ps4val());
+			out2str(expandstr(ps4val(), line_number));
 			out2str("for ");
 			out2str(n->nfor.var);
 			out2c('=');
@@ -505,6 +520,16 @@ evalsubshell(union node *n, int flags)
 	int backgnd = (n->type == NBACKGND);
 
 	expredir(n->nredir.redirect);
+	if (xflag && n->nredir.redirect) {
+		union node *rn;
+
+		out2str(expandstr(ps4val(), line_number));
+		out2str("using redirections:");
+		for (rn = n->nredir.redirect; rn; rn = rn->nfile.next)
+			(void) outredir(, rn, ' ');
+		out2str(" do subshell\n");
+		flushout();
+	}
 	INTOFF;
 	jp = makejob(n, 1);
 	if (forkshell(jp, n, backgnd ? FORK_BG : FORK_FG) == 0) {
@@ -517,6 +542,11 @@ evalsubshell(union node *n, int flags)
 	}
 	exitstatus = backgnd ? 0 : waitforjob(jp);
 	INTON;
+	if (!backgnd && xflag && n->nredir.redirect) {
+		out2str(expandstr(ps4val(), line_number));
+		out2str("done subshell\n");
+		flushout();
+	}
 }
 
 
@@ -771,8 +801,7 @@ evalcommand(union node *cmd, int flgs, s
 	setstackmark();
 	back_exitstatus = 0;
 
-	if (cmd != NULL)
-		line_number = cmd->ncmd.lineno;
+	line_number = cmd->ncmd.lineno;
 
 	arglist.lastp = 
 	varflag = 1;
@@ -830,7 +859,9 @@ evalcommand(union node *cmd, int flgs, s
 	/* Print the command if xflag is set. */
 	if (xflag) {
 		char sep = 0;
-		out2str(ps4val());
+		union node *rn;
+
+		out2str(expandstr(ps4val(), line_number));
 		for (sp = varlist.list ; sp ; sp = sp->next) {
 			char *p;
 
@@ -859,6 +890,9 @@ evalcommand(union node *cmd, int flgs, s
 			out2shstr(sp->text);
 			sep = ' ';
 		}
+		for (rn = cmd->ncmd.redirect; rn; rn = rn->nfile.next)
+			if (outredir(, rn, sep))
+sep = ' ';
 		outc('\n', );
 		flushout();
 	}

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.57 src/bin/sh/redir.c:1.58
--- src/bin/sh/redir.c:1.57	Mon May 29 22:21:00 2017
+++ src/bin/sh/redir.c	Fri Jun 30 23:01:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.57 2017/05/29 22:21:00 kre Exp $	*/
+/*	$NetBSD: redir.c,v 1.58 2017/06/30 23:01:21 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.57 2017/05/29 22:21:00 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.58 2017/06/30 23:01:21 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -878,3 +878,70 @@ fdflagscmd(int argc, char *argv[])
 	}
 	return 0;
 }
+
+#undef MAX		/* in case we inherited them from somewhere */
+#undef MIN
+
+#define	MIN(a,b)	(/*CONSTCOND*/((a)<=(b)) ? (a) : (b))
+#define	MAX(a,b)	(/*CONSTCOND*/((a)>=(b)) ? (a) : (b))
+
+		/* now make the compiler work for us... */
+#define	MIN_REDIR	MIN(MIN(MIN(MIN(NTO,NFROM), MIN(NTOFD,NFROMFD)), \
+		   MIN(MIN(NCLOBBER,NAPPEND), MIN(NHERE,NXHERE))), NFROMTO)
+#define	MAX_REDIR	MAX(MAX(MAX(MAX(NTO,NFROM), MAX(NTOFD,NFROMFD)), \
+		   MAX(MAX(NCLOBBER,NAPPEND), MAX(NHERE,NXHERE))), NFROMTO)
+
+static const char *redir_sym[MAX_REDIR - MIN_REDIR + 1] = {
+	[NTO  - MIN_REDIR]=	">",
+	[NFROM- MIN_REDIR]=	"<",
+	[NTOFD- MIN_REDIR]=	">&",
+	[NFROMFD  - MIN_REDIR]=	"<&",
+	[NCLOBBER - MIN_REDIR]=	">|",
+	

CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:01:21 UTC 2017

Modified Files:
src/bin/sh: eval.c redir.c redir.h

Log Message:
Include redirections in trace output from "set -x"


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/bin/sh/eval.c
cvs rdiff -u -r1.57 -r1.58 src/bin/sh/redir.c
cvs rdiff -u -r1.23 -r1.24 src/bin/sh/redir.h

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



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:00:40 UTC 2017

Modified Files:
src/bin/sh: show.c show.h

Log Message:
NFC: DEBUG only change - provide an externally visible (to the DEBUG sh
internals) interface to one of the internal (private to trace code) functions


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/bin/sh/show.c
cvs rdiff -u -r1.10 -r1.11 src/bin/sh/show.h

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



CVS commit: src/bin/sh

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 23:00:40 UTC 2017

Modified Files:
src/bin/sh: show.c show.h

Log Message:
NFC: DEBUG only change - provide an externally visible (to the DEBUG sh
internals) interface to one of the internal (private to trace code) functions


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/bin/sh/show.c
cvs rdiff -u -r1.10 -r1.11 src/bin/sh/show.h

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

Modified files:

Index: src/bin/sh/show.c
diff -u src/bin/sh/show.c:1.46 src/bin/sh/show.c:1.47
--- src/bin/sh/show.c:1.46	Sat Jun 17 12:16:16 2017
+++ src/bin/sh/show.c	Fri Jun 30 23:00:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: show.c,v 1.46 2017/06/17 12:16:16 kre Exp $	*/
+/*	$NetBSD: show.c,v 1.47 2017/06/30 23:00:40 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)show.c	8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: show.c,v 1.46 2017/06/17 12:16:16 kre Exp $");
+__RCSID("$NetBSD: show.c,v 1.47 2017/06/30 23:00:40 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -302,6 +302,12 @@ trargs(char **ap)
 	trace_putc('\n', tracetfile);
 }
 
+void
+trargstr(union node *n)
+{
+	sharg(n, tracetfile);
+}
+
 
 /*
  * Beyond here we just have the implementation of all of that

Index: src/bin/sh/show.h
diff -u src/bin/sh/show.h:1.10 src/bin/sh/show.h:1.11
--- src/bin/sh/show.h:1.10	Sat May 13 03:26:03 2017
+++ src/bin/sh/show.h	Fri Jun 30 23:00:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: show.h,v 1.10 2017/05/13 03:26:03 kre Exp $	*/
+/*	$NetBSD: show.h,v 1.11 2017/06/30 23:00:40 kre Exp $	*/
 
 /*-
  * Copyright (c) 1995
@@ -39,6 +39,7 @@ void showtree(union node *);
 void trace(const char *, ...);
 void tracev(const char *, va_list);
 void trargs(char **);
+void trargstr(union node *);
 void trputc(int);
 void trputs(const char *);
 void opentrace(void);



CVS commit: src/lib/libexecinfo

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 21:39:43 UTC 2017

Modified Files:
src/lib/libexecinfo: execinfo.h

Log Message:
make this standalone.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libexecinfo/execinfo.h

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

Modified files:

Index: src/lib/libexecinfo/execinfo.h
diff -u src/lib/libexecinfo/execinfo.h:1.2 src/lib/libexecinfo/execinfo.h:1.3
--- src/lib/libexecinfo/execinfo.h:1.2	Sat Jun  9 17:22:17 2012
+++ src/lib/libexecinfo/execinfo.h	Fri Jun 30 17:39:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: execinfo.h,v 1.2 2012/06/09 21:22:17 christos Exp $	*/
+/*	$NetBSD: execinfo.h,v 1.3 2017/06/30 21:39:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,14 @@
 #ifndef _EXECINFO_H_
 #define _EXECINFO_H_
 
-#include 
+#include 
+#include 
+#include 
+  
+#ifdef  _BSD_SIZE_T_
+typedef _BSD_SIZE_T_size_t;
+#undef  _BSD_SIZE_T_
+#endif
 
 __BEGIN_DECLS
 size_t backtrace(void **, size_t);



CVS commit: src/lib/libexecinfo

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 21:39:43 UTC 2017

Modified Files:
src/lib/libexecinfo: execinfo.h

Log Message:
make this standalone.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libexecinfo/execinfo.h

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



CVS commit: src/lib/libedit

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 20:26:52 UTC 2017

Modified Files:
src/lib/libedit: Makefile literal.c literal.h refresh.c

Log Message:
Allow wide characters (properly encoded as byte strings according to LC_CTYPE)
to be (perhaps part of) the "invisible" characters in a prompt, or the
required prompt character which follows the literal sequence (this character
must be one with a printing column width >= 1).  The literal indicator
character (which is just a marker, and not printed anywhere) (the PSlit
parameter in sh(1)) can also be a wide char (passed to libedit as a wchar_t,
encoded as that by sh(1) or other applications that support this.)

Note: this has currently only been tested with everything ascii (C locale).


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/lib/libedit/Makefile
cvs rdiff -u -r1.2 -r1.3 src/lib/libedit/literal.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libedit/literal.h
cvs rdiff -u -r1.53 -r1.54 src/lib/libedit/refresh.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/libedit/Makefile
diff -u src/lib/libedit/Makefile:1.64 src/lib/libedit/Makefile:1.65
--- src/lib/libedit/Makefile:1.64	Tue Jun 27 23:25:13 2017
+++ src/lib/libedit/Makefile	Fri Jun 30 20:26:52 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.64 2017/06/27 23:25:13 christos Exp $
+#	$NetBSD: Makefile,v 1.65 2017/06/30 20:26:52 kre Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=	yes
@@ -133,6 +133,7 @@ tc1:	libedit.a tc1.o
 # XXX
 .if defined(HAVE_GCC)
 COPTS.editline.c+=	-Wno-cast-qual
+COPTS.literal.c+=	-Wno-sign-conversion
 COPTS.tokenizer.c+=	-Wno-cast-qual
 COPTS.tokenizern.c+=	-Wno-cast-qual
 .endif

Index: src/lib/libedit/literal.c
diff -u src/lib/libedit/literal.c:1.2 src/lib/libedit/literal.c:1.3
--- src/lib/libedit/literal.c:1.2	Thu Jun 29 02:54:40 2017
+++ src/lib/libedit/literal.c	Fri Jun 30 20:26:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: literal.c,v 1.2 2017/06/29 02:54:40 kre Exp $	*/
+/*	$NetBSD: literal.c,v 1.3 2017/06/30 20:26:52 kre Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: literal.c,v 1.2 2017/06/29 02:54:40 kre Exp $");
+__RCSID("$NetBSD: literal.c,v 1.3 2017/06/30 20:26:52 kre Exp $");
 #endif /* not lint && not SCCSID */
 
 /*
@@ -47,15 +47,14 @@ libedit_private void
 literal_init(EditLine *el)
 {
 	el_literal_t *l = >el_literal;
+
 	memset(l, 0, sizeof(*l));
 }
 
 libedit_private void
 literal_end(EditLine *el)
 {
-	el_literal_t *l = >el_literal;
 	literal_clear(el);
-	el_free(l->l_buf);
 }
 
 libedit_private void
@@ -63,33 +62,60 @@ literal_clear(EditLine *el)
 {
 	el_literal_t *l = >el_literal;
 	size_t i;
+
+	if (l->l_len == 0)
+		return;
+
 	for (i = 0; i < l->l_idx; i++)
 		el_free(l->l_buf[i]);
+	el_free(l->l_buf);
+	l->l_buf = NULL;
 	l->l_len = 0;
 	l->l_idx = 0;
 }
 
 libedit_private wint_t
-literal_add(EditLine *el, const wchar_t *buf, const wchar_t *end)
+literal_add(EditLine *el, const wchar_t *buf, const wchar_t *end, int *wp)
 {
-	// XXX: Only for narrow chars now.
 	el_literal_t *l = >el_literal;
 	size_t i, len;
+	ssize_t w, n;
 	char *b;
 
+	w = wcwidth(end[1]);	/* column width of the visible char */
+	*wp = (int)w;
+
+	if (w <= 0)		/* we require something to be printed */
+		return 0;
+
 	len = (size_t)(end - buf);
-	b = el_malloc(len + 2);
+	for (w = 0, i = 0; i < len; i++)
+		w += ct_enc_width(buf[i]);
+	w += ct_enc_width(end[1]);
+
+	b = el_malloc((size_t)(w + 1));
 	if (b == NULL)
 		return 0;
-	for (i = 0; i < len; i++)
-		b[i] = (char)buf[i];
-	b[len] = (char)end[1];
-	b[len + 1] = '\0';
+
+	for (n = 0, i = 0; i < len; i++)
+		n += ct_encode_char(b + n, w - n, buf[i]);
+	n += ct_encode_char(b + n, w - n, end[1]);
+	b[n] = '\0';
+
+	/*
+	 * Then save this literal string in the list of such strings,
+	 * and return a "magic character" to put into the terminal buffer.
+	 * When that magic char is 'printed' the saved string (which includes
+	 * the char that belongs in that position) gets sent instead.
+	 */
 	if (l->l_idx == l->l_len) {
-		l->l_len += 10;
-		char **bp = el_realloc(l->l_buf, sizeof(*l->l_buf) * l->l_len);
+		char **bp;
+
+		l->l_len += 4;
+		bp = el_realloc(l->l_buf, sizeof(*l->l_buf) * l->l_len);
 		if (bp == NULL) {
 			free(b);
+			l->l_len -= 4;
 			return 0;
 		}
 		l->l_buf = bp;
@@ -102,6 +128,7 @@ libedit_private const char *
 literal_get(EditLine *el, wint_t idx)
 {
 	el_literal_t *l = >el_literal;
+
 	assert(idx & EL_LITERAL);
 	idx &= ~EL_LITERAL;
 	assert(l->l_idx > (size_t)idx);

Index: src/lib/libedit/literal.h
diff -u src/lib/libedit/literal.h:1.1 src/lib/libedit/literal.h:1.2
--- src/lib/libedit/literal.h:1.1	Tue Jun 27 23:25:13 2017
+++ src/lib/libedit/literal.h	Fri Jun 30 20:26:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: literal.h,v 1.1 2017/06/27 23:25:13 christos Exp $	

CVS commit: src/lib/libedit

2017-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Jun 30 20:26:52 UTC 2017

Modified Files:
src/lib/libedit: Makefile literal.c literal.h refresh.c

Log Message:
Allow wide characters (properly encoded as byte strings according to LC_CTYPE)
to be (perhaps part of) the "invisible" characters in a prompt, or the
required prompt character which follows the literal sequence (this character
must be one with a printing column width >= 1).  The literal indicator
character (which is just a marker, and not printed anywhere) (the PSlit
parameter in sh(1)) can also be a wide char (passed to libedit as a wchar_t,
encoded as that by sh(1) or other applications that support this.)

Note: this has currently only been tested with everything ascii (C locale).


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/lib/libedit/Makefile
cvs rdiff -u -r1.2 -r1.3 src/lib/libedit/literal.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libedit/literal.h
cvs rdiff -u -r1.53 -r1.54 src/lib/libedit/refresh.c

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



CVS commit: src/sys/net

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 18:28:31 UTC 2017

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

Log Message:
Avoid DIAGNOSTIC warning with previous fix and simplify it (don't require
memory alloc/free).


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/net/rtsock.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.225 src/sys/net/rtsock.c:1.226
--- src/sys/net/rtsock.c:1.225	Fri Jun 30 05:11:22 2017
+++ src/sys/net/rtsock.c	Fri Jun 30 14:28:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.225 2017/06/30 09:11:22 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.226 2017/06/30 18:28:31 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.225 2017/06/30 09:11:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.226 2017/06/30 18:28:31 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -721,6 +721,24 @@ out:
 	return error;
 }
 
+static socklen_t
+sa_addrlen(const struct sockaddr *sa)
+{
+
+	switch (sa->sa_family) {
+#ifdef INET
+	case AF_INET:
+		return sizeof(struct sockaddr_in);
+#endif
+#ifdef INET6
+	case AF_INET6:
+		return sizeof(struct sockaddr_in6);
+#endif
+	default:
+		return 0;
+	}
+}
+
 /*ARGSUSED*/
 int
 COMPATNAME(route_output)(struct mbuf *m, struct socket *so)
@@ -736,7 +754,7 @@ COMPATNAME(route_output)(struct mbuf *m,
 	struct sockaddr_dl sdl;
 	int bound = curlwp_bind();
 	bool do_rt_free = false;
-	struct sockaddr *netmask = NULL;
+	struct sockaddr_storage netmask;
 
 #define senderr(e) do { error = e; goto flush;} while (/*CONSTCOND*/ 0)
 	if (m == NULL || ((m->m_len < sizeof(int32_t)) &&
@@ -796,36 +814,18 @@ COMPATNAME(route_output)(struct mbuf *m,
 
 	/*
 	 * route(8) passes a sockaddr truncated with prefixlen.
-	 * The kernel doesn't expect such sockaddr and need to restore
-	 * the original length of the sockaddr.
+	 * The kernel doesn't expect such sockaddr and need to 
+	 * use a buffer that is big enough for the sockaddr expected
+	 * (padded with 0's). We keep the original length of the sockaddr.
 	 */
 	if (info.rti_info[RTAX_NETMASK]) {
-		size_t sa_len = 0;
-		int af = info.rti_info[RTAX_NETMASK]->sa_family;
-
-		switch (af) {
-#ifdef INET
-		case AF_INET:
-			sa_len = sizeof(struct sockaddr_in);
-			break;
-#endif
-#ifdef INET6
-		case AF_INET6:
-			sa_len = sizeof(struct sockaddr_in6);
-			break;
-#endif
-		default:
-			break;
-		}
-		if (sa_len != 0 &&
-		sa_len > info.rti_info[RTAX_NETMASK]->sa_len) {
-			netmask = sockaddr_alloc(af, sa_len, M_WAITOK|M_ZERO);
-			sockaddr_copy(netmask,
-			info.rti_info[RTAX_NETMASK]->sa_len,
-			info.rti_info[RTAX_NETMASK]);
-			/* Restore original sa_len */
-			netmask->sa_len = info.rti_info[RTAX_NETMASK]->sa_len;
-			info.rti_info[RTAX_NETMASK] = netmask;
+		socklen_t sa_len = sa_addrlen(info.rti_info[RTAX_NETMASK]);
+		socklen_t masklen = info.rti_info[RTAX_NETMASK]->sa_len;
+		if (sa_len != 0 && sa_len > masklen) {
+			KASSERT(sa_len <= sizeof(netmask));
+			memcpy(, info.rti_info[RTAX_NETMASK], masklen);
+			memset((char *) + masklen, 0, sa_len - masklen);
+			info.rti_info[RTAX_NETMASK] = sstocsa();
 		}
 	}
 
@@ -1067,8 +1067,6 @@ flush:
 }
 out:
 	curlwp_bindx(bound);
-	if (netmask)
-		sockaddr_free(netmask);
 	return error;
 }
 



CVS commit: src/doc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:55:56 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
remove merge conflict part.


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

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



CVS commit: src/doc

2017-06-30 Thread Christos Zoulas
P_SCE and TRAP_SCX
-		[kamil 20170228]
-	zoneinfo: Import tzdata2017a.  [kre 20170301]
-	vioscsi(4): Allocate bus dma maps on attach, improves stability
-		and performance, adresses kern/52043 [jdolecek 20170307]
-	luna68k: Add a driver for LUNA's front panel LCD.  Ported from
-		OpenBSD/luna88k. [tsutsui 20170309]
-	sqlite3: Import 3.17.0. [christos 20170311]
-	libc: Update to tzcode2017a. [christos 20170311]
-	mdocml: Import 1.14.1. [christos 20170318]
-	sh(1): Arithmetic parser imported from dash (via FreeBSD)
-		adding support for all required operators, as well
-		as being smaller and faster.  [kre 20170320]
-	zoneinfo: Import tzdata2017b.  [kre 20170321]
-	virtio(4): Refactor child driver attach code for better modularization
-		[jdolecek 20170325]
-	vioscsi(4): Use MSI/MSI-X, reduce disk probe time [jdolecek 20170325]
-	dhcpcd(8): Import dhcpcd-7.0.0-beta2 [roy 20170402]
-	ptrace(2): Add operations to single step specified threads:
-		PT_SETSTEP and PT_CLEARSTEP [kamil 20170408]
-	route(4): Add RO_MSGFILTER [roy 20170411]
-	dc(1): Import from OpenBSD (replaced GPL version) [christos 20170410]
-	bind: Import version 9.10.4-P8. [christos 20170413]
-	ntp: Import ntp 4.2.8p10. [christos 20170413]
-	dhcpcd: Import dhcpcd 7.0.0-beta3 [roy 20170414]
-	OpenSSH: Imported 7.5. [christos 20170418]
-	tmux(1): Import of tmux 2.4 [christos 20170423]
-	libc: Update to tzcode2017b. [christos 20170425]
-	lua: Updated to Lua 5.3.4. [mbalmer 20170426]
-	acpi(4): Updated ACPICA to 20170303. [christos 20170430]
-	openpam(3): update to 20170430 (resedacea) [christos 20170506]
-	dhcpcd: Import dhcpcd 7.0.0-rc1 [roy 20170510]
-	vioscsi(4): Stability fixes [jdolecek 20170515]
-	localcount(9): Add localcount ref-count primitives [pgoyette 20170519]
-	openssl: Remove MKCRYPTO_RC5 option now that the patents have expired.
-		[riastradh 20170521]
-	src: Remove MKCRYPTO option and always include cryptography.
-		[riastradh 20170521]
-	file(1): Upgraded to 5.31. [christos 20170524]
-	can(4): Added a socketcan implementation, a socket layer for
-		CAN busses. [bouyer 20170527]
-	byacc: update to 20170430 [christos 20170605]
-	vax: Add support for VAXstation 4000 TURBOchannel. [flxd 20170609]
-	wsbell(4): added console bell support for all speaker devices, not
-		only those attached at pcppi [nat 20170612]
-	bind: Import version 9.10.5-P1. [christos 20170615]
+Changes from NetBSD 8.0 to NetBSD 9.0:
+ 	byacc: update to 20170430 [christos 20170605]
+ 	vax: Add support for VAXstation 4000 TURBOchannel. [flxd 20170609]
+ 	wsbell(4): added console bell support for all speaker devices, not
+ 		only those attached at pcppi [nat 20170612]
+ 	bind: Import version 9.10.5-P1. [christos 20170615]
 	expat: Import 2.2.1 (security fixes) [christos 20170617]
 	bind: Import version 9.10.5-P2. [christos 20170630]



CVS commit: src/doc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:52:32 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new bind.


To generate a diff of this commit:
cvs rdiff -u -r1.1454 -r1.1455 src/doc/3RDPARTY
cvs rdiff -u -r1.2293 -r1.2294 src/doc/CHANGES

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



CVS commit: src/doc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:52:32 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new bind.


To generate a diff of this commit:
cvs rdiff -u -r1.1454 -r1.1455 src/doc/3RDPARTY
cvs rdiff -u -r1.2293 -r1.2294 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/3RDPARTY
diff -u src/doc/3RDPARTY:1.1454 src/doc/3RDPARTY:1.1455
--- src/doc/3RDPARTY:1.1454	Sat Jun 17 18:06:54 2017
+++ src/doc/3RDPARTY	Fri Jun 30 07:52:32 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1454 2017/06/17 22:06:54 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1455 2017/06/30 11:52:32 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -114,8 +114,8 @@ Notes:
 bc includes dc, both of which are in the NetBSD tree.
 
 Package:	bind [named and utils]
-Version:	9.10.5-P1/BSD	9.11.1-P1/MPL
-Current Vers:	9.10.5-P1/BSD
+Version:	9.10.5-P2/BSD	9.11.1-P1/MPL
+Current Vers:	9.10.5-P2/BSD
 Maintainer:	Paul Vixie <vi...@vix.com>
 Archive Site:	ftp://ftp.isc.org/isc/bind9/
 Home Page:	http://www.isc.org/software/bind/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2293 src/doc/CHANGES:1.2294
--- src/doc/CHANGES:1.2293	Sat Jun 17 18:06:54 2017
+++ src/doc/CHANGES	Fri Jun 30 07:52:32 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2293 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2294 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -528,3 +528,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 		only those attached at pcppi [nat 20170612]
 	bind: Import version 9.10.5-P1. [christos 20170615]
 	expat: Import 2.2.1 (security fixes) [christos 20170617]
+	bind: Import version 9.10.5-P2. [christos 20170630]



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

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:32:34 UTC 2017

Modified Files:
src/external/bsd/bind/dist: CHANGES README srcid version
src/external/bsd/bind/dist/doc/arm: Bv9ARM.ch04.html Bv9ARM.ch06.html
Bv9ARM.ch07.html Bv9ARM.ch08.html Bv9ARM.ch09.html Bv9ARM.html
Bv9ARM.pdf man.arpaname.html man.ddns-confgen.html man.delv.html
man.dig.html man.dnssec-checkds.html man.dnssec-coverage.html
man.dnssec-dsfromkey.html man.dnssec-importkey.html
man.dnssec-keyfromlabel.html man.dnssec-keygen.html
man.dnssec-revoke.html man.dnssec-settime.html
man.dnssec-signzone.html man.dnssec-verify.html man.genrandom.html
man.host.html man.isc-hmac-fixup.html man.named-checkconf.html
man.named-checkzone.html man.named-journalprint.html
man.named-rrchecker.html man.named.html man.nsec3hash.html
man.nsupdate.html man.rndc-confgen.html man.rndc.conf.html
man.rndc.html
src/external/bsd/bind/dist/lib/dns: api dnssec.c message.c rootns.c
tsig.c

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/external/bsd/bind/dist/CHANGES
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/bind/dist/README
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/bind/dist/srcid
cvs rdiff -u -r1.25 -r1.26 src/external/bsd/bind/dist/version
cvs rdiff -u -r1.15 -r1.16 \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch04.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch06.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch07.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch08.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch09.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.html \
src/external/bsd/bind/dist/doc/arm/man.arpaname.html \
src/external/bsd/bind/dist/doc/arm/man.ddns-confgen.html \
src/external/bsd/bind/dist/doc/arm/man.delv.html \
src/external/bsd/bind/dist/doc/arm/man.dig.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-checkds.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-coverage.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-dsfromkey.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-importkey.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-keyfromlabel.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-keygen.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-revoke.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-settime.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-signzone.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-verify.html \
src/external/bsd/bind/dist/doc/arm/man.genrandom.html \
src/external/bsd/bind/dist/doc/arm/man.host.html \
src/external/bsd/bind/dist/doc/arm/man.isc-hmac-fixup.html \
src/external/bsd/bind/dist/doc/arm/man.named-checkconf.html \
src/external/bsd/bind/dist/doc/arm/man.named-checkzone.html \
src/external/bsd/bind/dist/doc/arm/man.named-journalprint.html \
src/external/bsd/bind/dist/doc/arm/man.named-rrchecker.html \
src/external/bsd/bind/dist/doc/arm/man.named.html \
src/external/bsd/bind/dist/doc/arm/man.nsec3hash.html \
src/external/bsd/bind/dist/doc/arm/man.nsupdate.html \
src/external/bsd/bind/dist/doc/arm/man.rndc-confgen.html \
src/external/bsd/bind/dist/doc/arm/man.rndc.conf.html \
src/external/bsd/bind/dist/doc/arm/man.rndc.html
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/bind/dist/doc/arm/Bv9ARM.pdf
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/bind/dist/lib/dns/api
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/bind/dist/lib/dns/dnssec.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/bind/dist/lib/dns/message.c
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/bind/dist/lib/dns/rootns.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/bind/dist/lib/dns/tsig.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/bsd/bind/dist/CHANGES
diff -u src/external/bsd/bind/dist/CHANGES:1.27 src/external/bsd/bind/dist/CHANGES:1.28
--- src/external/bsd/bind/dist/CHANGES:1.27	Thu Jun 15 11:59:35 2017
+++ src/external/bsd/bind/dist/CHANGES	Fri Jun 30 07:32:33 2017
@@ -1,3 +1,11 @@
+	--- 9.10.5-P2 released ---
+
+4643.	[security]	An error in TSIG handling could permit unauthorized
+			zone transfers or zone updates. (CVE-2017-3142)
+			(CVE-2017-3143) [RT #45383]
+
+4633.	[maint]		Updated  (2001:500:200::b) for B.ROOT-SERVERS.NET.
+
 	--- 9.10.5-P1 released ---
 
 4632.	[security]	The BIND installer on Windows used an unquoted

Index: src/external/bsd/bind/dist/README
diff -u src/external/bsd/bind/dist/README:1.15 src/external/bsd/bind/dist/README:1.16
--- src/external/bsd/bind/dist/README:1.15	Thu Jun 15 11:59:36 2017
+++ src/external/bsd/bind/dist/README	Fri Jun 30 07:32:33 2017
@@ -51,6 +51,11 @@ BIND 9
 	For 

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

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 11:32:34 UTC 2017

Modified Files:
src/external/bsd/bind/dist: CHANGES README srcid version
src/external/bsd/bind/dist/doc/arm: Bv9ARM.ch04.html Bv9ARM.ch06.html
Bv9ARM.ch07.html Bv9ARM.ch08.html Bv9ARM.ch09.html Bv9ARM.html
Bv9ARM.pdf man.arpaname.html man.ddns-confgen.html man.delv.html
man.dig.html man.dnssec-checkds.html man.dnssec-coverage.html
man.dnssec-dsfromkey.html man.dnssec-importkey.html
man.dnssec-keyfromlabel.html man.dnssec-keygen.html
man.dnssec-revoke.html man.dnssec-settime.html
man.dnssec-signzone.html man.dnssec-verify.html man.genrandom.html
man.host.html man.isc-hmac-fixup.html man.named-checkconf.html
man.named-checkzone.html man.named-journalprint.html
man.named-rrchecker.html man.named.html man.nsec3hash.html
man.nsupdate.html man.rndc-confgen.html man.rndc.conf.html
man.rndc.html
src/external/bsd/bind/dist/lib/dns: api dnssec.c message.c rootns.c
tsig.c

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/external/bsd/bind/dist/CHANGES
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/bind/dist/README
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/bind/dist/srcid
cvs rdiff -u -r1.25 -r1.26 src/external/bsd/bind/dist/version
cvs rdiff -u -r1.15 -r1.16 \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch04.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch06.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch07.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch08.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.ch09.html \
src/external/bsd/bind/dist/doc/arm/Bv9ARM.html \
src/external/bsd/bind/dist/doc/arm/man.arpaname.html \
src/external/bsd/bind/dist/doc/arm/man.ddns-confgen.html \
src/external/bsd/bind/dist/doc/arm/man.delv.html \
src/external/bsd/bind/dist/doc/arm/man.dig.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-checkds.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-coverage.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-dsfromkey.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-importkey.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-keyfromlabel.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-keygen.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-revoke.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-settime.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-signzone.html \
src/external/bsd/bind/dist/doc/arm/man.dnssec-verify.html \
src/external/bsd/bind/dist/doc/arm/man.genrandom.html \
src/external/bsd/bind/dist/doc/arm/man.host.html \
src/external/bsd/bind/dist/doc/arm/man.isc-hmac-fixup.html \
src/external/bsd/bind/dist/doc/arm/man.named-checkconf.html \
src/external/bsd/bind/dist/doc/arm/man.named-checkzone.html \
src/external/bsd/bind/dist/doc/arm/man.named-journalprint.html \
src/external/bsd/bind/dist/doc/arm/man.named-rrchecker.html \
src/external/bsd/bind/dist/doc/arm/man.named.html \
src/external/bsd/bind/dist/doc/arm/man.nsec3hash.html \
src/external/bsd/bind/dist/doc/arm/man.nsupdate.html \
src/external/bsd/bind/dist/doc/arm/man.rndc-confgen.html \
src/external/bsd/bind/dist/doc/arm/man.rndc.conf.html \
src/external/bsd/bind/dist/doc/arm/man.rndc.html
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/bind/dist/doc/arm/Bv9ARM.pdf
cvs rdiff -u -r1.15 -r1.16 src/external/bsd/bind/dist/lib/dns/api
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/bind/dist/lib/dns/dnssec.c
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/bind/dist/lib/dns/message.c
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/bind/dist/lib/dns/rootns.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/bind/dist/lib/dns/tsig.c

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



CVS commit: src/lib/libc/rpc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 10:03:34 UTC 2017

Modified Files:
src/lib/libc/rpc: getnetconfig.c

Log Message:
Revert previous since it causes a double free (p->nc_netid == tmp == tmp2).
>From Xin Li @ FreeBSD.
XXX: pullup 7


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/rpc/getnetconfig.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/rpc/getnetconfig.c
diff -u src/lib/libc/rpc/getnetconfig.c:1.24 src/lib/libc/rpc/getnetconfig.c:1.25
--- src/lib/libc/rpc/getnetconfig.c:1.24	Wed Oct 26 11:39:30 2016
+++ src/lib/libc/rpc/getnetconfig.c	Fri Jun 30 06:03:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: getnetconfig.c,v 1.24 2016/10/26 15:39:30 christos Exp $	*/
+/*	$NetBSD: getnetconfig.c,v 1.25 2017/06/30 10:03:34 christos Exp $	*/
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -36,7 +36,7 @@
 #if 0
 staticchar sccsid[] = "@(#)getnetconfig.c	1.12 91/12/19 SMI";
 #else
-__RCSID("$NetBSD: getnetconfig.c,v 1.24 2016/10/26 15:39:30 christos Exp $");
+__RCSID("$NetBSD: getnetconfig.c,v 1.25 2017/06/30 10:03:34 christos Exp $");
 #endif
 #endif
 
@@ -649,12 +649,12 @@ static struct netconfig *
 dup_ncp(struct netconfig *ncp)
 {
 	struct netconfig	*p;
-	char	*tmp, *tmp2;
+	char	*tmp;
 	u_int	i;
 
 	_DIAGASSERT(ncp != NULL);
 
-	if ((tmp2 = tmp = malloc(MAXNETCONFIGLINE)) == NULL)
+	if ((tmp = malloc(MAXNETCONFIGLINE)) == NULL)
 		return NULL;
 	if ((p = malloc(sizeof(*p))) == NULL) {
 		free(tmp);
@@ -679,7 +679,6 @@ dup_ncp(struct netconfig *ncp)
 	p->nc_device = strcpy(tmp, ncp->nc_device);
 	p->nc_lookups = calloc((size_t)(p->nc_nlookups + 1), sizeof(char *));
 	if (p->nc_lookups == NULL) {
-		free(tmp2);
 		free(p->nc_netid);
 		free(p);
 		return NULL;



CVS commit: src/lib/libc/rpc

2017-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 30 10:03:34 UTC 2017

Modified Files:
src/lib/libc/rpc: getnetconfig.c

Log Message:
Revert previous since it causes a double free (p->nc_netid == tmp == tmp2).
>From Xin Li @ FreeBSD.
XXX: pullup 7


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/rpc/getnetconfig.c

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



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

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:19:19 UTC 2017

Modified Files:
src/sys/arch/arm/vexpress: vexpress_sysreg.c

Log Message:
Use of_match_compatible instead of of_compatible


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/vexpress/vexpress_sysreg.c

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

Modified files:

Index: src/sys/arch/arm/vexpress/vexpress_sysreg.c
diff -u src/sys/arch/arm/vexpress/vexpress_sysreg.c:1.2 src/sys/arch/arm/vexpress/vexpress_sysreg.c:1.3
--- src/sys/arch/arm/vexpress/vexpress_sysreg.c:1.2	Fri Jun  2 21:26:20 2017
+++ src/sys/arch/arm/vexpress/vexpress_sysreg.c	Fri Jun 30 09:19:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: vexpress_sysreg.c,v 1.2 2017/06/02 21:26:20 jmcneill Exp $ */
+/* $NetBSD: vexpress_sysreg.c,v 1.3 2017/06/30 09:19:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vexpress_sysreg.c,v 1.2 2017/06/02 21:26:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vexpress_sysreg.c,v 1.3 2017/06/30 09:19:19 jmcneill Exp $");
 
 #include 
 #include 
@@ -100,7 +100,7 @@ vexpress_sysreg_match(device_t parent, c
 {
 	struct fdt_attach_args * const faa = aux;
 
-	return of_compatible(faa->faa_phandle, compatible) >= 0;
+	return of_match_compatible(faa->faa_phandle, compatible);
 }
 
 static void



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

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:19:19 UTC 2017

Modified Files:
src/sys/arch/arm/vexpress: vexpress_sysreg.c

Log Message:
Use of_match_compatible instead of of_compatible


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/vexpress/vexpress_sysreg.c

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



CVS commit: src/sys/dev/ofw

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:17:05 UTC 2017

Modified Files:
src/sys/dev/ofw: ofw_subr.c openfirm.h

Log Message:
Add of_search_compatible, which searches an array of compat_data structures
for a matching "compatible" entry matching the supplied OFW node. This
allows us to associate data with compatible strings.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ofw/openfirm.h

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



CVS commit: src/sys/dev/ofw

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:17:05 UTC 2017

Modified Files:
src/sys/dev/ofw: ofw_subr.c openfirm.h

Log Message:
Add of_search_compatible, which searches an array of compat_data structures
for a matching "compatible" entry matching the supplied OFW node. This
allows us to associate data with compatible strings.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ofw/openfirm.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/dev/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.28 src/sys/dev/ofw/ofw_subr.c:1.29
--- src/sys/dev/ofw/ofw_subr.c:1.28	Sun Apr 30 16:46:09 2017
+++ src/sys/dev/ofw/ofw_subr.c	Fri Jun 30 09:17:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.c,v 1.28 2017/04/30 16:46:09 jmcneill Exp $	*/
+/*	$NetBSD: ofw_subr.c,v 1.29 2017/06/30 09:17:05 jmcneill Exp $	*/
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.28 2017/04/30 16:46:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.29 2017/06/30 09:17:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -186,6 +186,38 @@ of_match_compatible(int phandle, const c
 }
 
 /*
+ * const struct of_compat_data *of_search_compatible(phandle, compat_data)
+ *
+ * This routine searches an array of compat_data structures for a
+ * matching "compatible" entry matching the supplied OFW node.
+ *
+ * Arguments:
+ *	phandle		OFW phandle of device to be checked for
+ *			compatibility.
+ *	compat_data	Array of possible compat entry strings and
+ *			associated metadata. The last entry in the
+ *			list should have a "compat" of NULL to terminate
+ *			the list.
+ *
+ * Return Value:
+ *	The first matching compat_data entry in the array. If no matches
+ *	are found, the terminating ("compat" of NULL) record is returned.
+ *
+ * Side Effects:
+ *	None.
+ */
+const struct of_compat_data *
+of_search_compatible(int phandle, const struct of_compat_data *compat_data)
+{
+	for (; compat_data->compat != NULL; compat_data++) {
+		const char *compat[] = { compat_data->compat, NULL };
+		if (of_match_compatible(phandle, compat))
+			break;
+	}
+	return compat_data;
+}
+
+/*
  * int of_packagename(phandle, buf, bufsize)
  *
  * This routine places the last component of an OFW node's name

Index: src/sys/dev/ofw/openfirm.h
diff -u src/sys/dev/ofw/openfirm.h:1.34 src/sys/dev/ofw/openfirm.h:1.35
--- src/sys/dev/ofw/openfirm.h:1.34	Sun Apr 30 16:46:09 2017
+++ src/sys/dev/ofw/openfirm.h	Fri Jun 30 09:17:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.h,v 1.34 2017/04/30 16:46:09 jmcneill Exp $	*/
+/*	$NetBSD: openfirm.h,v 1.35 2017/06/30 09:17:05 jmcneill Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -65,6 +65,10 @@ struct ofbus_attach_args {
 	int		oba_unit;
 };
 
+struct of_compat_data {
+	const char *compat;
+	uintptr_t data;
+};
 
 /*
  * Functions and variables provided by machine-dependent code.
@@ -106,6 +110,8 @@ int	openfirmware(void *);
  */
 int	of_compatible(int, const char * const *);
 int	of_match_compatible(int, const char * const *);
+const struct of_compat_data *
+	of_search_compatible(int, const struct of_compat_data *);
 int	of_decode_int(const unsigned char *);
 int	of_packagename(int, char *, int);
 int	of_find_firstchild_byname(int, const char *);



CVS commit: src/sys/net

2017-06-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 30 09:11:22 UTC 2017

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

Log Message:
Restore the original length of a sockaddr for netmask

route(8) passes a sockaddr for netmask that is truncated with its
prefixlen. However the kernel basically doesn't expect such format
and may read beyond the data. So restore the original length of the
the data at the beginning of the kernel for the rest components.

Failures of ATF tests such as route_flags_blackhole6 should
be fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/net/rtsock.c

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



CVS commit: src/sys/dev/fdt

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:11:22 UTC 2017

Modified Files:
src/sys/dev/fdt: fdt_subr.c fdtvar.h

Log Message:
Add fdtbus_get_string helper


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/fdt/fdtvar.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/dev/fdt/fdt_subr.c
diff -u src/sys/dev/fdt/fdt_subr.c:1.13 src/sys/dev/fdt/fdt_subr.c:1.14
--- src/sys/dev/fdt/fdt_subr.c:1.13	Fri Jun  2 01:07:53 2017
+++ src/sys/dev/fdt/fdt_subr.c	Fri Jun 30 09:11:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.13 2017/06/02 01:07:53 jmcneill Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.14 2017/06/30 09:11:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.13 2017/06/02 01:07:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.14 2017/06/30 09:11:22 jmcneill Exp $");
 
 #include 
 #include 
@@ -406,3 +406,11 @@ fdtbus_status_okay(int phandle)
 
 	return strncmp(prop, "ok", 2) == 0;
 }
+
+const char *
+fdtbus_get_string(int phandle, const char *prop)
+{
+	const int off = fdtbus_phandle2offset(phandle);
+
+	return fdt_getprop(fdtbus_get_data(), off, prop, NULL);
+}

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.21 src/sys/dev/fdt/fdtvar.h:1.22
--- src/sys/dev/fdt/fdtvar.h:1.21	Thu Jun 29 17:04:17 2017
+++ src/sys/dev/fdt/fdtvar.h	Fri Jun 30 09:11:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.21 2017/06/29 17:04:17 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.22 2017/06/30 09:11:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -294,6 +294,8 @@ tcflag_t	fdtbus_get_stdout_flags(void);
 
 bool		fdtbus_status_okay(int);
 
+const char *	fdtbus_get_string(int, const char *);
+
 int		fdtbus_print(void *, const char *);
 
 #endif /* _DEV_FDT_FDTVAR_H */



CVS commit: src/sys/dev/fdt

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:11:22 UTC 2017

Modified Files:
src/sys/dev/fdt: fdt_subr.c fdtvar.h

Log Message:
Add fdtbus_get_string helper


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/fdt/fdtvar.h

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



CVS commit: src/sys/net

2017-06-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 30 09:11:22 UTC 2017

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

Log Message:
Restore the original length of a sockaddr for netmask

route(8) passes a sockaddr for netmask that is truncated with its
prefixlen. However the kernel basically doesn't expect such format
and may read beyond the data. So restore the original length of the
the data at the beginning of the kernel for the rest components.

Failures of ATF tests such as route_flags_blackhole6 should
be fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/net/rtsock.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.224 src/sys/net/rtsock.c:1.225
--- src/sys/net/rtsock.c:1.224	Wed Jun 28 04:14:53 2017
+++ src/sys/net/rtsock.c	Fri Jun 30 09:11:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.224 2017/06/28 04:14:53 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.225 2017/06/30 09:11:22 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.224 2017/06/28 04:14:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.225 2017/06/30 09:11:22 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -736,6 +736,7 @@ COMPATNAME(route_output)(struct mbuf *m,
 	struct sockaddr_dl sdl;
 	int bound = curlwp_bind();
 	bool do_rt_free = false;
+	struct sockaddr *netmask = NULL;
 
 #define senderr(e) do { error = e; goto flush;} while (/*CONSTCOND*/ 0)
 	if (m == NULL || ((m->m_len < sizeof(int32_t)) &&
@@ -793,6 +794,41 @@ COMPATNAME(route_output)(struct mbuf *m,
 	0, rtm, NULL, NULL) != 0)
 		senderr(EACCES);
 
+	/*
+	 * route(8) passes a sockaddr truncated with prefixlen.
+	 * The kernel doesn't expect such sockaddr and need to restore
+	 * the original length of the sockaddr.
+	 */
+	if (info.rti_info[RTAX_NETMASK]) {
+		size_t sa_len = 0;
+		int af = info.rti_info[RTAX_NETMASK]->sa_family;
+
+		switch (af) {
+#ifdef INET
+		case AF_INET:
+			sa_len = sizeof(struct sockaddr_in);
+			break;
+#endif
+#ifdef INET6
+		case AF_INET6:
+			sa_len = sizeof(struct sockaddr_in6);
+			break;
+#endif
+		default:
+			break;
+		}
+		if (sa_len != 0 &&
+		sa_len > info.rti_info[RTAX_NETMASK]->sa_len) {
+			netmask = sockaddr_alloc(af, sa_len, M_WAITOK|M_ZERO);
+			sockaddr_copy(netmask,
+			info.rti_info[RTAX_NETMASK]->sa_len,
+			info.rti_info[RTAX_NETMASK]);
+			/* Restore original sa_len */
+			netmask->sa_len = info.rti_info[RTAX_NETMASK]->sa_len;
+			info.rti_info[RTAX_NETMASK] = netmask;
+		}
+	}
+
 	switch (rtm->rtm_type) {
 
 	case RTM_ADD:
@@ -1031,6 +1067,8 @@ flush:
 }
 out:
 	curlwp_bindx(bound);
+	if (netmask)
+		sockaddr_free(netmask);
 	return error;
 }
 



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

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:05:52 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_platform.c

Log Message:
Remove unused defines


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_platform.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_platform.c
diff -u src/sys/arch/arm/sunxi/sunxi_platform.c:1.1 src/sys/arch/arm/sunxi/sunxi_platform.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_platform.c:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/arm/sunxi/sunxi_platform.c	Fri Jun 30 09:05:52 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.2 2017/06/30 09:05:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_fdt_arm.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.1 2017/06/28 23:51:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.2 2017/06/30 09:05:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -67,10 +67,6 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_platfo
 #define	SUN8I_WDT_MODE		0x18
 #define	 SUN8I_WDT_MODE_EN	1
 
-#define	SUN8I_CPUCFG_BASE	0x01f01c00
-#define	SUN8I_CPUCFG_SIZE	0x400
-#define	SUN8I_PRCM_BASE		0x01f01400
-#define	SUN8I_PRCM_SIZE		0x800
 
 #define	DEVMAP_ALIGN(a)	((a) & ~L1_S_OFFSET)
 #define	DEVMAP_SIZE(s)	roundup2((s), L1_S_SIZE)



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

2017-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jun 30 09:05:52 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_platform.c

Log Message:
Remove unused defines


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_platform.c

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



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

2017-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 30 08:10:50 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
KNF. Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/arm/arm32/db_interface.c

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



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

2017-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 30 08:10:50 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
KNF. Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/arm/arm32/db_interface.c

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

Modified files:

Index: src/sys/arch/arm/arm32/db_interface.c
diff -u src/sys/arch/arm/arm32/db_interface.c:1.55 src/sys/arch/arm/arm32/db_interface.c:1.56
--- src/sys/arch/arm/arm32/db_interface.c:1.55	Fri Jun 30 08:05:22 2017
+++ src/sys/arch/arm/arm32/db_interface.c	Fri Jun 30 08:10:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.55 2017/06/30 08:05:22 skrll Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.56 2017/06/30 08:10:50 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Scott K. Stevens
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.55 2017/06/30 08:05:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.56 2017/06/30 08:10:50 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -192,7 +192,7 @@ kdb_trap(int type, db_regs_t *regs)
 	}
 #endif
 
-	return (1);
+	return 1;
 }
 #endif
 
@@ -398,8 +398,8 @@ db_trapper(u_int addr, u_int inst, trapf
 		else
 			kdb_trap(-1, frame);
 	} else
-		return (1);
-	return (0);
+		return 1;
+	return 0;
 }
 
 extern u_int esym;
@@ -426,37 +426,37 @@ db_fetch_reg(int reg, db_regs_t *regs)
 
 	switch (reg) {
 	case 0:
-		return (regs->tf_r0);
+		return regs->tf_r0;
 	case 1:
-		return (regs->tf_r1);
+		return regs->tf_r1;
 	case 2:
-		return (regs->tf_r2);
+		return regs->tf_r2;
 	case 3:
-		return (regs->tf_r3);
+		return regs->tf_r3;
 	case 4:
-		return (regs->tf_r4);
+		return regs->tf_r4;
 	case 5:
-		return (regs->tf_r5);
+		return regs->tf_r5;
 	case 6:
-		return (regs->tf_r6);
+		return regs->tf_r6;
 	case 7:
-		return (regs->tf_r7);
+		return regs->tf_r7;
 	case 8:
-		return (regs->tf_r8);
+		return regs->tf_r8;
 	case 9:
-		return (regs->tf_r9);
+		return regs->tf_r9;
 	case 10:
-		return (regs->tf_r10);
+		return regs->tf_r10;
 	case 11:
-		return (regs->tf_r11);
+		return regs->tf_r11;
 	case 12:
-		return (regs->tf_r12);
+		return regs->tf_r12;
 	case 13:
-		return (regs->tf_svc_sp);
+		return regs->tf_svc_sp;
 	case 14:
-		return (regs->tf_svc_lr);
+		return regs->tf_svc_lr;
 	case 15:
-		return (regs->tf_pc);
+		return regs->tf_pc;
 	default:
 		panic("db_fetch_reg: botch");
 	}
@@ -473,19 +473,19 @@ branch_taken(u_int insn, u_int pc, db_re
 		addr = ((insn << 2) & 0x03ff);
 		if (addr & 0x0200)
 			addr |= 0xfc00;
-		return (pc + 8 + addr);
+		return pc + 8 + addr;
 	case 0x7:	/* ldr pc, [pc, reg, lsl #2] */
 		addr = db_fetch_reg(insn & 0xf, regs);
 		addr = pc + 8 + (addr << 2);
 		db_read_bytes(addr, 4, (char *));
-		return (addr);
+		return addr;
 	case 0x5:	/* ldr pc, [reg] */
 		addr = db_fetch_reg((insn >> 16) & 0xf, regs);
 		db_read_bytes(addr, 4, (char *));
-		return (addr);
+		return addr;
 	case 0x1:	/* mov pc, reg */
 		addr = db_fetch_reg(insn & 0xf, regs);
-		return (addr);
+		return addr;
 	case 0x8:	/* ldmxx reg, {..., pc} */
 	case 0x9:
 		addr = db_fetch_reg((insn >> 16) & 0xf, regs);
@@ -508,7 +508,7 @@ branch_taken(u_int insn, u_int pc, db_re
 			break;
 		}
 		db_read_bytes(addr, 4, (char *));
-		return (addr);
+		return addr;
 	default:
 		panic("branch_taken: botch");
 	}



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

2017-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 30 08:05:22 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/arm/arm32/db_interface.c

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



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

2017-06-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 30 08:05:22 UTC 2017

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/arm/arm32/db_interface.c

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

Modified files:

Index: src/sys/arch/arm/arm32/db_interface.c
diff -u src/sys/arch/arm/arm32/db_interface.c:1.54 src/sys/arch/arm/arm32/db_interface.c:1.55
--- src/sys/arch/arm/arm32/db_interface.c:1.54	Wed Oct 29 14:14:14 2014
+++ src/sys/arch/arm/arm32/db_interface.c	Fri Jun 30 08:05:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.54 2014/10/29 14:14:14 skrll Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.55 2017/06/30 08:05:22 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Scott K. Stevens
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.54 2014/10/29 14:14:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.55 2017/06/30 08:05:22 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -133,7 +133,7 @@ kdb_trap(int type, db_regs_t *regs)
 			/*
 			 * While we aren't the master, wait until the master
 			 * gives control to us or exits.  If it exited, we
-			 * just exit to.  Otherwise this cpu will enter DDB.
+			 * just exit too.  Otherwise this cpu will enter DDB.
 			 */
 			membar_consumer();
 			while (db_onproc != ci) {



CVS commit: src/tests/net/route

2017-06-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 30 07:57:13 UTC 2017

Modified Files:
src/tests/net/route: t_flags.sh t_flags6.sh

Log Message:
Check if ARP/NDP entries are purged when a related route is deleted


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/net/route/t_flags.sh
cvs rdiff -u -r1.14 -r1.15 src/tests/net/route/t_flags6.sh

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



CVS commit: src/tests/net/route

2017-06-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jun 30 07:57:13 UTC 2017

Modified Files:
src/tests/net/route: t_flags.sh t_flags6.sh

Log Message:
Check if ARP/NDP entries are purged when a related route is deleted


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/net/route/t_flags.sh
cvs rdiff -u -r1.14 -r1.15 src/tests/net/route/t_flags6.sh

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

Modified files:

Index: src/tests/net/route/t_flags.sh
diff -u src/tests/net/route/t_flags.sh:1.18 src/tests/net/route/t_flags.sh:1.19
--- src/tests/net/route/t_flags.sh:1.18	Wed Jun 28 04:14:53 2017
+++ src/tests/net/route/t_flags.sh	Fri Jun 30 07:57:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_flags.sh,v 1.18 2017/06/28 04:14:53 ozaki-r Exp $
+#	$NetBSD: t_flags.sh,v 1.19 2017/06/30 07:57:12 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -148,6 +148,8 @@ test_blackhole()
 
 	# Delete an existing route first
 	atf_check -s exit:0 -o ignore rump.route delete -net 10.0.0.0/24
+	# Should be removed too
+	atf_check -s not-exit:0 -e match:'no entry' rump.arp -n 10.0.0.1
 
 	# Gateway must be lo0
 	atf_check -s exit:0 -o ignore \

Index: src/tests/net/route/t_flags6.sh
diff -u src/tests/net/route/t_flags6.sh:1.14 src/tests/net/route/t_flags6.sh:1.15
--- src/tests/net/route/t_flags6.sh:1.14	Wed Jun 28 04:14:53 2017
+++ src/tests/net/route/t_flags6.sh	Fri Jun 30 07:57:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_flags6.sh,v 1.14 2017/06/28 04:14:53 ozaki-r Exp $
+#	$NetBSD: t_flags6.sh,v 1.15 2017/06/30 07:57:12 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -134,6 +134,9 @@ test_blackhole6()
 	# Delete an existing route first
 	atf_check -s exit:0 -o ignore \
 	rump.route delete -inet6 -net fc00::/64
+	# Should be removed too
+	atf_check -s not-exit:0 -o ignore -e match:'no entry' \
+	rump.ndp -n $IP6_PEER
 
 	# Gateway must be lo0
 	atf_check -s exit:0 -o ignore \



CVS commit: [netbsd-8] src/doc

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 07:00:25 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
tickets 58, 59, 61-63, 68-71, 74


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

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.13 src/doc/CHANGES-8.0:1.1.2.14
--- src/doc/CHANGES-8.0:1.1.2.13	Sun Jun 25 06:34:38 2017
+++ src/doc/CHANGES-8.0	Fri Jun 30 07:00:24 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.13 2017/06/25 06:34:38 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.14 2017/06/30 07:00:24 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -1432,3 +1432,63 @@ sys/net/route.c	1.195
 	Fix locking in rtalloc1 (affected only if NET_MPSAFE)
 	[ozaki-r, ticket #57]
 
+sys/net/if_gif.c1.127
+
+	Further gif(4) MP-ification.
+	[knakahara, ticket #58]
+
+sys/arch/arm/broadcom/bcm2835_emmc.c		1.30
+
+	Disable SDR50 support, it is not reliable on these boards.
+	[jmcneill, ticket #59]
+
+sys/dev/hpc/hpckbd.c1.31
+
+	Restore wscons keymaps feature on hpcarm
+	[manu, ticket #61]
+
+sys/arch/amd64/conf/XEN3_DOM0			1.136
+sys/arch/i386/conf/XEN3_DOM0			1.113
+sys/arch/xen/conf/files.xen			1.148
+
+	Register support for SD card readers with Xen DOM0 kernels
+	[khorben, ticket #62]
+
+libexec/ld.elf_so/headers.c			1.62
+
+	Remove old assert that only two segments exist. The rest of the
+	code has been changed to cope with more and at least Go actively
+	creates them.  Adjust the mapping size computation to use the
+	maximum and not depend on PT_LOAD segments to be in order.
+	[joerg, ticket #63]
+
+sys/dev/ic/am7930.c1.54, 1.55
+
+	Make vsaudio(4) work again.
+	[nat, ticket #68]
+
+sys/dev/aurateconv.c1.20
+
+	Enable rate conversion for 8-bit audio.
+	[nat, ticket #69]
+
+sys/dev/auconv.c1.27, 1.28
+sys/dev/auconv.h1.17, 1.18
+sys/dev/mulaw.c	1.29, 1.30
+sys/dev/mulaw.h	1.21-1.24
+
+	auconv/mulaw.c: allow for 32 bit precision and more filters
+	for conversion between formats.
+	[nat, ticket #70]
+
+sys/dev/audio.c	1.359-1.366
+sys/dev/audiovar.h1.56
+
+	audio(4): Fix several stability issues.
+	[nat, ticket #71]
+
+sys/dev/mulaw.c	1.31, 1.32
+
+	Fix big endian bug.
+	[nat, ticket #74]
+



CVS commit: [netbsd-8] src/doc

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 07:00:25 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
tickets 58, 59, 61-63, 68-71, 74


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

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



CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:51:28 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: mulaw.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #74):
sys/dev/mulaw.c: 1.31, 1.32
Rectify an error in mulaw/alaw conversion to big endian.  The atf audio
test should pass on sparc again.
--
Better solution to mulaw/alaw conversion on big endian systems/sound
devices.


To generate a diff of this commit:
cvs rdiff -u -r1.28.42.1 -r1.28.42.2 src/sys/dev/mulaw.c

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



CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:51:28 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: mulaw.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #74):
sys/dev/mulaw.c: 1.31, 1.32
Rectify an error in mulaw/alaw conversion to big endian.  The atf audio
test should pass on sparc again.
--
Better solution to mulaw/alaw conversion on big endian systems/sound
devices.


To generate a diff of this commit:
cvs rdiff -u -r1.28.42.1 -r1.28.42.2 src/sys/dev/mulaw.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/mulaw.c
diff -u src/sys/dev/mulaw.c:1.28.42.1 src/sys/dev/mulaw.c:1.28.42.2
--- src/sys/dev/mulaw.c:1.28.42.1	Fri Jun 30 06:38:00 2017
+++ src/sys/dev/mulaw.c	Fri Jun 30 06:51:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mulaw.c,v 1.28.42.1 2017/06/30 06:38:00 snj Exp $	*/
+/*	$NetBSD: mulaw.c,v 1.28.42.2 2017/06/30 06:51:28 snj Exp $	*/
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.28.42.1 2017/06/30 06:38:00 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.28.42.2 2017/06/30 06:51:28 snj Exp $");
 
 #include 
 #include 
@@ -321,7 +321,7 @@ DEFINE_FILTER(mulaw_to_linear##n_prec)		
 		break;			\
 	case AUDIO_ENCODING_ULINEAR_BE:	\
 		FILTER_LOOP_PROLOGUE(this->src, 1, dst, hw, m) {	\
-			j = hw - 2;	\
+			j = 2;		\
 			d[0] = mulawtolin16[s[0]][0];			\
 			d[1] = mulawtolin16[s[0]][1];			\
 			while (j < hw)	\
@@ -339,7 +339,7 @@ DEFINE_FILTER(mulaw_to_linear##n_prec)		
 		break;			\
 	case AUDIO_ENCODING_SLINEAR_BE:	\
 		FILTER_LOOP_PROLOGUE(this->src, 1, dst, hw, m) {	\
-			j = hw - 2;	\
+			j = 2;		\
 			d[0] = mulawtolin16[s[0]][0] ^ 0x80;		\
 			d[1] = mulawtolin16[s[0]][1];			\
 			while (j < hw)	\
@@ -456,7 +456,7 @@ DEFINE_FILTER(alaw_to_linear##n_prec)			
 		break;			\
 	case AUDIO_ENCODING_ULINEAR_BE:	\
 		FILTER_LOOP_PROLOGUE(this->src, 1, dst, hw, m) {	\
-			j = hw - 2;	\
+			j = 2;		\
 			d[0] = alawtolin16[s[0]][0];			\
 			d[1] = alawtolin16[s[0]][1];			\
 			while (j < hw)	\
@@ -474,10 +474,10 @@ DEFINE_FILTER(alaw_to_linear##n_prec)			
 		break;			\
 	case AUDIO_ENCODING_SLINEAR_BE:	\
 		FILTER_LOOP_PROLOGUE(this->src, 1, dst, hw, m) {	\
-			j = hw - 2;	\
+			j = 2;		\
 			d[0] = alawtolin16[s[0]][0] ^ 0x80;		\
 			d[1] = alawtolin16[s[0]][1];			\
-			while (j < hw)	 \
+			while (j < hw)	\
 d[j++] = 0;\
 		} FILTER_LOOP_EPILOGUE(this->src, dst);			\
 		break;			\



CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:43:07 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: audio.c audiovar.h

Log Message:
Pull up following revision(s) (requested by nat in ticket #71):
sys/dev/audio.c: 1.359-1.366
sys/dev/audiovar.h: 1.56
No need to reset the audioinfo whem dealing with the hardware ring.  This
avoids a panic with some audio devices.
Ok christos@.
--
sc_iffreq -> sc_frequency.  NFCI.
Ok christos@.
--
Allow for bigger data types to mix into to avoid overflow.
--
Check hardare precision in vchan_autoconfig.  Passes atf test again.
--
Use pustream params when clearing the next block in the mixring.
--
Check validbits against precision in vchan_autoconfig.  At present
validbits != precision is not supported.
This change will most likely break autoconfig on vs(4), for these machines
the parameters can be set to the paramaters reported at attach time via
sysctl.
--
Don't start playback or recording on the hw ring only stream ring buffers.
--
Don't autoconfig for 24 bits precision.  It does not work as yet.


To generate a diff of this commit:
cvs rdiff -u -r1.357.2.1 -r1.357.2.2 src/sys/dev/audio.c
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/dev/audiovar.h

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



CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:43:07 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: audio.c audiovar.h

Log Message:
Pull up following revision(s) (requested by nat in ticket #71):
sys/dev/audio.c: 1.359-1.366
sys/dev/audiovar.h: 1.56
No need to reset the audioinfo whem dealing with the hardware ring.  This
avoids a panic with some audio devices.
Ok christos@.
--
sc_iffreq -> sc_frequency.  NFCI.
Ok christos@.
--
Allow for bigger data types to mix into to avoid overflow.
--
Check hardare precision in vchan_autoconfig.  Passes atf test again.
--
Use pustream params when clearing the next block in the mixring.
--
Check validbits against precision in vchan_autoconfig.  At present
validbits != precision is not supported.
This change will most likely break autoconfig on vs(4), for these machines
the parameters can be set to the paramaters reported at attach time via
sysctl.
--
Don't start playback or recording on the hw ring only stream ring buffers.
--
Don't autoconfig for 24 bits precision.  It does not work as yet.


To generate a diff of this commit:
cvs rdiff -u -r1.357.2.1 -r1.357.2.2 src/sys/dev/audio.c
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/dev/audiovar.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/dev/audio.c
diff -u src/sys/dev/audio.c:1.357.2.1 src/sys/dev/audio.c:1.357.2.2
--- src/sys/dev/audio.c:1.357.2.1	Fri Jun  9 17:00:46 2017
+++ src/sys/dev/audio.c	Fri Jun 30 06:43:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.357.2.1 2017/06/09 17:00:46 snj Exp $	*/
+/*	$NetBSD: audio.c,v 1.357.2.2 2017/06/30 06:43:07 snj Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.1 2017/06/09 17:00:46 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.2 2017/06/30 06:43:07 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -447,7 +447,7 @@ const struct audio_params audio_default 
 	.channels = 1,
 };
 
-int auto_config_precision[] = { 32, 24, 16, 8 };
+int auto_config_precision[] = { 32, 16, 8 };
 int auto_config_channels[] = { 32, 24, 16, 8, 6, 4, 2, 1};
 int auto_config_freq[] = { 48000, 44100, 96000, 192000, 32000,
 			   22050, 16000, 11025, 8000, 4000 };
@@ -535,7 +535,7 @@ audioattach(device_t parent, device_t se
 	vc->sc_lastinfovalid = false;
 	vc->sc_swvol = 255;
 	vc->sc_recswvol = 255;
-	sc->sc_iffreq = 44100;
+	sc->sc_frequency = 44100;
 	sc->sc_precision = 16;
 	sc->sc_channels = 2;
 
@@ -3485,6 +3485,7 @@ int
 audiostartr(struct audio_softc *sc, struct virtual_channel *vc)
 {
 
+	struct audio_chan *chan;
 	int error;
 
 	KASSERT(mutex_owned(sc->sc_lock));
@@ -3493,8 +3494,11 @@ audiostartr(struct audio_softc *sc, stru
 		 vc->sc_mrr.s.start, audio_stream_get_used(>sc_mrr.s),
 		 vc->sc_mrr.usedhigh, vc->sc_mrr.mmapped));
 
+	chan = SIMPLEQ_FIRST(>sc_audiochan);
 	if (!audio_can_capture(sc))
 		return EINVAL;
+	if (vc == chan->vc)
+		return 0;
 
 	error = 0;
 	if (sc->sc_rec_started == false) {
@@ -3525,6 +3529,8 @@ audiostartp(struct audio_softc *sc, stru
 
 	if (!audio_can_playback(sc))
 		return EINVAL;
+	if (vc == chan->vc)
+		return 0;
 
 	if (!vc->sc_mpr.mmapped && used < vc->sc_mpr.blksize) {
 		cv_broadcast(>sc_wchan);
@@ -3874,7 +3880,7 @@ audio_mix(void *v)
 	cc = blksize - (inp - cb->s.start) % blksize;
 	if (sc->sc_writeme == false) {
 		DPRINTFN(3, ("MIX RING EMPTY - INSERT SILENCE\n"));
-		audio_fill_silence(>sc_mpr.s.param, inp, cc);
+		audio_fill_silence(>sc_pustream->param, inp, cc);
 		sc->sc_pr.drops += cc;
 	} else
 		cc = blksize;
@@ -3882,11 +3888,11 @@ audio_mix(void *v)
 	cc = blksize;
 	cc1 = sc->sc_pr.s.end - sc->sc_pr.s.inp;
 	if (cc1 < cc) {
-		audio_fill_silence(>sc_mpr.s.param, sc->sc_pr.s.inp, cc1);
+		audio_fill_silence(>sc_pustream->param, sc->sc_pr.s.inp, cc1);
 		cc -= cc1;
-		audio_fill_silence(>sc_mpr.s.param, sc->sc_pr.s.start, cc);
+		audio_fill_silence(>sc_pustream->param, sc->sc_pr.s.start, cc);
 	} else
-		audio_fill_silence(>sc_mpr.s.param, sc->sc_pr.s.inp, cc);
+		audio_fill_silence(>sc_pustream->param, sc->sc_pr.s.inp, cc);
 	mutex_exit(sc->sc_intr_lock);
 
 	kpreempt_disable();
@@ -4149,7 +4155,7 @@ audio_set_vchan_defaults(struct audio_so
 		return EINVAL;
 	vc = chan->vc;
 
-	sc->sc_vchan_params.sample_rate = sc->sc_iffreq;
+	sc->sc_vchan_params.sample_rate = sc->sc_frequency;
 #if BYTE_ORDER == LITTLE_ENDIAN
 	sc->sc_vchan_params.encoding = AUDIO_ENCODING_SLINEAR_LE;
 #else
@@ -4165,12 +4171,12 @@ audio_set_vchan_defaults(struct audio_so
 	vc->sc_blkset = false;
 
 	AUDIO_INITINFO();
-	ai.record.sample_rate = sc->sc_iffreq;
+	ai.record.sample_rate = sc->sc_frequency;
 	ai.record.encoding= format->encoding;
 	ai.record.channels= sc->sc_channels;
 	ai.record.precision   = sc->sc_precision;
 	ai.record.pause	  = false;
-	ai.play.sample_rate   = 

CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:38:00 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: auconv.c auconv.h mulaw.c mulaw.h

Log Message:
Pull up following revision(s) (requested by nat in ticket #70):
sys/dev/auconv.c: 1.27, 1.28
sys/dev/mulaw.c: 1.29, 1.30
sys/dev/mulaw.h: revision 1.21-1.24
sys/dev/auconv.h: 1.17, 1.18
Add support for more formats.  At present 24 bit formats do not work and
have been disabled.
Ok christos@.
--
Fix defines to proper function names.
--
comment out unused variables.
--
Remove stray ";" from defines.
--
Use LINEARNTOMULAW for 8 bits as well.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/dev/auconv.c
cvs rdiff -u -r1.16 -r1.16.42.1 src/sys/dev/auconv.h
cvs rdiff -u -r1.28 -r1.28.42.1 src/sys/dev/mulaw.c
cvs rdiff -u -r1.20 -r1.20.80.1 src/sys/dev/mulaw.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/dev/auconv.c
diff -u src/sys/dev/auconv.c:1.26 src/sys/dev/auconv.c:1.26.2.1
--- src/sys/dev/auconv.c:1.26	Thu Jun  1 09:44:30 2017
+++ src/sys/dev/auconv.c	Fri Jun 30 06:38:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: auconv.c,v 1.26 2017/06/01 09:44:30 pgoyette Exp $	*/
+/*	$NetBSD: auconv.c,v 1.26.2.1 2017/06/30 06:38:00 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.26 2017/06/01 09:44:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.26.2.1 2017/06/30 06:38:00 snj Exp $");
 
 #include 
 #include 
@@ -113,86 +113,218 @@ struct conv_table {
 	stream_filter_factory_t *play_conv;
 	stream_filter_factory_t *rec_conv;
 };
+#define TABLE_LIST(prec, valid, target) \
+	{AUDIO_ENCODING_SLINEAR_LE, prec, valid,			\
+	 linear##target##_##target##_to_linear##prec,			\
+		linear##prec##_##valid##_to_linear##target},		\
+	{AUDIO_ENCODING_SLINEAR_BE, prec, valid,			\
+	 linear##target##_##target##_to_linear##prec,			\
+		linear##prec##_##valid##_to_linear##target},		\
+	{AUDIO_ENCODING_ULINEAR_LE, prec, valid,			\
+	 linear##target##_##target##_to_linear##prec,			\
+		linear##prec##_##valid##_to_linear##target},		\
+	{AUDIO_ENCODING_ULINEAR_BE, prec, valid,			\
+	 linear##target##_##target##_to_linear##prec,			\
+		linear##prec##_##valid##_to_linear##target},
+#if NMULAW > 0
+#define MULAW_TABLE(prec, valid, target) \
+	{AUDIO_ENCODING_ULAW, 8, 8,	\
+	 linear##prec##_##valid##_to_mulaw,\
+	 mulaw_to_linear##target},	\
+	{AUDIO_ENCODING_ALAW, 8, 8,	\
+	 linear##prec##_##valid##_to_alaw,\
+	 alaw_to_linear##target},
+#endif
 /*
  * SLINEAR-16 or SLINEAR-24 should precede in a table because
  * aurateconv supports only SLINEAR.
  */
 static const struct conv_table s8_table[] = {
-	{AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-	 linear8_to_linear16, linear16_to_linear8},
-	{AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-	 linear8_to_linear16, linear16_to_linear8},
-	{AUDIO_ENCODING_ULINEAR_LE, 8, 8,
-	 change_sign8, change_sign8},
+	TABLE_LIST(32, 32, 8)
+	TABLE_LIST(24, 32, 8)
+	TABLE_LIST(24, 24, 8)
+	TABLE_LIST(16, 16, 8)
+	TABLE_LIST(8, 8, 8)
+#if NMULAW > 0
+	MULAW_TABLE(8, 8, 8)
+#endif
 	{0, 0, 0, NULL, NULL}};
 static const struct conv_table u8_table[] = {
-	{AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-	 linear8_to_linear16, linear16_to_linear8},
-	{AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-	 linear8_to_linear16, linear16_to_linear8},
-	{AUDIO_ENCODING_SLINEAR_LE, 8, 8,
-	 change_sign8, change_sign8},
-	{AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-	 linear8_to_linear16, linear16_to_linear8},
-	{AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-	 linear8_to_linear16, linear16_to_linear8},
+	TABLE_LIST(32, 32, 8)
+	TABLE_LIST(24, 32, 8)
+	TABLE_LIST(24, 24, 8)
+	TABLE_LIST(16, 16, 8)
+	TABLE_LIST(8, 8, 8)
+#if NMULAW > 0
+	MULAW_TABLE(8, 8, 8)
+#endif
 	{0, 0, 0, NULL, NULL}};
 static const struct conv_table s16le_table[] = {
-	{AUDIO_ENCODING_SLINEAR_BE, 16, 16,
-	 swap_bytes, swap_bytes},
-	{AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-	 change_sign16, change_sign16},
-	{AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-	 swap_bytes_change_sign16, swap_bytes_change_sign16},
+	TABLE_LIST(32, 32, 16)
+	TABLE_LIST(24, 32, 16)
+	TABLE_LIST(24, 24, 16)
+	TABLE_LIST(16, 16, 16)
+	TABLE_LIST(8, 8, 16)
+#if NMULAW > 0
+	MULAW_TABLE(16, 16, 16)
+#endif
 	{0, 0, 0, NULL, NULL}};
 static const struct conv_table s16be_table[] = {
-	{AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-	 swap_bytes, swap_bytes},
-	{AUDIO_ENCODING_ULINEAR_BE, 16, 16,
-	 change_sign16, change_sign16},
-	{AUDIO_ENCODING_ULINEAR_LE, 16, 16,
-	 swap_bytes_change_sign16, swap_bytes_change_sign16},
+	TABLE_LIST(32, 32, 16)
+	TABLE_LIST(24, 32, 16)
+	TABLE_LIST(24, 24, 16)
+	TABLE_LIST(16, 16, 16)
+	TABLE_LIST(8, 8, 16)
+#if NMULAW > 0
+	MULAW_TABLE(16, 16, 16)
+#endif
 	{0, 0, 0, NULL, NULL}};
 static const struct conv_table u16le_table[] = {
-	{AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-	 

CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:38:00 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: auconv.c auconv.h mulaw.c mulaw.h

Log Message:
Pull up following revision(s) (requested by nat in ticket #70):
sys/dev/auconv.c: 1.27, 1.28
sys/dev/mulaw.c: 1.29, 1.30
sys/dev/mulaw.h: revision 1.21-1.24
sys/dev/auconv.h: 1.17, 1.18
Add support for more formats.  At present 24 bit formats do not work and
have been disabled.
Ok christos@.
--
Fix defines to proper function names.
--
comment out unused variables.
--
Remove stray ";" from defines.
--
Use LINEARNTOMULAW for 8 bits as well.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/dev/auconv.c
cvs rdiff -u -r1.16 -r1.16.42.1 src/sys/dev/auconv.h
cvs rdiff -u -r1.28 -r1.28.42.1 src/sys/dev/mulaw.c
cvs rdiff -u -r1.20 -r1.20.80.1 src/sys/dev/mulaw.h

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



CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:34:20 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: aurateconv.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #69):
sys/dev/aurateconv.c: revision 1.20
Rate conversion works at 8 bits, so enable it.
Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.42.1 src/sys/dev/aurateconv.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/aurateconv.c
diff -u src/sys/dev/aurateconv.c:1.19 src/sys/dev/aurateconv.c:1.19.42.1
--- src/sys/dev/aurateconv.c:1.19	Wed Nov 23 23:07:31 2011
+++ src/sys/dev/aurateconv.c	Fri Jun 30 06:34:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aurateconv.c,v 1.19 2011/11/23 23:07:31 jmcneill Exp $	*/
+/*	$NetBSD: aurateconv.c,v 1.19.42.1 2017/06/30 06:34:20 snj Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aurateconv.c,v 1.19 2011/11/23 23:07:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aurateconv.c,v 1.19.42.1 2017/06/30 06:34:20 snj Exp $");
 
 #include 
 #include 
@@ -68,6 +68,8 @@ typedef struct aurateconv {
 static int aurateconv_fetch_to(struct audio_softc *, stream_fetcher_t *,
 			   audio_stream_t *, int);
 static void aurateconv_dtor(stream_filter_t *);
+static int aurateconv_slinear8_LE(aurateconv_t *, audio_stream_t *,
+   int, int, int);
 static int aurateconv_slinear16_LE(aurateconv_t *, audio_stream_t *,
    int, int, int);
 static int aurateconv_slinear24_LE(aurateconv_t *, audio_stream_t *,
@@ -118,8 +120,9 @@ aurateconv(struct audio_softc *sc, const
 	}
 	if ((from->encoding != AUDIO_ENCODING_SLINEAR_LE
 	 && from->encoding != AUDIO_ENCODING_SLINEAR_BE)
-	|| (from->precision != 16 && from->precision != 24 && from->precision != 32)) {
-		printf("%s: encoding/precision must be SLINEAR_LE 16/24/32bit, "
+	|| (from->precision != 8 && from->precision != 16 &&
+			 from->precision != 24 && from->precision != 32)) {
+		printf("%s: encoding/precision must be SLINEAR_LE 8/16/24/32bit, "
 		   "or SLINEAR_BE 16/24/32bit", __func__);
 		return NULL;
 	}
@@ -189,6 +192,9 @@ aurateconv_fetch_to(struct audio_softc *
 	switch (this->from.encoding) {
 	case AUDIO_ENCODING_SLINEAR_LE:
 		switch (this->from.precision) {
+		case 8:
+			return aurateconv_slinear8_LE(this, dst, m,
+		   frame_src, frame_dst);
 		case 16:
 			return aurateconv_slinear16_LE(this, dst, m,
 		   frame_src, frame_dst);
@@ -458,6 +464,7 @@ aurateconv_slinear32_##EN (aurateconv_t 
 	return 0; \
 }
 
+AURATECONV_SLINEAR(8, LE)
 AURATECONV_SLINEAR(16, LE)
 AURATECONV_SLINEAR(24, LE)
 AURATECONV_SLINEAR32(LE)



CVS commit: [netbsd-8] src/sys/dev

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:34:20 UTC 2017

Modified Files:
src/sys/dev [netbsd-8]: aurateconv.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #69):
sys/dev/aurateconv.c: revision 1.20
Rate conversion works at 8 bits, so enable it.
Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.42.1 src/sys/dev/aurateconv.c

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



CVS commit: [netbsd-8] src/sys/dev/ic

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:32:21 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: am7930.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #68):
sys/dev/ic/am7930.c: revision 1.54
sys/dev/ic/am7930.c: revision 1.55
rfill and pfill mixed up.
--
Set hw parameters for linear to ulaw filters.
Tested by flxd@.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.8.1 src/sys/dev/ic/am7930.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/ic/am7930.c
diff -u src/sys/dev/ic/am7930.c:1.53 src/sys/dev/ic/am7930.c:1.53.8.1
--- src/sys/dev/ic/am7930.c:1.53	Wed Dec 28 10:04:53 2016
+++ src/sys/dev/ic/am7930.c	Fri Jun 30 06:32:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: am7930.c,v 1.53 2016/12/28 10:04:53 nat Exp $	*/
+/*	$NetBSD: am7930.c,v 1.53.8.1 2017/06/30 06:32:21 snj Exp $	*/
 
 /*
  * Copyright (c) 1995 Rolf Grossmann
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.53 2016/12/28 10:04:53 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.53.8.1 2017/06/30 06:32:21 snj Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -242,6 +242,12 @@ am7930_set_params(void *addr, int setmod
 			hw.precision *= sc->sc_glue->factor;
 			pfil->append(pfil, sc->sc_glue->output_conv, );
 		}
+		if (p->encoding == AUDIO_ENCODING_SLINEAR) {
+			hw = *p;
+			hw.encoding = AUDIO_ENCODING_ULAW;
+			pfil->append(pfil, linear8_to_mulaw, );
+		}
+
 	}
 	if ((usemode & AUMODE_RECORD) == AUMODE_RECORD) {
 		if (r->sample_rate < 7500 || r->sample_rate > 8500 ||
@@ -257,14 +263,11 @@ am7930_set_params(void *addr, int setmod
 			hw.precision *= sc->sc_glue->factor;
 			pfil->append(rfil, sc->sc_glue->input_conv, );
 		}
-	}
-
-	if (p->encoding == AUDIO_ENCODING_SLINEAR ||
-	r->encoding == AUDIO_ENCODING_SLINEAR) {
-		hw.encoding = AUDIO_ENCODING_ULAW;
-		pfil->req_size = rfil->req_size = 0;
-		pfil->append(rfil, mulaw_to_linear8, );
-		rfil->append(pfil, linear8_to_mulaw, );
+		if (r->encoding == AUDIO_ENCODING_SLINEAR) {
+			hw = *r;
+			hw.encoding = AUDIO_ENCODING_ULAW;
+			rfil->append(rfil, mulaw_to_linear8, );
+		}
 	}
 
 	return 0;



CVS commit: [netbsd-8] src/sys/dev/ic

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:32:21 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: am7930.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #68):
sys/dev/ic/am7930.c: revision 1.54
sys/dev/ic/am7930.c: revision 1.55
rfill and pfill mixed up.
--
Set hw parameters for linear to ulaw filters.
Tested by flxd@.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.8.1 src/sys/dev/ic/am7930.c

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



CVS commit: [netbsd-8] src/libexec/ld.elf_so

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:28:54 UTC 2017

Modified Files:
src/libexec/ld.elf_so [netbsd-8]: headers.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #63):
libexec/ld.elf_so/headers.c: revision 1.62
Remove old assert that only two segments exist. The rest of the code has
been changed to cope with more and at least Go actively creates them.
Adjust the mapping size computation to use the maximum and not depend on
PT_LOAD segments to be in order.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.61.8.1 src/libexec/ld.elf_so/headers.c

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



CVS commit: [netbsd-8] src/libexec/ld.elf_so

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:28:54 UTC 2017

Modified Files:
src/libexec/ld.elf_so [netbsd-8]: headers.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #63):
libexec/ld.elf_so/headers.c: revision 1.62
Remove old assert that only two segments exist. The rest of the code has
been changed to cope with more and at least Go actively creates them.
Adjust the mapping size computation to use the maximum and not depend on
PT_LOAD segments to be in order.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.61.8.1 src/libexec/ld.elf_so/headers.c

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

Modified files:

Index: src/libexec/ld.elf_so/headers.c
diff -u src/libexec/ld.elf_so/headers.c:1.61 src/libexec/ld.elf_so/headers.c:1.61.8.1
--- src/libexec/ld.elf_so/headers.c:1.61	Tue Jun 14 13:06:41 2016
+++ src/libexec/ld.elf_so/headers.c	Fri Jun 30 06:28:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: headers.c,v 1.61 2016/06/14 13:06:41 christos Exp $	 */
+/*	$NetBSD: headers.c,v 1.61.8.1 2017/06/30 06:28:54 snj Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.61 2016/06/14 13:06:41 christos Exp $");
+__RCSID("$NetBSD: headers.c,v 1.61.8.1 2017/06/30 06:28:54 snj Exp $");
 #endif /* not lint */
 
 #include 
@@ -380,8 +380,9 @@ _rtld_digest_phdr(const Elf_Phdr *phdr, 
 	Obj_Entry  *obj;
 	const Elf_Phdr *phlimit = phdr + phnum;
 	const Elf_Phdr *ph;
-	int nsegs = 0;
-	Elf_Addr	vaddr;
+	boolfirst_seg = true;
+	Elf_Addrvaddr;
+	size_t  size;
 
 	obj = _rtld_obj_new();
 
@@ -409,17 +410,16 @@ _rtld_digest_phdr(const Elf_Phdr *phdr, 
 			break;
 
 		case PT_LOAD:
-			assert(nsegs < 2);
-			if (nsegs == 0) {	/* First load segment */
+			size = round_up(vaddr + ph->p_memsz) - obj->vaddrbase;
+			if (first_seg) {	/* First load segment */
 obj->vaddrbase = round_down(vaddr);
 obj->mapbase = (caddr_t)(uintptr_t)obj->vaddrbase;
-obj->textsize = round_up(vaddr + ph->p_memsz) -
-obj->vaddrbase;
+obj->textsize = size;
+obj->mapsize = size;
+first_seg = false;
 			} else {		/* Last load segment */
-obj->mapsize = round_up(vaddr + ph->p_memsz) -
-obj->vaddrbase;
+obj->mapsize = MAX(obj->mapsize, size);
 			}
-			++nsegs;
 			dbg(("headers: %s %p phsize %" PRImemsz,
 			"PT_LOAD", (void *)(uintptr_t)vaddr,
 			 ph->p_memsz));
@@ -466,7 +466,6 @@ _rtld_digest_phdr(const Elf_Phdr *phdr, 
 #endif
 		}
 	}
-	assert(nsegs == 2);
 
 	obj->entry = entry;
 	return obj;



CVS commit: [netbsd-8] src/sys/arch

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:27:38 UTC 2017

Modified Files:
src/sys/arch/amd64/conf [netbsd-8]: XEN3_DOM0
src/sys/arch/i386/conf [netbsd-8]: XEN3_DOM0
src/sys/arch/xen/conf [netbsd-8]: files.xen

Log Message:
Pull up following revision(s) (requested by khorben in ticket #62):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.136
sys/arch/i386/conf/XEN3_DOM0: revision 1.113
sys/arch/xen/conf/files.xen: revision 1.148
Register support for SD card readers with Xen DOM0 kernels
Tested on a Lenovo ThinkPad T440s (amd64)


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.135.4.1 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.112 -r1.112.4.1 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.147 -r1.147.2.1 src/sys/arch/xen/conf/files.xen

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/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.135 src/sys/arch/amd64/conf/XEN3_DOM0:1.135.4.1
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.135	Thu Apr 20 09:56:27 2017
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Fri Jun 30 06:27:38 2017
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.135 2017/04/20 09:56:27 msaitoh Exp $
+# $NetBSD: XEN3_DOM0,v 1.135.4.1 2017/06/30 06:27:38 snj Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -797,6 +797,19 @@ wsmouse* at btmagic? mux 0
 # Bluetooth Audio support
 btsco* at bthub?
 
+
+# SD/MMC/SDIO Controller and Device support
+
+# SD/MMC controller
+sdhc*	at pci?		# SD Host Controller
+rtsx*	at pci?		# Realtek RTS5209/RTS5229 Card Reader
+#sdhc*	at cardbus?	# SD Host Controller
+sdmmc*	at sdhc?	# SD/MMC bus
+sdmmc*	at rtsx?	# SD/MMC bus
+
+ld*	at sdmmc?
+
+
 # Cryptographic Devices
 
 # PCI cryptographic devices

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.112 src/sys/arch/i386/conf/XEN3_DOM0:1.112.4.1
--- src/sys/arch/i386/conf/XEN3_DOM0:1.112	Mon Apr 17 09:54:59 2017
+++ src/sys/arch/i386/conf/XEN3_DOM0	Fri Jun 30 06:27:38 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.112 2017/04/17 09:54:59 bouyer Exp $
+#	$NetBSD: XEN3_DOM0,v 1.112.4.1 2017/06/30 06:27:38 snj Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -689,6 +689,23 @@ ieee1394if* at fwohci?
 fwip*	at ieee1394if?			# IP over IEEE1394
 sbp*	at ieee1394if? euihi ? euilo ?	# SCSI over IEEE1394
 
+
+# SD/MMC/SDIO Controller and Device support
+
+# PCI SD/MMC controller
+sdhc*	at pci?# SD Host Controller
+rtsx*	at pci?# Realtek RTS5209/RTS5229 Card Reader
+
+# CardBus SD/MMC controller
+#sdhc*	at cardbus? function ?		# SD Host Controller
+
+sdmmc*	at sdhc?			# SD/MMC bus
+sdmmc*	at rtsx?			# SD/MMC bus
+ld*	at sdmmc?
+
+
+# Audio Devices
+
 # PCI audio devices
 auacer* at pci? dev ? function ?	# ALi M5455 integrated AC'97 Audio
 auich*	at pci? dev ? function ?	# Intel ICH integrated AC'97 Audio
@@ -768,6 +785,7 @@ wsmouse* at btmagic? mux 0
 # Bluetooth Audio support
 btsco* at bthub?
 
+
 # Cryptographic Devices
 
 # PCI cryptographic devices

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.147 src/sys/arch/xen/conf/files.xen:1.147.2.1
--- src/sys/arch/xen/conf/files.xen:1.147	Tue May 23 08:48:35 2017
+++ src/sys/arch/xen/conf/files.xen	Fri Jun 30 06:27:38 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.147 2017/05/23 08:48:35 nonaka Exp $
+#	$NetBSD: files.xen,v 1.147.2.1 2017/06/30 06:27:38 snj Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -375,6 +375,8 @@ include	"compat/ossaudio/files.ossaudio"
 # Bluetooth
 include "dev/bluetooth/files.bluetooth"
 
+include "dev/sdmmc/files.sdmmc"
+
 #
 # CARDBUS
 #



CVS commit: [netbsd-8] src/sys/arch

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:27:38 UTC 2017

Modified Files:
src/sys/arch/amd64/conf [netbsd-8]: XEN3_DOM0
src/sys/arch/i386/conf [netbsd-8]: XEN3_DOM0
src/sys/arch/xen/conf [netbsd-8]: files.xen

Log Message:
Pull up following revision(s) (requested by khorben in ticket #62):
sys/arch/amd64/conf/XEN3_DOM0: revision 1.136
sys/arch/i386/conf/XEN3_DOM0: revision 1.113
sys/arch/xen/conf/files.xen: revision 1.148
Register support for SD card readers with Xen DOM0 kernels
Tested on a Lenovo ThinkPad T440s (amd64)


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.135.4.1 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.112 -r1.112.4.1 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.147 -r1.147.2.1 src/sys/arch/xen/conf/files.xen

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



CVS commit: [netbsd-8] src/sys/dev/hpc

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:25:43 UTC 2017

Modified Files:
src/sys/dev/hpc [netbsd-8]: hpckbd.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #61):
sys/dev/hpc/hpckbd.c: revision 1.31
Restore wscons keymaps feature on hpcarm
hpc ports need to alter keydesc data at runtime in order to load
alternate keymaps. But since keydesc is const initialized data, it
is mapped read only and the operation should fail.
It seems older compiler failed to enforce the read-only mapping and
this is why it used to work, but on recent NetBSD releases, the
feature is broken.
We fix it by duplicating the keydesc data once into a malloc'ed area
that can be modified.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.30.1 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30 src/sys/dev/hpc/hpckbd.c:1.30.30.1
--- src/sys/dev/hpc/hpckbd.c:1.30	Sat Oct 27 17:18:17 2012
+++ src/sys/dev/hpc/hpckbd.c	Fri Jun 30 06:25:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.30.1 2017/06/30 06:25:43 snj Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,11 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.30.1 2017/06/30 06:25:43 snj Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -264,22 +265,30 @@ hpckbd_keymap_setup(struct hpckbd_core *
 		const keysym_t *map, int mapsize)
 {
 	int i;
-	struct wscons_keydesc *desc;
+	const struct wscons_keydesc *desc;
+	static struct wscons_keydesc *ndesc = NULL;
 
-	/* fix keydesc table */
 	/* 
-	 * XXX The way this is done is really wrong.  The __UNCONST()
-	 * is a hint as to what is wrong.  This actually ends up modifying
-	 * initialized data which is marked "const".
-	 * The reason we get away with it here is apparently that text
-	 * and read-only data gets mapped read/write on the platforms
-	 * using this code.
+	 * fix keydesc table. Since it is const data, we must 
+	 * copy it once before changingg it.
 	 */
-	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
+
+	if (ndesc == NULL) {
+		size_t sz;
+
+		for (sz = 0; hpckbd_keymapdata.keydesc[sz].name != 0; sz++);
+
+		ndesc = malloc(sz * sizeof(*ndesc), M_DEVBUF, M_WAITOK);
+		memcpy(ndesc, hpckbd_keymapdata.keydesc, sz * sizeof(*ndesc));
+
+		hpckbd_keymapdata.keydesc = ndesc;
+	}
+
+	desc = hpckbd_keymapdata.keydesc;
 	for (i = 0; desc[i].name != 0; i++) {
 		if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
-			desc[i].map = map;
-			desc[i].map_size = mapsize;
+			ndesc[i].map = map;
+			ndesc[i].map_size = mapsize;
 		}
 	}
 



CVS commit: [netbsd-8] src/sys/dev/hpc

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:25:43 UTC 2017

Modified Files:
src/sys/dev/hpc [netbsd-8]: hpckbd.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #61):
sys/dev/hpc/hpckbd.c: revision 1.31
Restore wscons keymaps feature on hpcarm
hpc ports need to alter keydesc data at runtime in order to load
alternate keymaps. But since keydesc is const initialized data, it
is mapped read only and the operation should fail.
It seems older compiler failed to enforce the read-only mapping and
this is why it used to work, but on recent NetBSD releases, the
feature is broken.
We fix it by duplicating the keydesc data once into a malloc'ed area
that can be modified.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.30.1 src/sys/dev/hpc/hpckbd.c

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



CVS commit: [netbsd-8] src/sys/arch/arm/broadcom

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:23:17 UTC 2017

Modified Files:
src/sys/arch/arm/broadcom [netbsd-8]: bcm2835_emmc.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #59):
sys/arch/arm/broadcom/bcm2835_emmc.c: revision 1.30
Disable SDR50 support, it is not reliable on these boards.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.10.1 src/sys/arch/arm/broadcom/bcm2835_emmc.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_emmc.c
diff -u src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.29 src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.29.10.1
--- src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.29	Tue Feb  2 13:55:50 2016
+++ src/sys/arch/arm/broadcom/bcm2835_emmc.c	Fri Jun 30 06:23:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_emmc.c,v 1.29 2016/02/02 13:55:50 skrll Exp $	*/
+/*	$NetBSD: bcm2835_emmc.c,v 1.29.10.1 2017/06/30 06:23:17 snj Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.29 2016/02/02 13:55:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.29.10.1 2017/06/30 06:23:17 snj Exp $");
 
 #include "bcmdmac.h"
 
@@ -117,7 +117,6 @@ bcmemmc_attach(device_t parent, device_t
 	sc->sc.sc_flags |= SDHC_FLAG_NO_HS_BIT;
 	sc->sc.sc_caps = SDHC_VOLTAGE_SUPP_3_3V | SDHC_HIGH_SPEED_SUPP |
 	(SDHC_MAX_BLK_LEN_1024 << SDHC_MAX_BLK_LEN_SHIFT);
-	sc->sc.sc_caps2 = SDHC_SDR50_SUPP;
 
 	sc->sc.sc_host = sc->sc_hosts;
 	sc->sc.sc_clkbase = 5;	/* Default to 50MHz */



CVS commit: [netbsd-8] src/sys/net

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:17:51 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_gif.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #58):
sys/net/if_gif.c: revision 1.127
I have forgotten to commit this gif(4) MP-ify patch for a long time, sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.126.2.1 src/sys/net/if_gif.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_gif.c
diff -u src/sys/net/if_gif.c:1.126 src/sys/net/if_gif.c:1.126.2.1
--- src/sys/net/if_gif.c:1.126	Thu Jun  1 02:45:14 2017
+++ src/sys/net/if_gif.c	Fri Jun 30 06:17:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.126 2017/06/01 02:45:14 chs Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.126.2.1 2017/06/30 06:17:51 snj Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126 2017/06/01 02:45:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.1 2017/06/30 06:17:51 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -608,7 +608,12 @@ gif_input(struct mbuf *m, int af, struct
 		return;
 	}
 
-	if (__predict_true(pktq_enqueue(pktq, m, 0))) {
+#ifdef GIF_MPSAFE
+	const u_int h = curcpu()->ci_index;
+#else
+	const uint32_t h = pktq_rps_hash(m);
+#endif
+	if (__predict_true(pktq_enqueue(pktq, m, h))) {
 		ifp->if_ibytes += pktlen;
 		ifp->if_ipackets++;
 	} else {



CVS commit: [netbsd-8] src/sys/net

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:17:51 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_gif.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #58):
sys/net/if_gif.c: revision 1.127
I have forgotten to commit this gif(4) MP-ify patch for a long time, sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.126.2.1 src/sys/net/if_gif.c

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