CVS commit: src/tests/net/net

2015-11-23 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Nov 24 02:37:33 UTC 2015

Modified Files:
src/tests/net/net: t_forwarding.sh

Log Message:
Add fastforward6 test


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/net/net/t_forwarding.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/net/t_forwarding.sh
diff -u src/tests/net/net/t_forwarding.sh:1.9 src/tests/net/net/t_forwarding.sh:1.10
--- src/tests/net/net/t_forwarding.sh:1.9	Tue Sep 29 08:27:24 2015
+++ src/tests/net/net/t_forwarding.sh	Tue Nov 24 02:37:33 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_forwarding.sh,v 1.9 2015/09/29 08:27:24 ozaki-r Exp $
+#	$NetBSD: t_forwarding.sh,v 1.10 2015/11/24 02:37:33 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -48,6 +48,7 @@ TIMEOUT=5
 atf_test_case basic cleanup
 atf_test_case basic6 cleanup
 atf_test_case fastforward cleanup
+atf_test_case fastforward6 cleanup
 
 basic_head()
 {
@@ -159,19 +160,21 @@ setup6()
 
 setup_bozo()
 {
+	local ip=$1
 
 	export RUMP_SERVER=$SOCKDST
 
 	touch $HTML_FILE
 	# start bozo in daemon mode
 	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
-	/usr/libexec/httpd -P $HTTPD_PID -i $IP4DST -b -s $(pwd)
+	/usr/libexec/httpd -P $HTTPD_PID -i $ip -b -s $(pwd)
 
 	$DEBUG && rump.netstat -a
 }
 
 test_http_get()
 {
+	local ip=$1
 
 	export RUMP_SERVER=$SOCKFWD
 	atf_check -s exit:0 rump.arp -d -a
@@ -180,7 +183,7 @@ test_http_get()
 
 	# get the webpage
 	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so 	\
-	ftp -q $TIMEOUT -o out http://$IP4DST/$HTML_FILE
+	ftp -q $TIMEOUT -o out http://$ip/$HTML_FILE
 }
 
 test_setup()
@@ -410,8 +413,20 @@ fastforward_body()
 	setup_forwarding
 	test_setup_forwarding
 
-	setup_bozo
-	test_http_get
+	setup_bozo $IP4DST
+	test_http_get $IP4DST
+}
+
+fastforward6_body()
+{
+	setup6
+	test_setup6
+
+	setup_forwarding6
+	test_setup_forwarding6
+
+	setup_bozo $IP6DST
+	test_http_get "[$IP6DST]"
 }
 
 basic_cleanup()
@@ -433,9 +448,17 @@ fastforward_cleanup()
 	cleanup
 }
 
+fastforward6_cleanup()
+{
+	dump
+	cleanup_bozo
+	cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case basic
 	atf_add_test_case basic6
 	atf_add_test_case fastforward
+	atf_add_test_case fastforward6
 }



CVS commit: src/lib/libcurses

2015-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 24 01:59:33 UTC 2015

Modified Files:
src/lib/libcurses: setterm.c

Log Message:
PR/50092: don't leak screen on multiple setterms.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libcurses/setterm.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/libcurses/setterm.c
diff -u src/lib/libcurses/setterm.c:1.52 src/lib/libcurses/setterm.c:1.53
--- src/lib/libcurses/setterm.c:1.52	Wed Oct 16 15:59:29 2013
+++ src/lib/libcurses/setterm.c	Mon Nov 23 20:59:32 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: setterm.c,v 1.52 2013/10/16 19:59:29 roy Exp $	*/
+/*	$NetBSD: setterm.c,v 1.53 2015/11/24 01:59:32 christos Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setterm.c	8.8 (Berkeley) 10/25/94";
 #else
-__RCSID("$NetBSD: setterm.c,v 1.52 2013/10/16 19:59:29 roy Exp $");
+__RCSID("$NetBSD: setterm.c,v 1.53 2015/11/24 01:59:32 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -69,6 +69,8 @@ _cursesi_setterm(char *type, SCREEN *scr
 	if (type[0] == '\0')
 		type = "xx";
 	unknown = 0;
+	if (screen->term)
+		del_curterm(screen->term);
 	(void)ti_setupterm(&screen->term, type, fileno(screen->outfd), &r);
 	if (screen->term == NULL) {
 		unknown++;



CVS commit: src/sys/dev/filemon

2015-11-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Nov 24 01:05:51 UTC 2015

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

Log Message:
Add missing /* $NetBSD$ */ keyword


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/filemon/filemon.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/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.20 src/sys/dev/filemon/filemon.c:1.21
--- src/sys/dev/filemon/filemon.c:1.20	Tue Nov 24 01:01:42 2015
+++ src/sys/dev/filemon/filemon.c	Tue Nov 24 01:05:50 2015
@@ -1,3 +1,4 @@
+/*  $NetBSD: filemon.c,v 1.21 2015/11/24 01:05:50 pgoyette Exp $ */
 /*
  * Copyright (c) 2010, Juniper Networks, Inc.
  *
@@ -24,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.20 2015/11/24 01:01:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.21 2015/11/24 01:05:50 pgoyette Exp $");
 
 #include 
 #include 



CVS commit: src/sys/dev/filemon

2015-11-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Nov 24 01:01:42 UTC 2015

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

Log Message:
finish previous - remove no-longer-used variables


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/filemon/filemon.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/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.19 src/sys/dev/filemon/filemon.c:1.20
--- src/sys/dev/filemon/filemon.c:1.19	Mon Nov 23 23:27:38 2015
+++ src/sys/dev/filemon/filemon.c	Tue Nov 24 01:01:42 2015
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.19 2015/11/23 23:27:38 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.20 2015/11/24 01:01:42 pgoyette Exp $");
 
 #include 
 #include 
@@ -278,7 +278,7 @@ filemon_ioctl(struct file * fp, u_long c
 {
 	int error = 0;
 	struct filemon *filemon;
-	struct proc *tp, *lp, *p;
+	struct proc *tp;
 
 #ifdef DEBUG
 	log(logLevel, "filemon_ioctl(%lu)", cmd);;



CVS commit: src/sys/external/isc/atheros_hal/dist/ar5210

2015-11-23 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Nov 23 23:46:33 UTC 2015

Modified Files:
src/sys/external/isc/atheros_hal/dist/ar5210: ar5210_reset.c

Log Message:
Replace left shifts of negative values with appropiate unsigned values.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/isc/atheros_hal/dist/ar5210/ar5210_reset.c

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

Modified files:

Index: src/sys/external/isc/atheros_hal/dist/ar5210/ar5210_reset.c
diff -u src/sys/external/isc/atheros_hal/dist/ar5210/ar5210_reset.c:1.5 src/sys/external/isc/atheros_hal/dist/ar5210/ar5210_reset.c:1.6
--- src/sys/external/isc/atheros_hal/dist/ar5210/ar5210_reset.c:1.5	Mon Mar  7 11:25:42 2011
+++ src/sys/external/isc/atheros_hal/dist/ar5210/ar5210_reset.c	Mon Nov 23 23:46:33 2015
@@ -14,7 +14,7 @@
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: ar5210_reset.c,v 1.5 2011/03/07 11:25:42 cegger Exp $
+ * $Id: ar5210_reset.c,v 1.6 2015/11/23 23:46:33 joerg Exp $
  */
 #include "opt_ah.h"
 
@@ -500,11 +500,11 @@ ar5210PerCalibrationN(struct ath_hal *ah
 	reg9868 = OS_REG_READ(ah, 0x9868);
 
 	OS_REG_WRITE(ah, 0x9858, (reg9858 & ~FIRPWR_M) |
-	 ((-1 << FIRPWR_S) & FIRPWR_M));
+	 ((~0U << FIRPWR_S) & FIRPWR_M));
 	OS_REG_WRITE(ah, 0x985c,
 		 (reg985c & ~(KCOARSEHIGH_M | KCOARSELOW_M)) |
-		 ((-1 << KCOARSEHIGH_S) & KCOARSEHIGH_M) |
-		 ((-127 << KCOARSELOW_S) & KCOARSELOW_M));
+		 ((~0U << KCOARSEHIGH_S) & KCOARSEHIGH_M) |
+		 ~0U << 7) + 1) << KCOARSELOW_S)) & KCOARSELOW_M));
 	OS_REG_WRITE(ah, 0x9868,
 		 (reg9868 & ~(ADCSAT_ICOUNT_M | ADCSAT_THRESH_M)) |
 		 ((2 << ADCSAT_ICOUNT_S) & ADCSAT_ICOUNT_M) |



CVS commit: src/sys/kern

2015-11-23 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Nov 23 23:45:44 UTC 2015

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

Log Message:
Cast argument to uint64_t first before shifting to avoid UB for
left-shifting negative values.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/kern/kern_ntptime.c

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

Modified files:

Index: src/sys/kern/kern_ntptime.c
diff -u src/sys/kern/kern_ntptime.c:1.56 src/sys/kern/kern_ntptime.c:1.57
--- src/sys/kern/kern_ntptime.c:1.56	Fri Jul 24 13:02:52 2015
+++ src/sys/kern/kern_ntptime.c	Mon Nov 23 23:45:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ntptime.c,v 1.56 2015/07/24 13:02:52 maxv Exp $	*/
+/*	$NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.56 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -99,7 +99,7 @@ typedef int64_t l_fp;
 #define L_MPY(v, a)	((v) *= (a))
 #define L_CLR(v)	((v) = 0)
 #define L_ISNEG(v)	((v) < 0)
-#define L_LINT(v, a)	((v) = (int64_t)(a) << 32)
+#define L_LINT(v, a)	((v) = (int64_t)((uint64_t)(a) << 32))
 #define L_GINT(v)	((v) < 0 ? -(-(v) >> 32) : (v) >> 32)
 
 #ifdef NTP



CVS commit: src/share/man/man4

2015-11-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Nov 23 23:28:33 UTC 2015

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

Log Message:
It is no longer required that the target process be a descendant of the
tracking process.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/filemon.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/filemon.4
diff -u src/share/man/man4/filemon.4:1.14 src/share/man/man4/filemon.4:1.15
--- src/share/man/man4/filemon.4:1.14	Mon Nov 23 23:00:29 2015
+++ src/share/man/man4/filemon.4	Mon Nov 23 23:28:33 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: filemon.4,v 1.14 2015/11/23 23:00:29 pgoyette Exp $
+.\"	$NetBSD: filemon.4,v 1.15 2015/11/23 23:28:33 pgoyette Exp $
 .\"
 .\" Copyright (c) 2011, Juniper Networks, Inc.
 .\"
@@ -240,9 +240,3 @@ delivered only to the first instance cre
 was opened), regardless of the order in which the monitoring processes
 called
 .Fn ioctl fd FILEMON_SET_PID pid .
-.Pp
-The
-.Ar process_id
-specified with
-.Dv FILEMON_SET_PID
-must refer to a descendant of the calling process.



CVS commit: src/sys/dev/filemon

2015-11-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Nov 23 23:27:38 UTC 2015

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

Log Message:
Remove the requirement that the target (tracked) process be a descendant
of the tracking process.  The call to kauth() should be sufficient to
address any security concerns.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/filemon/filemon.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/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.18 src/sys/dev/filemon/filemon.c:1.19
--- src/sys/dev/filemon/filemon.c:1.18	Mon Nov 23 22:20:57 2015
+++ src/sys/dev/filemon/filemon.c	Mon Nov 23 23:27:38 2015
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.18 2015/11/23 22:20:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.19 2015/11/23 23:27:38 pgoyette Exp $");
 
 #include 
 #include 
@@ -322,27 +322,6 @@ filemon_ioctl(struct file * fp, u_long c
 			break;
 		}
 
-		/* Ensure that target proc is a descendant of curproc */
-		p = tp;
-		while (p) {
-			/*
-			 * make sure p cannot exit
-			 * until we have moved on to p_pptr
-			 */
-			rw_enter(&p->p_reflock, RW_READER);
-			if (p == curproc) {
-rw_exit(&p->p_reflock);
-break;
-			}
-			lp = p;
-			p = p->p_pptr;
-			rw_exit(&lp->p_reflock);
-		}
-		if (p == NULL) {
-			error = EPERM;
-			break;
-		}
-
 		error = kauth_authorize_process(curproc->p_cred,
 		KAUTH_PROCESS_CANSEE, tp,
 		KAUTH_ARG(KAUTH_REQ_PROCESS_CANSEE_ENTRY), NULL, NULL);



CVS commit: src/share/man/man7

2015-11-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Nov 23 23:23:25 UTC 2015

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Minor rephrasing for English grammar police.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/share/man/man7/sysctl.7

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/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.94 src/share/man/man7/sysctl.7:1.95
--- src/share/man/man7/sysctl.7:1.94	Tue Sep 29 07:59:15 2015
+++ src/share/man/man7/sysctl.7	Mon Nov 23 23:23:25 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.94 2015/09/29 07:59:15 wiz Exp $
+.\"	$NetBSD: sysctl.7,v 1.95 2015/11/23 23:23:25 pgoyette Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\"
-.Dd September 24, 2015
+.Dd November 24, 2015
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -2376,8 +2376,8 @@ Available settings are detailed below.
 .It Li security.curtain
 If non-zero, will filter return objects according to the user
 .Tn ID
-requesting information about them, preventing from users any
-access to objects they do not own.
+requesting information about them, preventing users from
+accessing any objects they do not own.
 .Pp
 At the moment, it affects
 .Xr ps 1 ,



CVS commit: src/share/man/man4

2015-11-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Nov 23 23:00:29 UTC 2015

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

Log Message:
Include additional info, including potential security consideration.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/filemon.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/filemon.4
diff -u src/share/man/man4/filemon.4:1.13 src/share/man/man4/filemon.4:1.14
--- src/share/man/man4/filemon.4:1.13	Sat Nov 21 09:01:35 2015
+++ src/share/man/man4/filemon.4	Mon Nov 23 23:00:29 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: filemon.4,v 1.13 2015/11/21 09:01:35 wiz Exp $
+.\"	$NetBSD: filemon.4,v 1.14 2015/11/23 23:00:29 pgoyette Exp $
 .\"
 .\" Copyright (c) 2011, Juniper Networks, Inc.
 .\"
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 21, 2015
+.Dd November 24, 2015
 .Dt FILEMON 4
 .Os
 .Sh NAME
@@ -150,6 +150,16 @@ is the exit status.
 indicates the version of
 .Nm .
 .El
+.Pp
+A
+.Nm
+instance is created by opening
+.Dv /dev/filemon .
+Then use
+.Fn ioctl filemon_fd FILEMON_SET_PID &pid
+to identify the target process to monitor, and
+.Fn ioctl filemon_fd FILEMON_SET_FD &output_fd
+to direct the event log to an already-opened output file.
 .Sh FILES
 .Bd -literal
 /dev/filemon
@@ -208,6 +218,9 @@ successful, and is thus more complex to 
 .Sh HISTORY
 .Nm
 was contributed by Juniper Networks.
+.Sh SECURITY CONSIDERATIONS
+Monitoring of a process enables the target process to write to the
+tracking process's file descriptor.
 .Sh RESTRICTIONS
 The
 .Nm
@@ -218,7 +231,17 @@ Neither processes using any of the
 compatibility layers nor
 any descendants of such processes can be tracked.
 .Pp
-Additionally, the
+If two processes are monitored, and one is a descendant of the other, events
+related to the descendant process and its further descendants are delivered
+only to the descendant process's monitor.
+If a process is being monitored by two instances of filemon, events will be
+delivered only to the first instance created (when
+.Pa /dev/filemon
+was opened), regardless of the order in which the monitoring processes
+called
+.Fn ioctl fd FILEMON_SET_PID pid .
+.Pp
+The
 .Ar process_id
 specified with
 .Dv FILEMON_SET_PID



CVS commit: src/lib/libterminfo

2015-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 23 22:35:28 UTC 2015

Modified Files:
src/lib/libterminfo: terminfo.3

Log Message:
fix ti_puts prototype


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libterminfo/terminfo.3

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

Modified files:

Index: src/lib/libterminfo/terminfo.3
diff -u src/lib/libterminfo/terminfo.3:1.12 src/lib/libterminfo/terminfo.3:1.13
--- src/lib/libterminfo/terminfo.3:1.12	Tue Mar 18 14:20:38 2014
+++ src/lib/libterminfo/terminfo.3	Mon Nov 23 17:35:28 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: terminfo.3,v 1.12 2014/03/18 18:20:38 riastradh Exp $
+.\"	$NetBSD: terminfo.3,v 1.13 2015/11/23 22:35:28 christos Exp $
 .\"
 .\" Copyright (c) 2009, 2011 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 January 25, 2013
+.Dd November 23, 2015
 .Dt TERMINFO 3
 .Os
 .Sh NAME
@@ -85,7 +85,7 @@
 .Ft char *
 .Fn ti_tiparm "TERMINAL *" "const char *cm" "..."
 .Ft int
-.Fn ti_puts "const TERMINAL *term" "const char *str" "int affcnt" "int (*outc)(int, void *)"
+.Fn ti_puts "const TERMINAL *term" "const char *str" "int affcnt" "int (*outc)(int ch, void *arg)" "void *arg"
 .Ft int
 .Fn ti_putp "const TERMINAL *term" "const char *str"
 .Sh DESCRIPTION



CVS commit: src/usr.sbin/makemandb

2015-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 23 22:34:00 UTC 2015

Modified Files:
src/usr.sbin/makemandb: apropos-utils.c

Log Message:
PR/50344: Stephen Fisher: apropos shows formatting on console with vt100 term
type. Can't print terminfo sequences directly; need to process them with
ti_puts() to handle padding. This removes the padding delays, and stricly
could break on slow terminal hardware, but they way the code is structured
makes it impossible to fix properly (since the formatting strings are
passed in the query).
XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makemandb/apropos-utils.c

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

Modified files:

Index: src/usr.sbin/makemandb/apropos-utils.c
diff -u src/usr.sbin/makemandb/apropos-utils.c:1.17 src/usr.sbin/makemandb/apropos-utils.c:1.18
--- src/usr.sbin/makemandb/apropos-utils.c:1.17	Sat Oct 18 04:33:31 2014
+++ src/usr.sbin/makemandb/apropos-utils.c	Mon Nov 23 17:34:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: apropos-utils.c,v 1.17 2014/10/18 08:33:31 snj Exp $	*/
+/*	$NetBSD: apropos-utils.c,v 1.18 2015/11/23 22:34:00 christos Exp $	*/
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay 
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: apropos-utils.c,v 1.17 2014/10/18 08:33:31 snj Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.18 2015/11/23 22:34:00 christos Exp $");
 
 #include 
 #include 
@@ -891,6 +891,33 @@ run_query_pager(sqlite3 *db, query_args 
 	return run_query_internal(db, snippet_args, args);
 }
 
+struct nv {
+	char *s;
+	size_t l;
+};
+
+static int
+term_putc(int c, void *p)
+{
+	struct nv *nv = p;
+	nv->s[nv->l++] = c;
+	return 0;
+}
+
+static char *
+term_fix_seq(TERMINAL *ti, const char *seq)
+{
+	char *res = estrdup(seq);
+	struct nv nv;
+
+	nv.s = res;
+	nv.l = 0;
+	ti_puts(ti, seq, 1, term_putc, &nv);
+	nv.s[nv.l] = '\0';
+
+	return res;
+}
+
 static void
 term_init(int fd, const char *sa[5])
 {
@@ -920,11 +947,12 @@ term_init(int fd, const char *sa[5])
 			smul = rmul = "";
 	}
 
-	sa[0] = estrdup(bold ? bold : smso);
-	sa[1] = estrdup(sgr0 ? sgr0 : rmso);
+	sa[0] = term_fix_seq(ti, bold ? bold : smso);
+	sa[1] = term_fix_seq(ti, sgr0 ? sgr0 : rmso);
 	sa[2] = estrdup("...");
-	sa[3] = estrdup(smul);
-	sa[4] = estrdup(rmul);
+	sa[3] = term_fix_seq(ti, smul);
+	sa[4] = term_fix_seq(ti, rmul);
+
 	if (ti)
 		del_curterm(ti);
 }



CVS commit: src/sys/dev/filemon

2015-11-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Nov 23 22:20:57 UTC 2015

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

Log Message:
Clean up the error paths in filemon_ioctl(), making sure to release the
rw_lock before returning.  Avoids a "locking against myself" error
reported by Brad Harder.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/filemon/filemon.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/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.17 src/sys/dev/filemon/filemon.c:1.18
--- src/sys/dev/filemon/filemon.c:1.17	Sat Nov 21 07:45:30 2015
+++ src/sys/dev/filemon/filemon.c	Mon Nov 23 22:20:57 2015
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.17 2015/11/21 07:45:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.18 2015/11/23 22:20:57 pgoyette Exp $");
 
 #include 
 #include 
@@ -291,6 +291,8 @@ filemon_ioctl(struct file * fp, u_long c
 	if (!filemon)
 		return EBADF;
 
+	/* filemon_fp_data() has locked the entry - make sure to unlock! */
+
 	switch (cmd) {
 	case FILEMON_SET_FD:
 		/* Set the output file descriptor. */
@@ -302,8 +304,8 @@ filemon_ioctl(struct file * fp, u_long c
 		/* Now set up the new one */
 		filemon->fm_fd = *((int *) data);
 		if ((filemon->fm_fp = fd_getfile(filemon->fm_fd)) == NULL) {
-			rw_exit(&filemon->fm_mtx);
-			return EBADF;
+			error = EBADF;
+			break;
 		}
 		/* Write the file header. */
 		filemon_comment(filemon);
@@ -336,8 +338,10 @@ filemon_ioctl(struct file * fp, u_long c
 			p = p->p_pptr;
 			rw_exit(&lp->p_reflock);
 		}
-		if (p == NULL)
-			return EPERM;
+		if (p == NULL) {
+			error = EPERM;
+			break;
+		}
 
 		error = kauth_authorize_process(curproc->p_cred,
 		KAUTH_PROCESS_CANSEE, tp,



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

2015-11-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Mon Nov 23 21:40:14 UTC 2015

Modified Files:
src/sys/arch/sparc64/dev: schizo.c schizoreg.h schizovar.h

Log Message:
Set the target JPID for all interrupts on Tomatillo.
If the "ino-bitmap" property is available, use it to route error interrupts.
Minor cosmetic changes.
Add register printing when DEBUG is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc64/dev/schizo.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc64/dev/schizoreg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/schizovar.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/arch/sparc64/dev/schizo.c
diff -u src/sys/arch/sparc64/dev/schizo.c:1.33 src/sys/arch/sparc64/dev/schizo.c:1.34
--- src/sys/arch/sparc64/dev/schizo.c:1.33	Fri Oct  2 05:22:52 2015
+++ src/sys/arch/sparc64/dev/schizo.c	Mon Nov 23 21:40:14 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: schizo.c,v 1.33 2015/10/02 05:22:52 msaitoh Exp $	*/
+/*	$NetBSD: schizo.c,v 1.34 2015/11/23 21:40:14 jdc Exp $	*/
 /*	$OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.33 2015/10/02 05:22:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.34 2015/11/23 21:40:14 jdc Exp $");
 
 #include 
 #include 
@@ -74,6 +74,10 @@ static	int	schizo_match(device_t, cfdata
 static	void	schizo_attach(device_t, device_t, void *);
 static	int	schizo_print(void *aux, const char *p);
 
+#ifdef DEBUG
+void schizo_print_regs(int unit, int what);
+#endif
+
 CFATTACH_DECL_NEW(schizo, sizeof(struct schizo_softc),
 schizo_match, schizo_attach, NULL, NULL);
 
@@ -143,8 +147,8 @@ schizo_attach(device_t parent, device_t 
 	struct schizo_pbm *pbm;
 	struct iommu_state *is;
 	struct pcibus_attach_args pba;
-	uint64_t reg, eccctrl;
-	int *busranges = NULL, nranges;
+	uint64_t reg, eccctrl, ino_bitmap;
+	int *busranges = NULL, nranges, *ino_bitmaps = NULL, nbitmaps;
 	char *str;
 	bool no_sc;
 
@@ -180,6 +184,9 @@ schizo_attach(device_t parent, device_t 
 	if (pbm == NULL)
 		panic("schizo: can't alloc schizo pbm");
 
+#ifdef DEBUG
+	sc->sc_pbm = pbm;
+#endif
 	pbm->sp_sc = sc;
 	pbm->sp_regt = sc->sc_bustag;
 
@@ -194,11 +201,25 @@ schizo_attach(device_t parent, device_t 
 	if (bus_space_map(sc->sc_bustag, ma->ma_reg[0].ur_paddr,
 			  ma->ma_reg[0].ur_len,
 			  BUS_SPACE_MAP_LINEAR, &pbm->sp_intrh)) {
-		aprint_error(": failed to interrupt map registers\n");
+		aprint_error(": failed to map interrupt registers\n");
 		kmem_free(pbm, sizeof(*pbm));
 		return;
 	}
 
+#ifdef DEBUG
+	/*
+	 * Map ichip registers
+	 */
+	if (sc->sc_tomatillo)
+		if (bus_space_map(sc->sc_bustag, ma->ma_reg[3].ur_paddr,
+			  ma->ma_reg[3].ur_len,
+			  BUS_SPACE_MAP_LINEAR, &pbm->sp_ichiph)) {
+			aprint_error(": failed to map ichip registers\n");
+			kmem_free(pbm, sizeof(*pbm));
+			return;
+		}
+#endif
+
 	if (prom_getprop(sc->sc_node, "ranges", sizeof(struct schizo_range),
 	&pbm->sp_nrange, (void **)&pbm->sp_range))
 		panic("schizo: can't get ranges");
@@ -207,7 +228,7 @@ schizo_attach(device_t parent, device_t 
 	(void **)&busranges))
 		panic("schizo: can't get bus-range");
 
-	aprint_normal(": \"%s\", version %d, ign %x, bus %c %d to %d\n",
+	aprint_normal(": %s, version %d, ign %x, bus %c %d to %d\n",
 	sc->sc_tomatillo ? "Tomatillo" : "Schizo", sc->sc_ver,
 	sc->sc_ign, pbm->sp_bus_a ? 'A' : 'B', busranges[0], busranges[1]);
 	aprint_naive("\n");
@@ -304,20 +325,34 @@ schizo_attach(device_t parent, device_t 
 	SCZ_PCIDIAG_D_INTSYNC);
 	schizo_pbm_write(pbm, SCZ_PCI_DIAG, reg);
 
-	if (pbm->sp_bus_a)
+	if (prom_getprop(sc->sc_node, "ino-bitmap", sizeof(int), &nbitmaps,
+	(void **)&ino_bitmaps)) {
+		/* No property - set defaults (double map UE, CE, SERR). */
+		if (pbm->sp_bus_a)
+			ino_bitmap = 1UL << SCZ_PCIERR_A_INO;
+		else
+			ino_bitmap = 1UL << SCZ_PCIERR_B_INO;
+		ino_bitmap |= (1UL << SCZ_UE_INO) | (1UL << SCZ_CE_INO) |
+		(1UL << SCZ_SERR_INO);
+	} else
+		ino_bitmap = (uint64_t) ino_bitmaps[1] << 32 | ino_bitmaps[0];
+	DPRINTF(SDB_INTR, ("ino_bitmap=0x%016" PRIx64 "\n", ino_bitmap));
+
+	if (ino_bitmap & (1UL << SCZ_PCIERR_A_INO))
 		schizo_set_intr(sc, pbm, PIL_HIGH, schizo_pci_error,
 		   pbm, SCZ_PCIERR_A_INO, "pci_a");
-	else
+	if (ino_bitmap & (1UL << SCZ_PCIERR_B_INO))
 		schizo_set_intr(sc, pbm, PIL_HIGH, schizo_pci_error,
 		   pbm, SCZ_PCIERR_B_INO, "pci_b");
-
-	/* double mapped */
-	schizo_set_intr(sc, pbm, PIL_HIGH, schizo_ue, sc, SCZ_UE_INO,
-	"ue");
-	schizo_set_intr(sc, pbm, PIL_HIGH, schizo_ce, sc, SCZ_CE_INO,
-	"ce");
-	schizo_set_intr(sc, pbm, PIL_HIGH, schizo_safari_error, sc,
-	SCZ_SERR_INO, "safari");
+	if (ino_bitmap & (1UL << SCZ_UE_INO))
+		schizo_set_intr(sc, pbm, PIL_HIGH, schizo_ue, sc, SCZ_UE_INO,
+		"ue");
+	if (ino_bitmap & (1UL << SCZ_CE_INO))
+		schizo_

CVS commit: src

2015-11-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 23 19:56:47 UTC 2015

Modified Files:
src/distrib/sets/lists/base: mi
src/etc/mtree: NetBSD.dist.base special
src/etc/rc.d: ntpd

Log Message:
PR/49380: KAMADA Ken'ichi: ntpd_chrootdir does not work on NetBSD 7.0_BETA
Provide /etc/resolv.conf so that it can resolve names. This is needed because
of deferred name resolution.
XXX: pullup -7


To generate a diff of this commit:
cvs rdiff -u -r1.1117 -r1.1118 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.149 -r1.150 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.152 -r1.153 src/etc/mtree/special
cvs rdiff -u -r1.15 -r1.16 src/etc/rc.d/ntpd

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1117 src/distrib/sets/lists/base/mi:1.1118
--- src/distrib/sets/lists/base/mi:1.1117	Wed Nov 11 02:48:41 2015
+++ src/distrib/sets/lists/base/mi	Mon Nov 23 14:56:47 2015
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1117 2015/11/11 07:48:41 ozaki-r Exp $
+# $NetBSD: mi,v 1.1118 2015/11/23 19:56:47 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -5877,6 +5877,7 @@
 ./var/chroot/named/var/tmp			base-bind-root
 ./var/chroot/ntpdbase-ntp-root
 ./var/chroot/ntpd/devbase-ntp-root
+./var/chroot/ntpd/etcbase-ntp-root
 ./var/chroot/ntpd/varbase-ntp-root
 ./var/chroot/ntpd/var/db			base-ntp-root
 ./var/chroot/ntpd/var/run			base-ntp-root

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.149 src/etc/mtree/NetBSD.dist.base:1.150
--- src/etc/mtree/NetBSD.dist.base:1.149	Thu Sep  3 18:24:02 2015
+++ src/etc/mtree/NetBSD.dist.base	Mon Nov 23 14:56:47 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.149 2015/09/03 22:24:02 youri Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.150 2015/11/23 19:56:47 christos Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -1268,6 +1268,7 @@
 ./var/chroot/named/var/tmp	mode=01775 gname=named
 ./var/chroot/ntpd
 ./var/chroot/ntpd/dev
+./var/chroot/ntpd/etc
 ./var/chroot/ntpd/var
 ./var/chroot/ntpd/var/db	mode=0775 gname=ntpd
 ./var/chroot/ntpd/var/run	mode=0775 gname=ntpd

Index: src/etc/mtree/special
diff -u src/etc/mtree/special:1.152 src/etc/mtree/special:1.153
--- src/etc/mtree/special:1.152	Sat Mar 21 15:10:43 2015
+++ src/etc/mtree/special	Mon Nov 23 14:56:47 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: special,v 1.152 2015/03/21 19:10:43 jmcneill Exp $
+#	$NetBSD: special,v 1.153 2015/11/23 19:56:47 christos Exp $
 #	@(#)special	8.2 (Berkeley) 1/23/94
 #
 # This file may be overwritten on upgrades.
@@ -400,6 +400,7 @@
 ./var/chroot/named/var/tmp	type=dir  mode=01775 gname=named
 ./var/chroot/ntpd		type=dir  mode=0755
 ./var/chroot/ntpd/dev		type=dir  mode=0755
+./var/chroot/ntpd/etc		type=dir  mode=0755
 ./var/chroot/ntpd/var		type=dir  mode=0755
 ./var/chroot/ntpd/var/db	type=dir  mode=0775 gname=ntpd
 ./var/chroot/ntpd/var/run	type=dir  mode=0775 gname=ntpd

Index: src/etc/rc.d/ntpd
diff -u src/etc/rc.d/ntpd:1.15 src/etc/rc.d/ntpd:1.16
--- src/etc/rc.d/ntpd:1.15	Thu Dec 25 18:00:18 2014
+++ src/etc/rc.d/ntpd	Mon Nov 23 14:56:47 2015
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ntpd,v 1.15 2014/12/25 23:00:18 spz Exp $
+# $NetBSD: ntpd,v 1.16 2015/11/23 19:56:47 christos Exp $
 #
 
 # PROVIDE: ntpd
@@ -53,6 +53,13 @@ ntpd_precmd()
 	if [ ! -d "${ntpd_chrootdir}/etc" ]; then
 		mkdir "${ntpd_chrootdir}/etc"
 	fi
+
+	for f in resolv.conf; do
+		if ! cmp -s "/etc/$f" "${ntpd_chrootdir}/etc/$f"; then
+			cp -p "/etc/$f" "${ntpd_chrootdir}/etc/$f"
+		fi
+	done
+
 	if [ ! -f "${ntpd_chrootdir}/etc/services" ]; then
 		getent services ntp/udp ntp/tcp \
 			> "${ntpd_chrootdir}/etc/services"



CVS commit: src/sys/ufs/lfs

2015-11-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Nov 23 08:00:45 UTC 2015

Modified Files:
src/sys/ufs/lfs: ulfs_readwrite.c

Log Message:
fix assertion checking that bufrd function is used only for large symlinks
that aren't embedded in the inode.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/ufs/lfs/ulfs_readwrite.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/ufs/lfs/ulfs_readwrite.c
diff -u src/sys/ufs/lfs/ulfs_readwrite.c:1.19 src/sys/ufs/lfs/ulfs_readwrite.c:1.20
--- src/sys/ufs/lfs/ulfs_readwrite.c:1.19	Fri Jul 24 06:59:32 2015
+++ src/sys/ufs/lfs/ulfs_readwrite.c	Mon Nov 23 08:00:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_readwrite.c,v 1.19 2015/07/24 06:59:32 dholland Exp $	*/
+/*	$NetBSD: ulfs_readwrite.c,v 1.20 2015/11/23 08:00:45 mlelstv Exp $	*/
 /*  from NetBSD: ufs_readwrite.c,v 1.105 2013/01/22 09:39:18 dholland Exp  */
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.19 2015/07/24 06:59:32 dholland Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.20 2015/11/23 08:00:45 mlelstv Exp $");
 
 #ifdef LFS_READWRITE
 #define	FS			struct lfs
@@ -159,7 +159,7 @@ BUFRD(struct vnode *vp, struct uio *uio,
 	fs = ip->I_FS;
 	error = 0;
 
-	KASSERT(vp->v_type != VLNK || ip->i_size < fs->um_maxsymlinklen);
+	KASSERT(vp->v_type != VLNK || ip->i_size >= fs->um_maxsymlinklen);
 	KASSERT(vp->v_type != VLNK || fs->um_maxsymlinklen != 0 ||
 	DIP(ip, blocks) == 0);
 	KASSERT(vp->v_type != VREG || vp == fs->lfs_ivnode);