CVS commit: src/usr.sbin/postinstall

2017-07-09 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Jul 10 00:27:33 UTC 2017

Modified Files:
src/usr.sbin/postinstall: postinstall

Log Message:
Add npfd to the list of rc.d scripts to check.


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/usr.sbin/postinstall/postinstall

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.215 src/usr.sbin/postinstall/postinstall:1.216
--- src/usr.sbin/postinstall/postinstall:1.215	Fri Jun 16 22:58:38 2017
+++ src/usr.sbin/postinstall/postinstall	Mon Jul 10 00:27:32 2017
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.215 2017/06/16 22:58:38 christos Exp $
+# $NetBSD: postinstall,v 1.216 2017/07/10 00:27:32 simonb Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1428,6 +1428,7 @@ newsyslog
 nfsd
 nfslocking
 npf
+npfd
 ntpd
 ntpdate
 perusertmp



CVS commit: src/sys/kern

2017-07-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul  9 22:48:44 UTC 2017

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

Log Message:
Fix vnode leak on error, introduced by the openat family changes in -r1.200.
>From mjg@freebsd.


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/sys/kern/vfs_lookup.c

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

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.207 src/sys/kern/vfs_lookup.c:1.208
--- src/sys/kern/vfs_lookup.c:1.207	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/vfs_lookup.c	Sun Jul  9 22:48:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.207 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.208 2017/07/09 22:48:44 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.207 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.208 2017/07/09 22:48:44 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -673,8 +673,10 @@ namei_start(struct namei_state *state, i
 	}
 
 	/* NDAT may feed us with a non directory namei_getstartdir */
-	if (startdir->v_type != VDIR)
+	if (startdir->v_type != VDIR) {
+		vrele(startdir);
 		return ENOTDIR;
+	}
 
 	vn_lock(startdir, LK_EXCLUSIVE | LK_RETRY);
 



CVS commit: src/tests/lib/libc/sys

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 22:18:43 UTC 2017

Modified Files:
src/tests/lib/libc/sys: t_write.c

Log Message:
add another missing munmap (Kamil)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/sys/t_write.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_write.c
diff -u src/tests/lib/libc/sys/t_write.c:1.5 src/tests/lib/libc/sys/t_write.c:1.6
--- src/tests/lib/libc/sys/t_write.c:1.5	Sun Jul  9 18:13:48 2017
+++ src/tests/lib/libc/sys/t_write.c	Sun Jul  9 18:18:43 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $ */
+/* $NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $ */
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $");
 
 #include 
 #include 
@@ -265,6 +265,7 @@ ATF_TC_BODY(read_fault, tc)
 	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
 	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
 
+	munmap(map, SIZE);
 	close(fd); 
 }
 



CVS commit: src/tests/lib/libc/sys

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 22:13:48 UTC 2017

Modified Files:
src/tests/lib/libc/sys: t_write.c

Log Message:
add munmap
#define for const.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_write.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_write.c
diff -u src/tests/lib/libc/sys/t_write.c:1.4 src/tests/lib/libc/sys/t_write.c:1.5
--- src/tests/lib/libc/sys/t_write.c:1.4	Sun Jul  9 18:04:04 2017
+++ src/tests/lib/libc/sys/t_write.c	Sun Jul  9 18:13:48 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $ */
+/* $NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $ */
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.5 2017/07/09 22:13:48 christos Exp $");
 
 #include 
 #include 
@@ -223,20 +223,23 @@ ATF_TC_HEAD(write_fault, tc)
 	"Check that writing to non-permitted space returns EFAULT");
 }
 
+#define SIZE 8192
+
 ATF_TC_BODY(write_fault, tc)
 {
 	int fd[2];
 	ATF_REQUIRE(pipe(fd) != -1);
 	// Can't use /dev/null cause it doesn't access the buffer.
 
-	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	void *map = mmap(NULL, SIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
 	ATF_REQUIRE(map != MAP_FAILED);
 
-	ssize_t retval = write(fd[1], map, 8192); 
+	ssize_t retval = write(fd[1], map, SIZE); 
 
 	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
 	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
 
+	munmap(map, SIZE);
 	close(fd[0]); 
 	close(fd[1]); 
 }
@@ -254,10 +257,10 @@ ATF_TC_BODY(read_fault, tc)
 	int fd = open(_PATH_DEVZERO, O_RDONLY);
 	ATF_REQUIRE(fd != -1);
 
-	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	void *map = mmap(NULL, SIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
 	ATF_REQUIRE(map != MAP_FAILED);
 
-	ssize_t retval = read(fd, map, 8192); 
+	ssize_t retval = read(fd, map, SIZE); 
 
 	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
 	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));



CVS commit: src/tests/lib/libc/sys

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 22:04:04 UTC 2017

Modified Files:
src/tests/lib/libc/sys: t_write.c

Log Message:
check for EFAULT on reads and writes to memory with not permission.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_write.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_write.c
diff -u src/tests/lib/libc/sys/t_write.c:1.3 src/tests/lib/libc/sys/t_write.c:1.4
--- src/tests/lib/libc/sys/t_write.c:1.3	Fri Jan 13 14:27:23 2017
+++ src/tests/lib/libc/sys/t_write.c	Sun Jul  9 18:04:04 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $ */
+/* $NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $ */
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,9 +29,10 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_write.c,v 1.3 2017/01/13 19:27:23 christos Exp $");
+__RCSID("$NetBSD: t_write.c,v 1.4 2017/07/09 22:04:04 christos Exp $");
 
 #include 
+#include 
 
 #include 
 #include 
@@ -42,6 +43,7 @@ __RCSID("$NetBSD: t_write.c,v 1.3 2017/0
 #include 
 #include 
 #include 
+#include 
 
 static void		 sighandler(int);
 
@@ -213,6 +215,56 @@ ATF_TC_BODY(writev_iovmax, tc)
 	ATF_REQUIRE_EQ_MSG(errno, EINVAL, "got: %s", strerror(errno));
 }
 
+ATF_TC(write_fault);
+
+ATF_TC_HEAD(write_fault, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Check that writing to non-permitted space returns EFAULT");
+}
+
+ATF_TC_BODY(write_fault, tc)
+{
+	int fd[2];
+	ATF_REQUIRE(pipe(fd) != -1);
+	// Can't use /dev/null cause it doesn't access the buffer.
+
+	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	ATF_REQUIRE(map != MAP_FAILED);
+
+	ssize_t retval = write(fd[1], map, 8192); 
+
+	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
+	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
+
+	close(fd[0]); 
+	close(fd[1]); 
+}
+
+ATF_TC(read_fault);
+
+ATF_TC_HEAD(read_fault, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Check that reading from non-permitted space returns EFAULT");
+}
+
+ATF_TC_BODY(read_fault, tc)
+{
+	int fd = open(_PATH_DEVZERO, O_RDONLY);
+	ATF_REQUIRE(fd != -1);
+
+	void *map = mmap(NULL, 8192, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);  
+	ATF_REQUIRE(map != MAP_FAILED);
+
+	ssize_t retval = read(fd, map, 8192); 
+
+	ATF_REQUIRE_EQ_MSG(retval, -1, "got: %zd", retval);
+	ATF_REQUIRE_EQ_MSG(errno, EFAULT, "got: %s", strerror(errno));
+
+	close(fd); 
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -221,6 +273,8 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, write_pos);
 	ATF_TP_ADD_TC(tp, write_ret);
 	ATF_TP_ADD_TC(tp, writev_iovmax);
+	ATF_TP_ADD_TC(tp, write_fault);
+	ATF_TP_ADD_TC(tp, read_fault);
 
 	return atf_no_error();
 }



CVS commit: src/sys/uvm

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 20:53:09 UTC 2017

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
PR/52384: make uvm_fault_check() return EFAULT not EACCES, like our man pages
(but not OpenGroup which does not document EFAULT for read/write, and only
documents EACCES for sockets) say for read/write.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/uvm/uvm_fault.c

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

Modified files:

Index: src/sys/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.199 src/sys/uvm/uvm_fault.c:1.200
--- src/sys/uvm/uvm_fault.c:1.199	Mon Mar 20 11:51:41 2017
+++ src/sys/uvm/uvm_fault.c	Sun Jul  9 16:53:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.199 2017/03/20 15:51:41 skrll Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.200 2017/07/09 20:53:09 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.199 2017/03/20 15:51:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.200 2017/07/09 20:53:09 christos Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -950,7 +950,7 @@ uvm_fault_check(
 		"<- protection failure (prot=%#x, access=%#x)",
 		ufi->entry->protection, flt->access_type, 0, 0);
 		uvmfault_unlockmaps(ufi, false);
-		return EACCES;
+		return EFAULT;
 	}
 
 	/*



CVS commit: src/lib/libpthread

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 20:21:08 UTC 2017

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

Log Message:
PR/52386: Use the number of iterations we document.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libpthread/pthread_tsd.c

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

Modified files:

Index: src/lib/libpthread/pthread_tsd.c
diff -u src/lib/libpthread/pthread_tsd.c:1.15 src/lib/libpthread/pthread_tsd.c:1.16
--- src/lib/libpthread/pthread_tsd.c:1.15	Tue Aug 25 09:46:23 2015
+++ src/lib/libpthread/pthread_tsd.c	Sun Jul  9 16:21:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_tsd.c,v 1.15 2015/08/25 13:46:23 pooka Exp $	*/
+/*	$NetBSD: pthread_tsd.c,v 1.16 2017/07/09 20:21:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_tsd.c,v 1.15 2015/08/25 13:46:23 pooka Exp $");
+__RCSID("$NetBSD: pthread_tsd.c,v 1.16 2017/07/09 20:21:08 christos Exp $");
 
 /* Functions and structures dealing with thread-specific data */
 #include 
@@ -332,7 +332,8 @@ pthread__destroy_tsd(pthread_t self)
 	 * a while.''
 	 */
 
-	iterations = 4; /* We're not required to try very hard */
+	/* We're not required to try very hard */
+	iterations = PTHREAD_DESTRUCTOR_ITERATIONS;
 	do {
 		done = 1;
 		for (i = 0; i < pthread_keys_max; i++) {
@@ -356,7 +357,7 @@ pthread__destroy_tsd(pthread_t self)
 (*destructor)(val);
 			}
 		}
-	} while (!done && iterations--);
+	} while (!done && --iterations);
 
 	self->pt_havespecific = 0;
 	pthread_mutex_lock(>pt_lock);



CVS commit: src/sys/dev/usb

2017-07-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  9 19:37:34 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
PR/52385: Shinichi Doyashiki: some classic Roland product-ids for usbdevs
While here, add a Ralink that I had uncommitted and fix some caps hex to
small for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.737 -r1.738 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.737 src/sys/dev/usb/usbdevs:1.738
--- src/sys/dev/usb/usbdevs:1.737	Mon Jun 26 16:28:42 2017
+++ src/sys/dev/usb/usbdevs	Sun Jul  9 15:37:33 2017
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.737 2017/06/26 20:28:42 is Exp $
+$NetBSD: usbdevs,v 1.738 2017/07/09 19:37:33 christos Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2725,6 +2725,7 @@ product RALINK RT2570		0x1706	RT2570
 product RALINK RT2070		0x2070	RT2070
 product RALINK RT2570_2		0x2570	RT2570
 product RALINK RT2573		0x2573	RT2573
+product RALINK RT73		0x2578	RT73
 product RALINK RT2671		0x2671	RT2671
 product RALINK RT2770		0x2770	RT2770
 product RALINK RT2870		0x2870	RT2870
@@ -2822,9 +2823,12 @@ product ROLAND PC50		0x008c	EDIROL PC-50
 product ROLAND UA101F		0x008d	EDIROL UA-101 USB1
 product ROLAND UA1EX		0x0096	EDIROL UA-1EX
 product ROLAND UM3		0x009A	EDIROL UM-3
-product ROLAND UA4FX 		0x00A3	EDIROL UA-4FX
-product ROLAND SONICCELL	0x00C2	SonicCell
+product ROLAND UA4FX 		0x00a3	EDIROL UA-4FX
+product ROLAND SONICCELL	0x00c2	SonicCell
+product ROLAND UA25EXA		0x00e6	EDIROL UA-25EX (advanced)
+product ROLAND UA25EX		0x00e7	EDIROL UA-25EX
 product ROLAND UMONE		0x012a	UM-ONE MIDI I/F
+product ROLAND QUADCAPTURE	0x012f	QUAD-CAPTURE
 
 /* RT Systems products */
 product RTSYS CT57A		0x9e51	CT57A Radio Cable



CVS commit: src/libexec/ld.elf_so

2017-07-09 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jul  9 17:57:59 UTC 2017

Modified Files:
src/libexec/ld.elf_so: rtld.h

Log Message:
Drop comments about symbol exporting, the relevant code is gone.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/libexec/ld.elf_so/rtld.h

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/rtld.h
diff -u src/libexec/ld.elf_so/rtld.h:1.127 src/libexec/ld.elf_so/rtld.h:1.128
--- src/libexec/ld.elf_so/rtld.h:1.127	Mon Jun 19 11:57:01 2017
+++ src/libexec/ld.elf_so/rtld.h	Sun Jul  9 17:57:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.h,v 1.127 2017/06/19 11:57:01 joerg Exp $	 */
+/*	$NetBSD: rtld.h,v 1.128 2017/07/09 17:57:59 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -345,8 +345,6 @@ extern Elf_Sym _rtld_sym_zero;
 #define	RTLD_STATIC_TLS_RESERVATION	64
 
 /* rtld.c */
-
-/* We export these symbols using _rtld_symbol_lookup and is_exported. */
 __dso_public char *dlerror(void);
 __dso_public void *dlopen(const char *, int);
 __dso_public void *dlsym(void *, const char *);
@@ -416,7 +414,6 @@ Elf_Addr _rtld_resolve_ifunc(const Obj_E
 Obj_Entry *_rtld_load_library(const char *, const Obj_Entry *, int);
 
 /* symbol.c */
-bool _rtld_is_exported(const Elf_Sym *);
 unsigned long _rtld_elf_hash(const char *);
 const Elf_Sym *_rtld_symlook_obj(const char *, unsigned long,
 const Obj_Entry *, u_int, const Ver_Entry *);



CVS commit: src/sys/arch/x68k/dev

2017-07-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Jul  9 12:49:26 UTC 2017

Modified Files:
src/sys/arch/x68k/dev: vs.c

Log Message:
Catch up vs_set_params() to recent MI audio (after in-kernel mixer).
Before that, MD part had to support all encodings I'd like to support,
but currently it's no longer necessary.  The hardware is
4bit/1ch/15.6kHz ADPCM but it behaves as 16bit/1ch/16.0kHz PCM.

For audio.c < 1.362, the device attach succeeded and playback is
still working.
For audio.c >= 1.363, the device attach fails again.
It does not work yet but I commit it for milestone.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/x68k/dev/vs.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/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.38 src/sys/arch/x68k/dev/vs.c:1.39
--- src/sys/arch/x68k/dev/vs.c:1.38	Sun Jun 25 06:26:40 2017
+++ src/sys/arch/x68k/dev/vs.c	Sun Jul  9 12:49:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.38 2017/06/25 06:26:40 isaki Exp $	*/
+/*	$NetBSD: vs.c,v 1.39 2017/07/09 12:49:26 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.38 2017/06/25 06:26:40 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.39 2017/07/09 12:49:26 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -160,19 +160,6 @@ struct {
 
 #define NUM_RATE	(sizeof(vs_l2r)/sizeof(vs_l2r[0]))
 
-struct {
-	const char *name;
-	int	encoding;
-	int	precision;
-} vs_encodings[] = {
-	{AudioEadpcm,  AUDIO_ENCODING_ADPCM,   4},
-	{AudioEslinear,AUDIO_ENCODING_SLINEAR, 8},
-	{AudioEulinear,AUDIO_ENCODING_ULINEAR, 8},
-	{AudioEmulaw,  AUDIO_ENCODING_ULAW,	   8},
-	{AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16},
-	{AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16},
-};
-
 static int
 vs_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -338,17 +325,15 @@ vs_query_encoding(void *hdl, struct audi
 {
 
 	DPRINTF(1, ("vs_query_encoding\n"));
-	if (fp->index >= sizeof(vs_encodings) / sizeof(vs_encodings[0]))
-		return EINVAL;
 
-	strcpy(fp->name, vs_encodings[fp->index].name);
-	fp->encoding  = vs_encodings[fp->index].encoding;
-	fp->precision = vs_encodings[fp->index].precision;
-	if (fp->encoding == AUDIO_ENCODING_ADPCM)
+	if (fp->index == 0) {
+		strcpy(fp->name, AudioEslinear_be);
+		fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
+		fp->precision = 16;
 		fp->flags = 0;
-	else
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-	return 0;
+		return 0;
+	}
+	return EINVAL;
 }
 
 static int
@@ -385,95 +370,48 @@ vs_set_params(void *hdl, int setmode, in
 	stream_filter_list_t *pfil, stream_filter_list_t *rfil)
 {
 	struct vs_softc *sc;
-	struct audio_params *p;
-	int mode;
 	int rate;
-	audio_params_t hw;
-	int matched;
-
-	DPRINTF(1, ("vs_set_params: setmode=%d, usemode=%d\n",
-		setmode, usemode));
 
 	sc = hdl;
-	/* set first record info, then play info */
-	for (mode = AUMODE_RECORD; mode != -1;
-	 mode = (mode == AUMODE_RECORD) ? AUMODE_PLAY : -1) {
-		if ((setmode & mode) == 0)
-			continue;
-
-		p = (mode == AUMODE_PLAY) ? play : rec;
-
-		if (p->channels != 1)
-			return EINVAL;
-
-		rate = p->sample_rate;
-		hw = *p;
-		hw.encoding = AUDIO_ENCODING_ADPCM;
-		hw.precision = hw.validbits = 4;
-		DPRINTF(1, ("vs_set_params: encoding=%d, precision=%d\n",
-			p->encoding, p->precision));
-		matched = 0;
-		switch (p->precision) {
-		case 4:
-			if (p->encoding == AUDIO_ENCODING_ADPCM)
-matched = 1;
-			break;
-		case 8:
-			switch (p->encoding) {
-			case AUDIO_ENCODING_ULAW:
-matched = 1;
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-hw.precision = hw.validbits = 8;
-pfil->prepend(pfil, mulaw_to_linear8, );
-hw.encoding = AUDIO_ENCODING_ADPCM;
-hw.precision = hw.validbits = 4;
-pfil->prepend(pfil, msm6258_linear8_to_adpcm, );
-rfil->append(rfil, msm6258_adpcm_to_linear8, );
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-hw.precision = hw.validbits = 8;
-rfil->append(rfil, linear8_to_mulaw, );
-break;
-			case AUDIO_ENCODING_SLINEAR:
-			case AUDIO_ENCODING_SLINEAR_LE:
-			case AUDIO_ENCODING_SLINEAR_BE:
-			case AUDIO_ENCODING_ULINEAR:
-			case AUDIO_ENCODING_ULINEAR_LE:
-			case AUDIO_ENCODING_ULINEAR_BE:
-matched = 1;
-pfil->append(pfil, msm6258_linear8_to_adpcm, );
-rfil->append(rfil, msm6258_adpcm_to_linear8, );
-break;
-			}
-			break;
-		case 16:
-			switch (p->encoding) {
-			case AUDIO_ENCODING_SLINEAR_LE:
-			case AUDIO_ENCODING_SLINEAR_BE:
-matched = 1;
-pfil->append(pfil, msm6258_slinear16_to_adpcm, );
-rfil->append(rfil, msm6258_adpcm_to_slinear16, );
-break;
-			}
-			break;
-		}
-		if (matched == 0) {
-			DPRINTF(1, ("vs_set_params: mode=%d, encoding=%d\n",
-mode, p->encoding));
-			return EINVAL;
-		}
 
-		DPRINTF(1, ("vs_set_params: rate=%d -> ", 

CVS commit: src/sys/dev

2017-07-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Jul  9 12:08:39 UTC 2017

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

Log Message:
Fix division by zero when precision < 8 in ifdef AUDIO_INTR_TIME.


To generate a diff of this commit:
cvs rdiff -u -r1.367 -r1.368 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.367 src/sys/dev/audio.c:1.368
--- src/sys/dev/audio.c:1.367	Sat Jul  1 05:44:52 2017
+++ src/sys/dev/audio.c	Sun Jul  9 12:08:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.367 2017/07/01 05:44:52 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.367 2017/07/01 05:44:52 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.368 2017/07/09 12:08:39 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2068,9 +2068,9 @@ audio_initbufs(struct audio_softc *sc, s
 		sc->sc_pnintr = 0;
 		sc->sc_pblktime = (u_long)(
 		(double)vc->sc_mpr.blksize * 10 /
-		(double)(vc->sc_pparams.precision / NBBY *
-			 vc->sc_pparams.channels *
-			 vc->sc_pparams.sample_rate)) * 10;
+		(double)(vc->sc_pparams.channels *
+		 vc->sc_pparams.sample_rate *
+		 vc->sc_pparams.precision / NBBY)) * 10;
 		DPRINTF(("audio: play blktime = %lu for %d\n",
 			 sc->sc_pblktime, vc->sc_mpr.blksize));
 	}
@@ -2078,9 +2078,9 @@ audio_initbufs(struct audio_softc *sc, s
 		sc->sc_rnintr = 0;
 		sc->sc_rblktime = (u_long)(
 		(double)vc->sc_mrr.blksize * 10 /
-		(double)(vc->sc_rparams.precision / NBBY *
-			 vc->sc_rparams.channels *
-			 vc->sc_rparams.sample_rate)) * 10;
+		(double)(vc->sc_rparams.channels *
+		 vc->sc_rparams.sample_rate *
+		 vc->sc_rparams.precision / NBBY)) * 10;
 		DPRINTF(("audio: record blktime = %lu for %d\n",
 			 sc->sc_rblktime, vc->sc_mrr.blksize));
 	}



CVS commit: src/distrib/utils/embedded/conf

2017-07-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  9 10:41:40 UTC 2017

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf

Log Message:
Add : to body of populate_sunxi to appease bash.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/distrib/utils/embedded/conf/armv7.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.14 src/distrib/utils/embedded/conf/armv7.conf:1.15
--- src/distrib/utils/embedded/conf/armv7.conf:1.14	Thu Jul  6 21:07:09 2017
+++ src/distrib/utils/embedded/conf/armv7.conf	Sun Jul  9 10:41:40 2017
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.14 2017/07/06 21:07:09 jmcneill Exp $
+# $NetBSD: armv7.conf,v 1.15 2017/07/09 10:41:40 jmcneill Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -107,6 +107,7 @@ EOF
 }
 
 populate_sunxi() {
+	:
 }
 
 populate_tegra() {



CVS commit: src/share/man/man4

2017-07-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  9 06:37:34 UTC 2017

Modified Files:
src/share/man/man4: zstty.4

Log Message:
Briefly sync device names in FILES section with reality.  PR/52377

Also add several ports which use zs(4)/zsc(4) and zstty(4) in SYNOPSIS.

XXX:
scc(4) man page for pmax (and alpha?) in SEE ALSO section should be
obsolete since they have been switched to using MI zs(4) in NetBSD 4.x.
(though scc(4) man page seems to contain some pmax/ioasic specific notes)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/zstty.4

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

Modified files:

Index: src/share/man/man4/zstty.4
diff -u src/share/man/man4/zstty.4:1.14 src/share/man/man4/zstty.4:1.15
--- src/share/man/man4/zstty.4:1.14	Tue Jun  7 20:22:56 2011
+++ src/share/man/man4/zstty.4	Sun Jul  9 06:37:34 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: zstty.4,v 1.14 2011/06/07 20:22:56 wiz Exp $
+.\"	$NetBSD: zstty.4,v 1.15 2017/07/09 06:37:34 tsutsui Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 7, 2011
+.Dd July 9, 2017
 .Dt ZSTTY 4
 .Os
 .Sh NAME
@@ -54,6 +54,14 @@ and
 .Ss cesfic
 .Cd "zsc*	at mainbus0"
 .Cd "zstty*	at zsc? channel ?"
+.Ss cobalt
+.Cd "zsc0	at mainbus? addr 0x1c80 irq 4"
+.Cd "zstty0	at zsc0 channel 0"
+.Cd "zstty1	at zsc0 channel 1"
+.Ss ews4800mips
+.Cd "zsc0	at sbdio?"
+.Cd "zstty0	at zsc? channel 0	# SIO ch-A"
+.Cd "zstty1	at zsc? channel 1	# SIO ch-B"
 .Ss mac68k and macppc
 .Cd "zsc0	at obio?"
 .Cd "zstty*	at zsc? channel ?"
@@ -85,8 +93,14 @@ and
 .Ss next68k
 .Cd "zsc0	at intio? ipl 5"
 .Cd "#zsc1	at intio? ipl 5"
-.Cd "zstty0	at zsc0 channel 0	# ttya"
-.Cd "zstty1	at zsc0 channel 1	# ttyb"
+.Cd "zstty0	at zsc0 channel 0	# Serial Port A"
+.Cd "zstty1	at zsc0 channel 1	# Serial Port B"
+.Ss pmax
+.Cd "zsc0	at	ioasic? offset 0x10 # Z85C30"
+.Cd "zsc1	at	ioasic? offset 0x18 # Z85C30"
+.Cd "zstty*	at	zsc? channel ?		# serial ports on B/A channels"
+.Cd "lkkbd*	at	zsc1 channel ?		# keyboard port on A channels"
+.Cd "vsms*	at	zsc0 channel ?		# mouse port on A channels"
 .Ss sgimips
 .Cd "zsc* 	at hpc0 offset ?"
 .Cd "zstty*	at zsc? channel ?"
@@ -106,6 +120,12 @@ and
 .Cd "zs2	at obio0 addr 0xe000 level 12	# sun4/300"
 .Cd "zstty2	at zs2 channel 0			# ttyc"
 .Cd "zstty3	at zs2 channel 1			# ttyd"
+.Ss sparc64
+.Cd "zs*	at sbus? slot ? offset ?"
+.Cd "zs*	at fhc?"
+.Cd "zstty*	at zs? channel ?			# ttys"
+.Cd "kbd0	at zstty?"
+.Cd "ms0	at zstty?"
 .Ss sun2
 .Cd "zs0	at obio0 addr 0x002000	# 2/120, 2/170"
 .Cd "zs1	at obmem0 addr 0x78	# 2/120, 2/170"
@@ -169,10 +189,29 @@ for more discussion.
 .It Pa /dev/ttyB0
 .It Pa /dev/ttyB1
 .El
-.Ss others
+.Ss pmax
+.Bl -tag -width Pa
+.It Pa /dev/ttya
+.It Pa /dev/ttyb
+.It Pa /dev/ttyc
+.It Pa /dev/ttyd
+.El
+.Ss sparc
 .Bl -tag -width Pa
 .It Pa /dev/ttya
 .It Pa /dev/ttyb
+.It Pa /dev/ttyc
+.It Pa /dev/ttyd
+.El
+.Ss sparc64, sun2, sun3
+.Bl -tag -width Pa
+.It Pa /dev/ttya
+.It Pa /dev/ttyb
+.El
+.Ss others
+.Bl -tag -width Pa
+.It Pa /dev/ttyZ0
+.It Pa /dev/ttyZ1
 .El
 .Sh DIAGNOSTICS
 .Bl -tag -width indent



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

2017-07-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jul  9 06:02:37 UTC 2017

Modified Files:
src/sys/arch/next68k/conf: GENERIC SLAB

Log Message:
Clarify serial port names.  Affects zs(4) man page mentioned in PR/52377.

Actual port connection is briefly checked by "NeXT cube internal schematics"
 
http://web.archive.org/web/20091015214305/http://www.lrz-muenchen.de/~heller/NeXT/NeXT.html


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/next68k/conf/SLAB

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/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.140 src/sys/arch/next68k/conf/GENERIC:1.141
--- src/sys/arch/next68k/conf/GENERIC:1.140	Sat Aug  8 06:36:25 2015
+++ src/sys/arch/next68k/conf/GENERIC	Sun Jul  9 06:02:37 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.140 2015/08/08 06:36:25 maxv Exp $
+# $NetBSD: GENERIC,v 1.141 2017/07/09 06:02:37 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.140 $"
+#ident 		"GENERIC-$Revision: 1.141 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -214,8 +214,8 @@ esp0	at intio? ipl 3	flags 0x00	# Tu
 #
 # Serial ports
 #
-zstty0	at zsc0 channel 0	# ttya
-zstty1	at zsc0 channel 1	# ttyb
+zstty0	at zsc0 channel 0	# Serial Port A
+zstty1	at zsc0 channel 1	# Serial Port B
 
 # SCSI bus support
 scsibus* at scsi?

Index: src/sys/arch/next68k/conf/SLAB
diff -u src/sys/arch/next68k/conf/SLAB:1.55 src/sys/arch/next68k/conf/SLAB:1.56
--- src/sys/arch/next68k/conf/SLAB:1.55	Fri Aug 21 01:52:08 2015
+++ src/sys/arch/next68k/conf/SLAB	Sun Jul  9 06:02:37 2017
@@ -1,4 +1,4 @@
-# $NetBSD: SLAB,v 1.55 2015/08/21 01:52:08 uebayasi Exp $
+# $NetBSD: SLAB,v 1.56 2017/07/09 06:02:37 tsutsui Exp $
 #
 # deberg's development machine
 #
@@ -164,8 +164,8 @@ esp0	at intio? ipl 3	flags 0xff00	# Turn
 #
 # Serial ports
 #
-zstty0	at zsc0 channel 0	# ttya
-zstty1	at zsc0 channel 1	# ttyb
+zstty0	at zsc0 channel 0	# Serial Port A
+zstty1	at zsc0 channel 1	# Serial Port B
 
 # SCSI bus support
 scsibus* at scsi?