CVS commit: src/sys/dev/usb

2016-02-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 16 07:51:13 UTC 2016

Modified Files:
src/sys/dev/usb: uhub.c usbdivar.h

Log Message:
Re-enable the TT support that existed previously.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/usb/uhub.c
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/usb/usbdivar.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/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.130 src/sys/dev/usb/uhub.c:1.131
--- src/sys/dev/usb/uhub.c:1.130	Fri Feb  5 15:41:49 2016
+++ src/sys/dev/usb/uhub.c	Tue Feb 16 07:51:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.130 2016/02/05 15:41:49 skrll Exp $	*/
+/*	$NetBSD: uhub.c,v 1.131 2016/02/16 07:51:13 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.130 2016/02/05 15:41:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.131 2016/02/16 07:51:13 skrll Exp $");
 
 #include 
 
@@ -184,9 +184,7 @@ uhub_attach(device_t parent, device_t se
 	int p, port, nports, nremov, pwrdly;
 	usbd_interface_handle iface;
 	usb_endpoint_descriptor_t *ed;
-#if 0 /* notyet */
 	struct usbd_tt *tts = NULL;
-#endif
 
 	UHUBHIST_FUNC(); UHUBHIST_CALLED();
 
@@ -334,14 +332,12 @@ uhub_attach(device_t parent, device_t se
 	 *proceed with device attachment
 	 */
 
-#if 0
 	if (UHUB_IS_HIGH_SPEED(sc) && nports > 0) {
 		tts = malloc((UHUB_IS_SINGLE_TT(sc) ? 1 : nports) *
 			 sizeof (struct usbd_tt), M_USBDEV, M_NOWAIT);
 		if (!tts)
 			goto bad;
 	}
-#endif
 	/* Set up data structures */
 	for (p = 0; p < nports; p++) {
 		struct usbd_port *up = >ports[p];
@@ -355,14 +351,12 @@ uhub_attach(device_t parent, device_t se
 			up->power = USB_MIN_POWER;
 		up->restartcnt = 0;
 		up->reattach = 0;
-#if 0
 		if (UHUB_IS_HIGH_SPEED(sc)) {
 			up->tt = [UHUB_IS_SINGLE_TT(sc) ? 0 : p];
 			up->tt->hub = hub;
 		} else {
 			up->tt = NULL;
 		}
-#endif
 	}
 
 	/* XXX should check for none, individual, or ganged power? */
@@ -678,10 +672,8 @@ uhub_detach(device_t self, int flags)
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_hub, sc->sc_dev);
 
-#if 0
 	if (hub->ports[0].tt)
 		free(hub->ports[0].tt, M_USBDEV);
-#endif
 	free(hub, M_USBDEV);
 	sc->sc_hub->hub = NULL;
 	if (sc->sc_status)

Index: src/sys/dev/usb/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.111 src/sys/dev/usb/usbdivar.h:1.112
--- src/sys/dev/usb/usbdivar.h:1.111	Wed Jan  6 22:12:49 2016
+++ src/sys/dev/usb/usbdivar.h	Tue Feb 16 07:51:13 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.111 2016/01/06 22:12:49 skrll Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.112 2016/02/16 07:51:13 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -114,11 +114,9 @@ struct usbd_pipe_methods {
 	void		  (*done)(usbd_xfer_handle xfer);
 };
 
-#if 0 /* notyet */
 struct usbd_tt {
 	struct usbd_hub	   *hub;
 };
-#endif
 
 struct usbd_port {
 	usb_port_status_t	status;
@@ -129,9 +127,7 @@ struct usbd_port {
 	u_int8_t		reattach;
 	struct usbd_device *device;	/* Connected device */
 	struct usbd_device *parent;	/* The ports hub */
-#if 0
-	struct usbd_tt	   *tt; /* Transaction translator (if any) */
-#endif
+	struct usbd_tt	   *tt;	/* Transaction translator (if any) */
 };
 
 struct usbd_hub {



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-02-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 16 07:30:46 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhci.c

Log Message:
Use TAILQ_FOREACH.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.264.4.59 -r1.264.4.60 src/sys/dev/usb/uhci.c

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

Modified files:

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.59 src/sys/dev/usb/uhci.c:1.264.4.60
--- src/sys/dev/usb/uhci.c:1.264.4.59	Mon Feb 15 17:00:27 2016
+++ src/sys/dev/usb/uhci.c	Tue Feb 16 07:30:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.4.59 2016/02/15 17:00:27 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.4.60 2016/02/16 07:30:46 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.59 2016/02/15 17:00:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.60 2016/02/16 07:30:46 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -967,7 +967,7 @@ uhci_dump_iis(struct uhci_softc *sc)
 	struct uhci_xfer *ux;
 
 	printf("interrupt list:\n");
-	for (ux = TAILQ_FIRST(>sc_intrhead); ux; ux = TAILQ_NEXT(ux, ux_list))
+	TAILQ_FOREACH(ux, >sc_intrhead, ux_list)
 		uhci_dump_ii(ux);
 }
 
@@ -1746,8 +1746,7 @@ uhci_waitintr(uhci_softc_t *sc, struct u
 
 	/* Timeout */
 	DPRINTF("timeout", 0, 0, 0, 0);
-	for (ux = TAILQ_FIRST(>sc_intrhead); ux != NULL;
-	ux = TAILQ_NEXT(ux, ux_list))
+	TAILQ_FOREACH(ux, >sc_intrhead, ux_list)
 		if (>ux_xfer == xfer)
 			break;
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-02-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 16 07:16:47 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehcireg.h

Log Message:
Add some changes to ehci_sitd_t based on the RiscOS code sent to me by
Colin Granvillein private email


To generate a diff of this commit:
cvs rdiff -u -r1.34.14.10 -r1.34.14.11 src/sys/dev/usb/ehcireg.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/usb/ehcireg.h
diff -u src/sys/dev/usb/ehcireg.h:1.34.14.10 src/sys/dev/usb/ehcireg.h:1.34.14.11
--- src/sys/dev/usb/ehcireg.h:1.34.14.10	Tue Sep 22 12:06:01 2015
+++ src/sys/dev/usb/ehcireg.h	Tue Feb 16 07:16:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehcireg.h,v 1.34.14.10 2015/09/22 12:06:01 skrll Exp $	*/
+/*	$NetBSD: ehcireg.h,v 1.34.14.11 2016/02/16 07:16:47 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -281,13 +281,17 @@ typedef struct {
 #define EHCI_SITD_XACTERR	0x0008
 #define EHCI_SITD_MISS		0x0004
 #define EHCI_SITD_SPLITXSTATE	0x0002
-	volatile uint32_t	sitd_buffer[2];
+
+#define EHCI_SITD_BUFFERS	2
+	
+	volatile uint32_t	sitd_buffer[EHCI_SITD_BUFFERS];
 #define EHCI_SITD_SET_BPTR(x)	((x) & 0xf000)
 #define EHCI_SITD_SET_OFFS(x)	((x) & 0xfff)
 #define EHCI_SITD_TP_MASK	__BITS(4,3)
 #define EHCI_SITD_TCOUNT_MASK	__BITS(2,0)
 
-	volatile uint32_t	sitd_back;
+	volatile ehci_link_t	sitd_back;
+	volatile uint32_t	sitd_buffer_hi[EHCI_SITD_BUFFERS];
 } ehci_sitd_t;
 #define EHCI_SITD_ALIGN 32
 



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

2016-02-15 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Feb 16 05:14:31 UTC 2016

Modified Files:
src/sys/arch/zaurus/conf: INSTALL

Log Message:
Reduced INSTALL kernel size.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/zaurus/conf/INSTALL

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/zaurus/conf/INSTALL
diff -u src/sys/arch/zaurus/conf/INSTALL:1.26 src/sys/arch/zaurus/conf/INSTALL:1.27
--- src/sys/arch/zaurus/conf/INSTALL:1.26	Sun Jul 19 09:26:50 2015
+++ src/sys/arch/zaurus/conf/INSTALL	Tue Feb 16 05:14:31 2016
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.26 2015/07/19 09:26:50 martin Exp $
+# $NetBSD: INSTALL,v 1.27 2016/02/16 05:14:31 nonaka Exp $
 #
 # INSTALL config file (GENERIC with memory disk root)
 #
@@ -28,12 +28,14 @@ no options 		INSECURE
 
 no file-system		KERNFS
 no file-system		NULLFS
+no file-system		PUFFS
 no file-system		PROCFS
 no file-system		PTYFS
 no file-system		TMPFS
 
 no options 		WAPBL
 
+no options		COMPAT_NETBSD32
 no options		COMPAT_13
 no options		COMPAT_14
 no options		COMPAT_15
@@ -88,3 +90,6 @@ no pseudo-device	accf_http
 no pseudo-device	ksyms
 no pseudo-device	wsfont
 options 	NO_DEV_PTM
+no pseudo-device	clockctl
+no pseudo-device	drvctl
+no pseudo-device	putter



CVS commit: src/sys/net

2016-02-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Feb 16 01:31:26 UTC 2016

Modified Files:
src/sys/net: if.h if_llatbl.c if_llatbl.h

Log Message:
Remove workaround for GATEWAY

The workaround was introduced because lltable/llentry uses rwlock
but it may be executed in hardware interrupt due to fast forward.
Now we don't run fast forward in hardware interrupt anymore, so
we can remove the workaround.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/net/if.h
cvs rdiff -u -r1.9 -r1.10 src/sys/net/if_llatbl.c
cvs rdiff -u -r1.7 -r1.8 src/sys/net/if_llatbl.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/net/if.h
diff -u src/sys/net/if.h:1.196 src/sys/net/if.h:1.197
--- src/sys/net/if.h:1.196	Mon Feb 15 08:08:04 2016
+++ src/sys/net/if.h	Tue Feb 16 01:31:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.196 2016/02/15 08:08:04 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.197 2016/02/16 01:31:26 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -214,11 +214,7 @@ struct ifnet_lock;
 #include 
 #include 
 #include 
-#ifdef GATEWAY
-#include 
-#else
 #include 
-#endif
 
 struct ifnet_lock {
 	kmutex_t il_lock;	/* Protects the critical section. */
@@ -352,11 +348,7 @@ typedef struct ifnet {
 	struct ifnet_lock *if_ioctl_lock;
 #ifdef _KERNEL /* XXX kvm(3) */
 	struct callout *if_slowtimo_ch;
-#ifdef GATEWAY
-	struct kmutex	*if_afdata_lock;
-#else
 	struct krwlock	*if_afdata_lock;
-#endif
 	struct if_percpuq	*if_percpuq; /* We should remove it in the future */
 	void	*if_link_si;		/* softint to handle link state changes */
 	int	if_old_link_state;	/* previous link state */
@@ -450,32 +442,6 @@ typedef struct ifnet {
 	"\23TSO6"		\
 	"\24LRO"		\
 
-#ifdef GATEWAY
-#define	IF_AFDATA_LOCK_INIT(ifp)	\
-	do { \
-		(ifp)->if_afdata_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET); \
-	} while (0)
-
-#define	IF_AFDATA_LOCK_DESTROY(ifp)	mutex_obj_free((ifp)->if_afdata_lock)
-
-#define	IF_AFDATA_WLOCK(ifp)	mutex_enter((ifp)->if_afdata_lock)
-#define	IF_AFDATA_RLOCK(ifp)	mutex_enter((ifp)->if_afdata_lock)
-#define	IF_AFDATA_WUNLOCK(ifp)	mutex_exit((ifp)->if_afdata_lock)
-#define	IF_AFDATA_RUNLOCK(ifp)	mutex_exit((ifp)->if_afdata_lock)
-#define	IF_AFDATA_LOCK(ifp)	IF_AFDATA_WLOCK(ifp)
-#define	IF_AFDATA_UNLOCK(ifp)	IF_AFDATA_WUNLOCK(ifp)
-#define	IF_AFDATA_TRYLOCK(ifp)	mutex_tryenter((ifp)->if_afdata_lock)
-
-#define	IF_AFDATA_LOCK_ASSERT(ifp)	\
-	KASSERT(mutex_owned((ifp)->if_afdata_lock))
-#define	IF_AFDATA_RLOCK_ASSERT(ifp)	\
-	KASSERT(mutex_owned((ifp)->if_afdata_lock))
-#define	IF_AFDATA_WLOCK_ASSERT(ifp)	\
-	KASSERT(mutex_owned((ifp)->if_afdata_lock))
-#define	IF_AFDATA_UNLOCK_ASSERT(ifp)	\
-	KASSERT(!mutex_owned((ifp)->if_afdata_lock))
-
-#else /* GATEWAY */
 #define	IF_AFDATA_LOCK_INIT(ifp)	\
 	do {(ifp)->if_afdata_lock = rw_obj_alloc();} while (0)
 
@@ -497,7 +463,6 @@ typedef struct ifnet {
 	KASSERT(rw_write_held((ifp)->if_afdata_lock))
 #define	IF_AFDATA_UNLOCK_ASSERT(ifp)	\
 	KASSERT(!rw_lock_held((ifp)->if_afdata_lock))
-#endif /* GATEWAY */
 
 #define IFQ_LOCK(_ifq)		if ((_ifq)->ifq_lock) mutex_enter((_ifq)->ifq_lock)
 #define IFQ_UNLOCK(_ifq)	if ((_ifq)->ifq_lock) mutex_exit((_ifq)->ifq_lock)

Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.9 src/sys/net/if_llatbl.c:1.10
--- src/sys/net/if_llatbl.c:1.9	Thu Nov 26 01:41:20 2015
+++ src/sys/net/if_llatbl.c	Tue Feb 16 01:31:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.9 2015/11/26 01:41:20 ozaki-r Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.10 2016/02/16 01:31:26 ozaki-r Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -383,16 +383,7 @@ lltable_purge_entries(struct lltable *ll
 		if (lle->la_rt != NULL) {
 			struct rtentry *rt = lle->la_rt;
 			lle->la_rt = NULL;
-#ifdef GATEWAY
-			/* XXX cannot call rtfree with holding mutex(IPL_NET) */
-			LLE_ADDREF(lle);
-			LLE_WUNLOCK(lle);
-#endif
 			rtfree(rt);
-#ifdef GATEWAY
-			LLE_WLOCK(lle);
-			LLE_REMREF(lle);
-#endif
 		}
 #endif
 		llentry_free(lle);

Index: src/sys/net/if_llatbl.h
diff -u src/sys/net/if_llatbl.h:1.7 src/sys/net/if_llatbl.h:1.8
--- src/sys/net/if_llatbl.h:1.7	Thu Dec 17 02:38:33 2015
+++ src/sys/net/if_llatbl.h	Tue Feb 16 01:31:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.h,v 1.7 2015/12/17 02:38:33 ozaki-r Exp $	*/
+/*	$NetBSD: if_llatbl.h,v 1.8 2016/02/16 01:31:26 ozaki-r Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -37,9 +37,6 @@
 #endif
 
 #include 
-#ifdef GATEWAY
-#include 
-#endif
 
 #include 
 
@@ -94,11 +91,7 @@ struct llentry {
 
 	LIST_ENTRY(llentry)	lle_chain;	/* chain of deleted items */
 	struct callout		lle_timer;
-#ifdef GATEWAY
-	kmutex_t		lle_lock;
-#else
 	krwlock_t		lle_lock;

CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 23:36:30 UTC 2016

Modified Files:
src/lib/libedit: readline.c

Log Message:
attribute unused


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/lib/libedit/readline.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/readline.c
diff -u src/lib/libedit/readline.c:1.119 src/lib/libedit/readline.c:1.120
--- src/lib/libedit/readline.c:1.119	Mon Feb 15 17:48:59 2016
+++ src/lib/libedit/readline.c	Mon Feb 15 18:36:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.119 2016/02/15 22:48:59 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.120 2016/02/15 23:36:30 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.119 2016/02/15 22:48:59 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.120 2016/02/15 23:36:30 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -2327,7 +2327,7 @@ rl_free_line_state(void)
 
 int
 /*ARGSUSED*/
-rl_set_keyboard_input_timeout(int u)
+rl_set_keyboard_input_timeout(int u __attribute__((__unused__)))
 {
 	return 0;
 }



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 22:53:38 UTC 2016

Modified Files:
src/lib/libedit: terminal.c

Log Message:
OpenBSD term.c rev. 1.7 2002/11/29 20:13:39 deraadt
spelling


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libedit/terminal.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/terminal.c
diff -u src/lib/libedit/terminal.c:1.17 src/lib/libedit/terminal.c:1.18
--- src/lib/libedit/terminal.c:1.17	Mon Feb 15 10:35:03 2016
+++ src/lib/libedit/terminal.c	Mon Feb 15 17:53:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: terminal.c,v 1.17 2016/02/15 15:35:03 christos Exp $	*/
+/*	$NetBSD: terminal.c,v 1.18 2016/02/15 22:53:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)term.c	8.2 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: terminal.c,v 1.17 2016/02/15 15:35:03 christos Exp $");
+__RCSID("$NetBSD: terminal.c,v 1.18 2016/02/15 22:53:38 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -507,8 +507,7 @@ terminal_move_to_line(EditLine *el, int 
 	if (where > el->el_terminal.t_size.v) {
 #ifdef DEBUG_SCREEN
 		(void) fprintf(el->el_errfile,
-		"terminal_move_to_line: where is ridiculous: %d\r\n",
-		where);
+		"%s: where is ridiculous: %d\r\n", __func__, where);
 #endif /* DEBUG_SCREEN */
 		return;
 	}
@@ -574,8 +573,7 @@ mc_again:
 	if (where > el->el_terminal.t_size.h) {
 #ifdef DEBUG_SCREEN
 		(void) fprintf(el->el_errfile,
-		"terminal_move_to_char: where is riduculous: %d\r\n",
-		where);
+		"%s: where is ridiculous: %d\r\n", __func__, where);
 #endif /* DEBUG_SCREEN */
 		return;
 	}
@@ -669,7 +667,7 @@ terminal_overwrite(EditLine *el, const C
 	if (n > (size_t)el->el_terminal.t_size.h) {
 #ifdef DEBUG_SCREEN
 		(void) fprintf(el->el_errfile,
-		"terminal_overwrite: n is riduculous: %d\r\n", n);
+		"%s: n is ridiculous: %d\r\n", __func__, n);
 #endif /* DEBUG_SCREEN */
 		return;
 	}
@@ -725,7 +723,7 @@ terminal_deletechars(EditLine *el, int n
 	if (num > el->el_terminal.t_size.h) {
 #ifdef DEBUG_SCREEN
 		(void) fprintf(el->el_errfile,
-		"terminal_deletechars: num is riduculous: %d\r\n", num);
+		"%s: num is ridiculous: %d\r\n", __func__, num);
 #endif /* DEBUG_SCREEN */
 		return;
 	}
@@ -766,7 +764,7 @@ terminal_insertwrite(EditLine *el, Char 
 	if (num > el->el_terminal.t_size.h) {
 #ifdef DEBUG_SCREEN
 		(void) fprintf(el->el_errfile,
-		"StartInsert: num is riduculous: %d\r\n", num);
+		"%s: num is ridiculous: %d\r\n", __func__, num);
 #endif /* DEBUG_SCREEN */
 		return;
 	}



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 22:48:59 UTC 2016

Modified Files:
src/lib/libedit: config.h readline.c sys.h

Log Message:
OpenBSD readline.c rev. 1.14 2015/02/06 23:21:58 millert
use SIZE_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libedit/config.h
cvs rdiff -u -r1.118 -r1.119 src/lib/libedit/readline.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libedit/sys.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/libedit/config.h
diff -u src/lib/libedit/config.h:1.6 src/lib/libedit/config.h:1.7
--- src/lib/libedit/config.h:1.6	Mon Feb 15 11:14:39 2016
+++ src/lib/libedit/config.h	Mon Feb 15 17:48:59 2016
@@ -256,6 +256,9 @@
 /* Version number of package */
 #define VERSION "3.0"
 
+/* Define to 1 if the system provides the SIZE_MAX constant */
+#define HAVE_SIZE_MAX	1
+
 /* Define to 1 if you want wide-character code */
 /* #undef WIDECHAR */
 

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.118 src/lib/libedit/readline.c:1.119
--- src/lib/libedit/readline.c:1.118	Mon Feb 15 16:58:37 2016
+++ src/lib/libedit/readline.c	Mon Feb 15 17:48:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.118 2016/02/15 21:58:37 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.119 2016/02/15 22:48:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,12 +31,13 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.118 2016/02/15 21:58:37 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.119 2016/02/15 22:48:59 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2201,7 +2202,7 @@ rl_completion_matches(const char *str, r
 	}
 	qsort([1], len - 1, sizeof(*list),
 	(int (*)(const void *, const void *)) strcmp);
-	min = SIZE_T_MAX;
+	min = SIZE_MAX;
 	for (i = 1, a = list[i]; i < len - 1; i++, a = b) {
 		b = list[i + 1];
 		for (j = 0; a[j] && a[j] == b[j]; j++)

Index: src/lib/libedit/sys.h
diff -u src/lib/libedit/sys.h:1.20 src/lib/libedit/sys.h:1.21
--- src/lib/libedit/sys.h:1.20	Mon Feb 15 12:35:39 2016
+++ src/lib/libedit/sys.h	Mon Feb 15 17:48:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys.h,v 1.20 2016/02/15 17:35:39 christos Exp $	*/
+/*	$NetBSD: sys.h,v 1.21 2016/02/15 22:48:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -109,8 +109,8 @@ wchar_t *wcsdup(const wchar_t *);
 typedef unsigned int	u_int32_t;
 #endif
 
-#ifndef SIZE_T_MAX
-#define SIZE_T_MAX	((size_t)-1)
+#ifndef HAVE_SIZE_MAX
+#define SIZE_MAX	((size_t)-1)
 #endif
 
 #define	REGEX		/* Use POSIX.2 regular expression functions */



CVS commit: src/share/man/man9

2016-02-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 15 22:37:54 UTC 2016

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

Log Message:
cardbus autoconf uses cardbus_attach_args, not isapnp_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/share/man/man9/cardbus.9

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

Modified files:

Index: src/share/man/man9/cardbus.9
diff -u src/share/man/man9/cardbus.9:1.19 src/share/man/man9/cardbus.9:1.20
--- src/share/man/man9/cardbus.9:1.19	Sun Jul 13 11:03:26 2014
+++ src/share/man/man9/cardbus.9	Mon Feb 15 22:37:54 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: cardbus.9,v 1.19 2014/07/13 11:03:26 mbalmer Exp $
+.\" $NetBSD: cardbus.9,v 1.20 2016/02/15 22:37:54 riastradh Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -267,7 +267,7 @@ above.
 During autoconfiguration, a
 .Nm
 driver will receive a pointer to
-.Fa struct isapnp_attach_args
+.Fa struct cardbus_attach_args
 describing the device attaches to the CardBus.
 Drivers match the device using the
 .Fa ca_id



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 21:58:38 UTC 2016

Modified Files:
src/lib/libedit: readline.c
src/lib/libedit/readline: readline.h

Log Message:
OpenBSD readline.c rev. 1.13 2015/01/13 08:33:12 reyk
rl_set_keyboard_input_timeout() for readline 4.2 compat


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/lib/libedit/readline.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libedit/readline/readline.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/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.117 src/lib/libedit/readline.c:1.118
--- src/lib/libedit/readline.c:1.117	Tue Jun  2 11:35:31 2015
+++ src/lib/libedit/readline.c	Mon Feb 15 16:58:37 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.117 2015/06/02 15:35:31 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.118 2016/02/15 21:58:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.117 2015/06/02 15:35:31 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.118 2016/02/15 21:58:37 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -2323,3 +2323,10 @@ void
 rl_free_line_state(void)
 {
 }
+
+int
+/*ARGSUSED*/
+rl_set_keyboard_input_timeout(int u)
+{
+	return 0;
+}

Index: src/lib/libedit/readline/readline.h
diff -u src/lib/libedit/readline/readline.h:1.37 src/lib/libedit/readline/readline.h:1.38
--- src/lib/libedit/readline/readline.h:1.37	Tue Jun  2 11:36:45 2015
+++ src/lib/libedit/readline/readline.h	Mon Feb 15 16:58:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.h,v 1.37 2015/06/02 15:36:45 christos Exp $	*/
+/*	$NetBSD: readline.h,v 1.38 2016/02/15 21:58:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -216,6 +216,8 @@ int		 rl_generic_bind(int, const char *,
 int		 rl_bind_key_in_map(int, rl_command_func_t *, Keymap);
 void		 rl_cleanup_after_signal(void);
 void		 rl_free_line_state(void);
+int		 rl_set_keyboard_input_timeout(int);
+
 #ifdef __cplusplus
 }
 #endif



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 21:56:35 UTC 2016

Modified Files:
src/lib/libedit: eln.c

Log Message:
OpenBSD eln.c rev. 1.3 2011/11/27 21:46:44 pascal
kill a C++-style comment


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libedit/eln.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/eln.c
diff -u src/lib/libedit/eln.c:1.22 src/lib/libedit/eln.c:1.23
--- src/lib/libedit/eln.c:1.22	Sun Feb 14 12:06:24 2016
+++ src/lib/libedit/eln.c	Mon Feb 15 16:56:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eln.c,v 1.22 2016/02/14 17:06:24 christos Exp $	*/
+/*	$NetBSD: eln.c,v 1.23 2016/02/15 21:56:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.22 2016/02/14 17:06:24 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.23 2016/02/15 21:56:35 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include "histedit.h"
@@ -233,7 +233,7 @@ el_set(EditLine *el, int op, ...)
 		ret = -1;
 		goto out;
 		}
-		// XXX: The two strdup's leak
+		/* XXX: The two strdup's leak */
 		ret = map_addfunc(el, Strdup(wargv[0]), Strdup(wargv[1]),
 		func);
 		ct_free_argv(wargv);



CVS commit: src/lib/libedit/TEST

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 21:38:07 UTC 2016

Modified Files:
src/lib/libedit/TEST: Makefile

Log Message:
Compile with WIDECHAR the same way the main Makefile does (Ingo Schwarze)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libedit/TEST/Makefile

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/TEST/Makefile
diff -u src/lib/libedit/TEST/Makefile:1.5 src/lib/libedit/TEST/Makefile:1.6
--- src/lib/libedit/TEST/Makefile:1.5	Wed Feb  3 10:34:43 2010
+++ src/lib/libedit/TEST/Makefile	Mon Feb 15 16:38:07 2016
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.5 2010/02/03 15:34:43 roy Exp $
+# $NetBSD: Makefile,v 1.6 2016/02/15 21:38:07 christos Exp $
+
+WIDECHAR ?= yes
 
 NOMAN=1
 PROG=wtc1
@@ -6,6 +8,10 @@ CPPFLAGS=-I${.CURDIR}/..
 LDADD+=-ledit -ltermlib
 DPADD+=${LIBEDIT} ${LIBTERMLIB}
 
+.if "${WIDECHAR}" == "yes"
+CPPFLAGS+=-DWIDECHAR
+.endif
+
 .ifdef DEBUG
 CPPFLAGS+=-DDEBUG
 .endif



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 21:35:52 UTC 2016

Modified Files:
src/lib/libedit: history.c

Log Message:
Don't free getline memory (Ingo Schwarze).


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libedit/history.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/history.c
diff -u src/lib/libedit/history.c:1.50 src/lib/libedit/history.c:1.51
--- src/lib/libedit/history.c:1.50	Mon Feb 15 10:53:45 2016
+++ src/lib/libedit/history.c	Mon Feb 15 16:35:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.50 2016/02/15 15:53:45 christos Exp $	*/
+/*	$NetBSD: history.c,v 1.51 2016/02/15 21:35:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.50 2016/02/15 15:53:45 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.51 2016/02/15 21:35:52 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -756,7 +756,6 @@ history_load(TYPE(History) *h, const cha
 	ptr = h_malloc((max_size = 1024) * sizeof(*ptr));
 	if (ptr == NULL)
 		goto done;
-	free(line);
 	for (i = 0; (sz = getline(, , fp)) != -1; i++) {
 		if (sz > 0 && line[sz - 1] == '\n')
 			line[--sz] = '\0';
@@ -775,7 +774,6 @@ history_load(TYPE(History) *h, const cha
 			i = -1;
 			goto oomem;
 		}
-		free(line);
 	}
 oomem:
 	h_free(ptr);



CVS commit: src/usr.bin/calendar/calendars

2016-02-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 15 20:58:02 UTC 2016

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday calendar.history

Log Message:
allexander the greeeat, his name struck fear into hearts of men!

...but let's conquer that fear and give ol' alex a consistent and
correct date of death.

(he died of fever in baabylooo)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/calendar/calendars/calendar.birthday
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/calendar/calendars/calendar.history

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

Modified files:

Index: src/usr.bin/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.25 src/usr.bin/calendar/calendars/calendar.birthday:1.26
--- src/usr.bin/calendar/calendars/calendar.birthday:1.25	Wed Mar 11 17:35:16 2015
+++ src/usr.bin/calendar/calendars/calendar.birthday	Mon Feb 15 20:58:02 2016
@@ -142,7 +142,7 @@
 06/07	George Bryan "Beau" Brummel born, 1778
 06/07	Alan Mathison Turing died, 1954
 06/08	Frank Lloyd Wright born in Richland Center, Wisconsin, 1869
-06/13	Alexander the Great dies (323 BC)
+06/11	Alexander the Great dies (323 BC)
 06/15	Edward (Edvard Hagerup) Grieg born in Bergen, Norway, 1843
 06/16	Hammurabi the Great dies, Babylon, 1686 BC
 06/18	M.C. Escher born, 1898

Index: src/usr.bin/calendar/calendars/calendar.history
diff -u src/usr.bin/calendar/calendars/calendar.history:1.33 src/usr.bin/calendar/calendars/calendar.history:1.34
--- src/usr.bin/calendar/calendars/calendar.history:1.33	Fri Nov  6 12:49:06 2015
+++ src/usr.bin/calendar/calendars/calendar.history	Mon Feb 15 20:58:02 2016
@@ -268,7 +268,7 @@
 08/15	US leaves the Gold Standard, 1971
 06/06	First drive-in movie, 1933
 06/06	Normandy landing, 1944
-06/10	Death of Alexander the Great, 323 B.C.
+06/11	Death of Alexander the Great, 323 B.C.
 06/13	Pioneer 10 flies past Neptune's orbit, the first human artifact
 	to travel beyond the orbits of all known planets, 1983
 06/14	Sandpaper invented by I. Fischer, Jr., 1834



CVS commit: src/sys/arch/amd64/amd64

2016-02-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 15 20:35:59 UTC 2016

Modified Files:
src/sys/arch/amd64/amd64: machdep.c

Log Message:
Use KASSERTs supported by CTASSERTs, not __builtin_unreachable.

pcc has no __builtin_unreachable, and this is clearer anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/sys/arch/amd64/amd64/machdep.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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.214 src/sys/arch/amd64/amd64/machdep.c:1.215
--- src/sys/arch/amd64/amd64/machdep.c:1.214	Sun Nov 22 13:41:24 2015
+++ src/sys/arch/amd64/amd64/machdep.c	Mon Feb 15 20:35:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.214 2015/11/22 13:41:24 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.215 2016/02/15 20:35:59 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.214 2015/11/22 13:41:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.215 2016/02/15 20:35:59 riastradh Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -2073,9 +2073,11 @@ valid_user_selector(struct lwp *l, uint6
 		if (off > (len - 8))
 			return EINVAL;
 	} else {
-		if (seg != GUDATA_SEL || seg != GUDATA32_SEL)
-			return EINVAL;
-		__builtin_unreachable();
+		CTASSERT(GUDATA_SEL & SEL_LDT);
+		KASSERT(seg != GUDATA_SEL);
+		CTASSERT(GUDATA32_SEL & SEL_LDT);
+		KASSERT(seg != GUDATA32_SEL);
+		return EINVAL;
 	}
 
 	sdp = (struct mem_segment_descriptor *)(dt + off);



CVS commit: src/share/man/man9lua

2016-02-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 15 20:33:18 UTC 2016

Modified Files:
src/share/man/man9lua: pmf.9lua

Log Message:
fix english


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man9lua/pmf.9lua

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/man9lua/pmf.9lua
diff -u src/share/man/man9lua/pmf.9lua:1.2 src/share/man/man9lua/pmf.9lua:1.3
--- src/share/man/man9lua/pmf.9lua:1.2	Mon Jan  6 13:03:33 2014
+++ src/share/man/man9lua/pmf.9lua	Mon Feb 15 20:33:18 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pmf.9lua,v 1.2 2014/01/06 13:03:33 wiz Exp $
+.\"	$NetBSD: pmf.9lua,v 1.3 2016/02/15 20:33:18 snj Exp $
 .\"
 .\" Copyright (c) 2013 Marc Balmer . All rights reserved.
 .\"
@@ -87,7 +87,7 @@ Returns nil if the key is not present.
 .Xr pmf 9 ,
 .Xr intro 9lua
 .Sh HISTORY
-An
+A
 .Nm
 Lua manual appeared in
 .Nx 7.0 .



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem

2016-02-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 15 19:36:35 UTC 2016

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem:
nouveau_subdev_instmem_nv40.c

Log Message:
Print error code for failure to map PRAMIN BAR.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c:1.2 src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c:1.2	Sat Aug 23 08:03:34 2014
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/instmem/nouveau_subdev_instmem_nv40.c	Mon Feb 15 19:36:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $	*/
+/*	$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.3 2016/02/15 19:36:35 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_subdev_instmem_nv40.c,v 1.3 2016/02/15 19:36:35 riastradh Exp $");
 
 #include 
 
@@ -80,10 +80,12 @@ nv40_instmem_ctor(struct nouveau_object 
 #ifdef __NetBSD__
 	priv->iomemt = nv_device_resource_tag(device, bar);
 	priv->iomemsz = nv_device_resource_len(device, bar);
-	if (bus_space_map(priv->iomemt, nv_device_resource_start(device, bar),
-		priv->iomemsz, 0, >iomemh)) {
+	ret = bus_space_map(priv->iomemt,
+	nv_device_resource_start(device, bar),
+	priv->iomemsz, 0, >iomemh);
+	if (ret) {
 		priv->iomemsz = 0;
-		nv_error(priv, "unable to map PRAMIN BAR\n");
+		nv_error(priv, "unable to map PRAMIN BAR: %d\n", ret);
 		return -EFAULT;
 	}
 #else



CVS commit: src/sys/netinet

2016-02-15 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Mon Feb 15 19:00:42 UTC 2016

Modified Files:
src/sys/netinet: sctp_indata.c sctputil.c

Log Message:
Fix building of IPv4-Mapped IPv6 addresses.

As discussed on tech-net@ use in6_sin_2_v4mapsin6() to build mapped
addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/sctp_indata.c
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/sctputil.c

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

Modified files:

Index: src/sys/netinet/sctp_indata.c
diff -u src/sys/netinet/sctp_indata.c:1.2 src/sys/netinet/sctp_indata.c:1.3
--- src/sys/netinet/sctp_indata.c:1.2	Sun Dec 13 18:53:57 2015
+++ src/sys/netinet/sctp_indata.c	Mon Feb 15 19:00:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sctp_indata.c,v 1.2 2015/12/13 18:53:57 christos Exp $ */
+/*	$NetBSD: sctp_indata.c,v 1.3 2016/02/15 19:00:42 rtr Exp $ */
 /*	$KAME: sctp_indata.c,v 1.36 2005/03/06 16:04:17 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.2 2015/12/13 18:53:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_indata.c,v 1.3 2016/02/15 19:00:42 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -424,13 +424,7 @@ sctp_deliver_data(struct sctp_tcb *stcb,
 			const struct sockaddr_in *sin;
 
 			sin = (const struct sockaddr_in *)to;
-			memset(, 0, sizeof(sin6));
-			sin6.sin6_family = AF_INET6;
-			sin6.sin6_len = sizeof(struct sockaddr_in6);
-			sin6.sin6_addr.s6_addr16[2] = 0x;
-			bcopy(>sin_addr, _addr.s6_addr16[3],
-			sizeof(sin6.sin6_addr.s6_addr16[3]));
-			sin6.sin6_port = sin->sin_port;
+			in6_sin_2_v4mapsin6(sin, );
 			to = (struct sockaddr *)
 		}
 		/* check and strip embedded scope junk */
@@ -653,14 +647,7 @@ sctp_service_reassembly(struct sctp_tcb 
 const struct sockaddr_in *sin;
 
 sin = satocsin(to);
-memset(, 0, sizeof(sin6));
-sin6.sin6_family = AF_INET6;
-sin6.sin6_len = sizeof(struct sockaddr_in6);
-sin6.sin6_addr.s6_addr16[2] = 0x;
-bcopy(>sin_addr,
-  _addr.s6_addr16[3],
-  sizeof(sin6.sin6_addr.s6_addr16[3]));
-sin6.sin6_port = sin->sin_port;
+in6_sin_2_v4mapsin6(sin, );
 to = (struct sockaddr *)
 			}
 			/* check and strip embedded scope junk */
@@ -1962,14 +1949,7 @@ sctp_process_a_data_chunk(struct sctp_tc
 			const struct sockaddr_in *sin;
 
 			sin = satocsin(to);
-			memset(, 0, sizeof(sin6));
-			sin6.sin6_family = AF_INET6;
-			sin6.sin6_len = sizeof(struct sockaddr_in6);
-			sin6.sin6_addr.s6_addr16[2] = 0x;
-			bcopy(>sin_addr,
-			_addr.s6_addr16[3],
-			sizeof(sin6.sin6_addr.s6_addr16[3]));
-			sin6.sin6_port = sin->sin_port;
+			in6_sin_2_v4mapsin6(sin, );
 			to = (struct sockaddr *)
 		}
 

Index: src/sys/netinet/sctputil.c
diff -u src/sys/netinet/sctputil.c:1.1 src/sys/netinet/sctputil.c:1.2
--- src/sys/netinet/sctputil.c:1.1	Tue Oct 13 21:28:35 2015
+++ src/sys/netinet/sctputil.c	Mon Feb 15 19:00:42 2016
@@ -1,5 +1,5 @@
 /*	$KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $	*/
-/*	$NetBSD: sctputil.c,v 1.1 2015/10/13 21:28:35 rjs Exp $	*/
+/*	$NetBSD: sctputil.c,v 1.2 2016/02/15 19:00:42 rtr Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.1 2015/10/13 21:28:35 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.2 2016/02/15 19:00:42 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2087,13 +2087,7 @@ sctp_notify_assoc_change(u_int32_t event
 		const struct sockaddr_in *sin;
 
 		sin = (const struct sockaddr_in *)to;
-		memset(, 0, sizeof(sin6));
-		sin6.sin6_family = AF_INET6;
-		sin6.sin6_len = sizeof(struct sockaddr_in6);
-		sin6.sin6_addr.s6_addr16[2] = 0x;
-		memcpy(_addr.s6_addr16[3], >sin_addr,
-		sizeof(sin6.sin6_addr.s6_addr16[3]));
-		sin6.sin6_port = sin->sin_port;
+		in6_sin_2_v4mapsin6(sin, );
 		to = (struct sockaddr *)
 	}
 	/* check and strip embedded scope junk */
@@ -2179,13 +2173,7 @@ sctp_notify_peer_addr_change(struct sctp
 		const struct sockaddr_in *sin;
 
 		sin = (const struct sockaddr_in *)to;
-		memset(, 0, sizeof(sin6));
-		sin6.sin6_family = AF_INET6;
-		sin6.sin6_len = sizeof(struct sockaddr_in6);
-		sin6.sin6_addr.s6_addr16[2] = 0x;
-		bcopy(>sin_addr, _addr.s6_addr16[3],
-		sizeof(sin6.sin6_addr.s6_addr16[3]));
-		sin6.sin6_port = sin->sin_port;
+		in6_sin_2_v4mapsin6(sin, );
 		to = (struct sockaddr *)
 	}
 	/* check and strip embedded scope junk */
@@ -2279,13 +2267,7 @@ sctp_notify_send_failed(struct sctp_tcb 
 		const struct sockaddr_in *sin;
 
 		sin = satocsin(to);
-		memset(, 0, sizeof(sin6));
-		sin6.sin6_family = AF_INET6;
-		sin6.sin6_len = sizeof(struct sockaddr_in6);
-		sin6.sin6_addr.s6_addr16[2] = 0x;
-		bcopy(>sin_addr, _addr.s6_addr16[3],
-		sizeof(sin6.sin6_addr.s6_addr16[3]));
-		sin6.sin6_port = sin->sin_port;
+		

CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 17:35:39 UTC 2016

Modified Files:
src/lib/libedit: sys.h

Log Message:
forgot one fgetln define


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libedit/sys.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/libedit/sys.h
diff -u src/lib/libedit/sys.h:1.19 src/lib/libedit/sys.h:1.20
--- src/lib/libedit/sys.h:1.19	Mon Feb 15 11:14:39 2016
+++ src/lib/libedit/sys.h	Mon Feb 15 12:35:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys.h,v 1.19 2016/02/15 16:14:39 christos Exp $	*/
+/*	$NetBSD: sys.h,v 1.20 2016/02/15 17:35:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -87,7 +87,7 @@ size_t	strlcat(char *dst, const char *sr
 size_t	strlcpy(char *dst, const char *src, size_t size);
 #endif
 
-#ifndef HAVE_FGETLN
+#ifndef HAVE_GETLINE
 #define	getline libedit_getline
 ssize_t	getline(char **line, size_t *len, FILE *fp);
 #endif



CVS commit: [nick-nhusb] src/sys/dev/usb

2016-02-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb 15 17:00:27 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhci.c

Log Message:
KF


To generate a diff of this commit:
cvs rdiff -u -r1.264.4.58 -r1.264.4.59 src/sys/dev/usb/uhci.c

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

Modified files:

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.58 src/sys/dev/usb/uhci.c:1.264.4.59
--- src/sys/dev/usb/uhci.c:1.264.4.58	Mon Feb  8 11:16:02 2016
+++ src/sys/dev/usb/uhci.c	Mon Feb 15 17:00:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.4.58 2016/02/08 11:16:02 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.4.59 2016/02/15 17:00:27 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.58 2016/02/08 11:16:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.59 2016/02/15 17:00:27 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -1319,7 +1319,8 @@ uhci_intr1(uhci_softc_t *sc)
 	KASSERT(mutex_owned(>sc_intr_lock));
 
 	status = UREAD2(sc, UHCI_STS) & UHCI_STS_ALLINTRS;
-	if (status == 0)	/* The interrupt was not for us. */
+	/* Check if the interrupt was for us. */
+	if (status == 0)
 		return 0;
 
 	if (sc->sc_suspend != PWR_RESUME) {



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 16:14:39 UTC 2016

Modified Files:
src/lib/libedit: config.h sys.h

Log Message:
change tests for fgetln.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libedit/config.h
cvs rdiff -u -r1.18 -r1.19 src/lib/libedit/sys.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/libedit/config.h
diff -u src/lib/libedit/config.h:1.5 src/lib/libedit/config.h:1.6
--- src/lib/libedit/config.h:1.5	Fri Jul 29 16:57:34 2011
+++ src/lib/libedit/config.h	Mon Feb 15 11:14:39 2016
@@ -20,8 +20,8 @@
 /* Define to 1 if you have the  header file. */
 #define HAVE_FCNTL_H 1
 
-/* Define to 1 if you have the `fgetln' function. */
-#define HAVE_FGETLN 1
+/* Define to 1 if you have the `getline' function. */
+#define HAVE_GETLINE 1
 
 /* Define to 1 if you have the `fork' function. */
 #define HAVE_FORK 1

Index: src/lib/libedit/sys.h
diff -u src/lib/libedit/sys.h:1.18 src/lib/libedit/sys.h:1.19
--- src/lib/libedit/sys.h:1.18	Thu Feb 11 14:21:04 2016
+++ src/lib/libedit/sys.h	Mon Feb 15 11:14:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys.h,v 1.18 2016/02/11 19:21:04 christos Exp $	*/
+/*	$NetBSD: sys.h,v 1.19 2016/02/15 16:14:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -88,8 +88,8 @@ size_t	strlcpy(char *dst, const char *sr
 #endif
 
 #ifndef HAVE_FGETLN
-#define	fgetln libedit_fgetln
-char	*fgetln(FILE *fp, size_t *len);
+#define	getline libedit_getline
+ssize_t	getline(char **line, size_t *len, FILE *fp);
 #endif
 
 #ifndef HAVE_WCSDUP



CVS commit: src/lib/lua/sqlite

2016-02-15 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Mon Feb 15 15:56:33 UTC 2016

Modified Files:
src/lib/lua/sqlite: sqlite.c

Log Message:
Fix function name, no functional change.
Found by Travis Paul, (see PR/50786), thanks for reporting!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/lua/sqlite/sqlite.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/lua/sqlite/sqlite.c
diff -u src/lib/lua/sqlite/sqlite.c:1.7 src/lib/lua/sqlite/sqlite.c:1.8
--- src/lib/lua/sqlite/sqlite.c:1.7	Sat Jul 19 18:38:34 2014
+++ src/lib/lua/sqlite/sqlite.c	Mon Feb 15 15:56:33 2016
@@ -1,7 +1,7 @@
-/*	$NetBSD: sqlite.c,v 1.7 2014/07/19 18:38:34 lneto Exp $ */
+/*	$NetBSD: sqlite.c,v 1.8 2016/02/15 15:56:33 mbalmer Exp $ */
 
 /*
- * Copyright (c) 2011, 2013 Marc Balmer 
+ * Copyright (c) 2011, 2013, 2016 Marc Balmer 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -392,7 +392,7 @@ static const struct constant sqlite_cons
 };
 
 static void
-gpio_set_info(lua_State *L)
+sqlite_set_info(lua_State *L)
 {
 	lua_pushliteral(L, "_COPYRIGHT");
 	lua_pushliteral(L, "Copyright (C) 2011, 2012, 2013 by "
@@ -449,7 +449,7 @@ luaopen_sqlite(lua_State* L)
 	luaL_newlib(L, sqlite_methods);
 	luaL_setfuncs(L, db_methods, 0);
 	luaL_setfuncs(L, stmt_methods, 0);
-	gpio_set_info(L);
+	sqlite_set_info(L);
 
 	/* The database connection metatable */
 	if (luaL_newmetatable(L, SQLITE_DB_METATABLE)) {



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 15:53:45 UTC 2016

Modified Files:
src/lib/libedit: el.c history.c

Log Message:
Use getline for better portability.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/lib/libedit/el.c
cvs rdiff -u -r1.49 -r1.50 src/lib/libedit/history.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/el.c
diff -u src/lib/libedit/el.c:1.76 src/lib/libedit/el.c:1.77
--- src/lib/libedit/el.c:1.76	Mon Feb 15 10:18:01 2016
+++ src/lib/libedit/el.c	Mon Feb 15 10:53:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: el.c,v 1.76 2016/02/15 15:18:01 christos Exp $	*/
+/*	$NetBSD: el.c,v 1.77 2016/02/15 15:53:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)el.c	8.2 (Berkeley) 1/3/94";
 #else
-__RCSID("$NetBSD: el.c,v 1.76 2016/02/15 15:18:01 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.77 2016/02/15 15:53:45 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -513,6 +513,7 @@ el_source(EditLine *el, const char *fnam
 {
 	FILE *fp;
 	size_t len;
+	ssize_t slen;
 	char *ptr;
 	char *path = NULL;
 	const Char *dptr;
@@ -549,15 +550,17 @@ el_source(EditLine *el, const char *fnam
 		return -1;
 	}
 
-	for (; (ptr = fparseln(fp, , NULL, NULL, 0)) != NULL; free(ptr)) {
+	ptr = NULL;
+	len = 0;
+	while ((slen = getline(, , fp)) != -1) {
 		if (*ptr == '\n')
 			continue;	/* Empty line. */
+		if (slen > 0 && ptr[--slen] == '\n')
+			ptr[slen] = '\0';
+
 		dptr = ct_decode_string(ptr, >el_scratch);
 		if (!dptr)
 			continue;
-		if (len > 0 && dptr[len - 1] == '\n')
-			--len;
-
 		/* loop until first non-space char or EOL */
 		while (*dptr != '\0' && Isspace(*dptr))
 			dptr++;

Index: src/lib/libedit/history.c
diff -u src/lib/libedit/history.c:1.49 src/lib/libedit/history.c:1.50
--- src/lib/libedit/history.c:1.49	Mon Feb 15 10:30:50 2016
+++ src/lib/libedit/history.c	Mon Feb 15 10:53:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.49 2016/02/15 15:30:50 christos Exp $	*/
+/*	$NetBSD: history.c,v 1.50 2016/02/15 15:53:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.49 2016/02/15 15:30:50 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.50 2016/02/15 15:53:45 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -732,7 +732,9 @@ history_load(TYPE(History) *h, const cha
 {
 	FILE *fp;
 	char *line;
-	size_t sz, max_size;
+	size_t llen;
+	ssize_t sz;
+	size_t max_size;
 	char *ptr;
 	int i = -1;
 	TYPE(HistEvent) ev;
@@ -743,20 +745,24 @@ history_load(TYPE(History) *h, const cha
 	if ((fp = fopen(fname, "r")) == NULL)
 		return i;
 
-	if ((line = fparseln(fp, , NULL, NULL, 0)) == NULL)
+	line = NULL;
+	llen = 0;
+	if ((sz = getline(, , fp)) == -1)
 		goto done;
 
-	if (strncmp(line, hist_cookie, sz) != 0)
+	if (strncmp(line, hist_cookie, (size_t)sz) != 0)
 		goto done;
 
 	ptr = h_malloc((max_size = 1024) * sizeof(*ptr));
 	if (ptr == NULL)
 		goto done;
 	free(line);
-	for (i = 0; (line = fparseln(fp, , NULL, NULL, 0)) != NULL; i++) {
-		if (max_size < sz) {
+	for (i = 0; (sz = getline(, , fp)) != -1; i++) {
+		if (sz > 0 && line[sz - 1] == '\n')
+			line[--sz] = '\0';
+		if (max_size < (size_t)sz) {
 			char *nptr;
-			max_size = (sz + 1024) & (size_t)~1023;
+			max_size = ((size_t)sz + 1024) & (size_t)~1023;
 			nptr = h_realloc(ptr, max_size * sizeof(*ptr));
 			if (nptr == NULL) {
 i = -1;



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 15:37:20 UTC 2016

Modified Files:
src/lib/libedit: tokenizer.c

Log Message:
OpenBSD tokenizer.c rev. 1.8 2003/08/11 18:21:40 deraadt
don't increase amax on realloc failure


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libedit/tokenizer.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/tokenizer.c
diff -u src/lib/libedit/tokenizer.c:1.22 src/lib/libedit/tokenizer.c:1.23
--- src/lib/libedit/tokenizer.c:1.22	Fri Jan 29 23:02:51 2016
+++ src/lib/libedit/tokenizer.c	Mon Feb 15 10:37:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tokenizer.c,v 1.22 2016/01/30 04:02:51 christos Exp $	*/
+/*	$NetBSD: tokenizer.c,v 1.23 2016/02/15 15:37:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)tokenizer.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tokenizer.c,v 1.22 2016/01/30 04:02:51 christos Exp $");
+__RCSID("$NetBSD: tokenizer.c,v 1.23 2016/02/15 15:37:20 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -413,8 +413,10 @@ FUN(tok,line)(TYPE(Tokenizer) *tok, cons
 			Char **p;
 			tok->amax += AINCR;
 			p = tok_realloc(tok->argv, tok->amax * sizeof(*p));
-			if (p == NULL)
+			if (p == NULL) {
+tok->amax -= AINCR;
 return -1;
+			}
 			tok->argv = p;
 		}
 	}



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 15:35:03 UTC 2016

Modified Files:
src/lib/libedit: terminal.c

Log Message:
OpenBSD term.c rev. 1.13 2009/12/11 18:58:59 jacekm
fix two memory leaks


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libedit/terminal.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/terminal.c
diff -u src/lib/libedit/terminal.c:1.16 src/lib/libedit/terminal.c:1.17
--- src/lib/libedit/terminal.c:1.16	Sun Feb 14 09:49:34 2016
+++ src/lib/libedit/terminal.c	Mon Feb 15 10:35:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: terminal.c,v 1.16 2016/02/14 14:49:34 christos Exp $	*/
+/*	$NetBSD: terminal.c,v 1.17 2016/02/15 15:35:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)term.c	8.2 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: terminal.c,v 1.16 2016/02/14 14:49:34 christos Exp $");
+__RCSID("$NetBSD: terminal.c,v 1.17 2016/02/15 15:35:03 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -272,31 +272,45 @@ terminal_init(EditLine *el)
 	el->el_terminal.t_buf = el_malloc(TC_BUFSIZE *
 	sizeof(*el->el_terminal.t_buf));
 	if (el->el_terminal.t_buf == NULL)
-		return -1;
+		goto fail1;
 	el->el_terminal.t_cap = el_malloc(TC_BUFSIZE *
 	sizeof(*el->el_terminal.t_cap));
 	if (el->el_terminal.t_cap == NULL)
-		return -1;
+		goto fail2;
 	el->el_terminal.t_fkey = el_malloc(A_K_NKEYS *
 	sizeof(*el->el_terminal.t_fkey));
 	if (el->el_terminal.t_fkey == NULL)
-		return -1;
+		goto fail3;
 	el->el_terminal.t_loc = 0;
 	el->el_terminal.t_str = el_malloc(T_str *
 	sizeof(*el->el_terminal.t_str));
 	if (el->el_terminal.t_str == NULL)
-		return -1;
+		goto fail4;
 	(void) memset(el->el_terminal.t_str, 0, T_str *
 	sizeof(*el->el_terminal.t_str));
 	el->el_terminal.t_val = el_malloc(T_val *
 	sizeof(*el->el_terminal.t_val));
 	if (el->el_terminal.t_val == NULL)
-		return -1;
+		goto fail5;
 	(void) memset(el->el_terminal.t_val, 0, T_val *
 	sizeof(*el->el_terminal.t_val));
 	(void) terminal_set(el, NULL);
 	terminal_init_arrow(el);
 	return 0;
+fail5:
+	free(el->el_terminal.t_str);
+	el->el_terminal.t_str = NULL;
+fail4:
+	free(el->el_terminal.t_fkey);
+	el->el_terminal.t_fkey = NULL;
+fail3:
+	free(el->el_terminal.t_cap);
+	el->el_terminal.t_cap = NULL;
+fail2:
+	free(el->el_terminal.t_buf);
+	el->el_terminal.t_buf = NULL;
+fail1:
+	return -1;
 }
 
 /* terminal_end():
@@ -418,14 +432,14 @@ terminal_alloc_display(EditLine *el)
 
 	b =  el_malloc(sizeof(*b) * (size_t)(c->v + 1));
 	if (b == NULL)
-		return -1;
+		goto done;
 	for (i = 0; i < c->v; i++) {
 		b[i] = el_malloc(sizeof(**b) * (size_t)(c->h + 1));
 		if (b[i] == NULL) {
 			while (--i >= 0)
 el_free(b[i]);
 			el_free(b);
-			return -1;
+			goto done;
 		}
 	}
 	b[c->v] = NULL;
@@ -433,19 +447,22 @@ terminal_alloc_display(EditLine *el)
 
 	b = el_malloc(sizeof(*b) * (size_t)(c->v + 1));
 	if (b == NULL)
-		return -1;
+		goto done;
 	for (i = 0; i < c->v; i++) {
 		b[i] = el_malloc(sizeof(**b) * (size_t)(c->h + 1));
 		if (b[i] == NULL) {
 			while (--i >= 0)
 el_free(b[i]);
 			el_free(b);
-			return -1;
+			goto done;
 		}
 	}
 	b[c->v] = NULL;
 	el->el_vdisplay = b;
 	return 0;
+done:
+	terminal_free_display(el);
+	return -1;
 }
 
 



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 15:30:50 UTC 2016

Modified Files:
src/lib/libedit: history.c

Log Message:
Change the test for the size of encoded buffer to include the NULL, from
OpenBSD; no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/libedit/history.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/history.c
diff -u src/lib/libedit/history.c:1.48 src/lib/libedit/history.c:1.49
--- src/lib/libedit/history.c:1.48	Mon Feb 15 10:26:48 2016
+++ src/lib/libedit/history.c	Mon Feb 15 10:30:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.48 2016/02/15 15:26:48 christos Exp $	*/
+/*	$NetBSD: history.c,v 1.49 2016/02/15 15:30:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.48 2016/02/15 15:26:48 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.49 2016/02/15 15:30:50 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -806,8 +806,8 @@ history_save_fp(TYPE(History) *h, FILE *
 	retval != -1;
 	retval = HPREV(h, ), i++) {
 		str = ct_encode_string(ev.str, );
-		len = strlen(str) * 4;
-		if (len >= max_size) {
+		len = strlen(str) * 4 + 1;
+		if (len > max_size) {
 			char *nptr;
 			max_size = (len + 1024) & (size_t)~1023;
 			nptr = h_realloc(ptr, max_size * sizeof(*ptr));



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 15:29:25 UTC 2016

Modified Files:
src/lib/libedit: sig.c

Log Message:
OpenBSD sig.c rev. 1.6 2001/12/06 04:26:00 deraadt
save and restore errno in signal handler


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libedit/sig.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/sig.c
diff -u src/lib/libedit/sig.c:1.17 src/lib/libedit/sig.c:1.18
--- src/lib/libedit/sig.c:1.17	Thu Jul 28 16:50:55 2011
+++ src/lib/libedit/sig.c	Mon Feb 15 10:29:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sig.c,v 1.17 2011/07/28 20:50:55 christos Exp $	*/
+/*	$NetBSD: sig.c,v 1.18 2016/02/15 15:29:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)sig.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: sig.c,v 1.17 2011/07/28 20:50:55 christos Exp $");
+__RCSID("$NetBSD: sig.c,v 1.18 2016/02/15 15:29:25 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -68,9 +68,10 @@ private void sig_handler(int);
 private void
 sig_handler(int signo)
 {
-	int i;
+	int i, save_errno;
 	sigset_t nset, oset;
 
+	save_errno = errno;
 	(void) sigemptyset();
 	(void) sigaddset(, signo);
 	(void) sigprocmask(SIG_BLOCK, , );
@@ -104,6 +105,7 @@ sig_handler(int signo)
 	sigemptyset(>el_signal->sig_action[i].sa_mask);
 	(void) sigprocmask(SIG_SETMASK, , NULL);
 	(void) kill(0, signo);
+	errno = save_errno;
 }
 
 



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 15:26:48 UTC 2016

Modified Files:
src/lib/libedit: history.c

Log Message:
Use fparseln to avoid newline hacks.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/lib/libedit/history.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/history.c
diff -u src/lib/libedit/history.c:1.47 src/lib/libedit/history.c:1.48
--- src/lib/libedit/history.c:1.47	Sat May 10 21:05:17 2014
+++ src/lib/libedit/history.c	Mon Feb 15 10:26:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.47 2014/05/11 01:05:17 christos Exp $	*/
+/*	$NetBSD: history.c,v 1.48 2016/02/15 15:26:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.47 2014/05/11 01:05:17 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.48 2016/02/15 15:26:48 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -743,7 +743,7 @@ history_load(TYPE(History) *h, const cha
 	if ((fp = fopen(fname, "r")) == NULL)
 		return i;
 
-	if ((line = fgetln(fp, )) == NULL)
+	if ((line = fparseln(fp, , NULL, NULL, 0)) == NULL)
 		goto done;
 
 	if (strncmp(line, hist_cookie, sz) != 0)
@@ -752,14 +752,8 @@ history_load(TYPE(History) *h, const cha
 	ptr = h_malloc((max_size = 1024) * sizeof(*ptr));
 	if (ptr == NULL)
 		goto done;
-	for (i = 0; (line = fgetln(fp, )) != NULL; i++) {
-		char c = line[sz];
-
-		if (sz != 0 && line[sz - 1] == '\n')
-			line[--sz] = '\0';
-		else
-			line[sz] = '\0';
-
+	free(line);
+	for (i = 0; (line = fparseln(fp, , NULL, NULL, 0)) != NULL; i++) {
 		if (max_size < sz) {
 			char *nptr;
 			max_size = (sz + 1024) & (size_t)~1023;
@@ -771,15 +765,16 @@ history_load(TYPE(History) *h, const cha
 			ptr = nptr;
 		}
 		(void) strunvis(ptr, line);
-		line[sz] = c;
 		if (HENTER(h, , ct_decode_string(ptr, )) == -1) {
 			i = -1;
 			goto oomem;
 		}
+		free(line);
 	}
 oomem:
 	h_free(ptr);
 done:
+	free(line);
 	(void) fclose(fp);
 	return i;
 }



CVS commit: src/lib/libedit

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 15:18:01 UTC 2016

Modified Files:
src/lib/libedit: el.c

Log Message:
use fparseln() to avoid needing to deal with missing \n in the last line
and also to handle comments automatically.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/lib/libedit/el.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/el.c
diff -u src/lib/libedit/el.c:1.75 src/lib/libedit/el.c:1.76
--- src/lib/libedit/el.c:1.75	Thu Feb 11 14:21:04 2016
+++ src/lib/libedit/el.c	Mon Feb 15 10:18:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: el.c,v 1.75 2016/02/11 19:21:04 christos Exp $	*/
+/*	$NetBSD: el.c,v 1.76 2016/02/15 15:18:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)el.c	8.2 (Berkeley) 1/3/94";
 #else
-__RCSID("$NetBSD: el.c,v 1.75 2016/02/11 19:21:04 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.76 2016/02/15 15:18:01 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -549,7 +549,7 @@ el_source(EditLine *el, const char *fnam
 		return -1;
 	}
 
-	while ((ptr = fgetln(fp, )) != NULL) {
+	for (; (ptr = fparseln(fp, , NULL, NULL, 0)) != NULL; free(ptr)) {
 		if (*ptr == '\n')
 			continue;	/* Empty line. */
 		dptr = ct_decode_string(ptr, >el_scratch);
@@ -566,6 +566,7 @@ el_source(EditLine *el, const char *fnam
 		if ((error = parse_line(el, dptr)) == -1)
 			break;
 	}
+	free(ptr);
 
 	el_free(path);
 	(void) fclose(fp);



CVS commit: src/sys

2016-02-15 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Mon Feb 15 14:59:03 UTC 2016

Modified Files:
src/sys/netinet: in_pcb.c tcp_input.c tcp_subr.c tcp_usrreq.c
udp_usrreq.c
src/sys/netinet6: in6.c in6.h

Log Message:
Reduce code duplication.

Split creation of IPv4-Mapped IPv6 addresses into its own function
and use it.

No functional change intended.  As posted to tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.344 -r1.345 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.264 -r1.265 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.210 -r1.211 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.223 -r1.224 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.194 -r1.195 src/sys/netinet6/in6.c
cvs rdiff -u -r1.86 -r1.87 src/sys/netinet6/in6.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/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.162 src/sys/netinet/in_pcb.c:1.163
--- src/sys/netinet/in_pcb.c:1.162	Mon Aug 24 22:21:26 2015
+++ src/sys/netinet/in_pcb.c	Mon Feb 15 14:59:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.162 2015/08/24 22:21:26 pooka Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.163 2016/02/15 14:59:03 rtr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.162 2015/08/24 22:21:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.163 2016/02/15 14:59:03 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -347,10 +347,7 @@ in_pcbbind_port(struct inpcb *inp, struc
 			return (EACCES);
 
 #ifdef INET6
-		memset(, 0, sizeof(mapped));
-		mapped.s6_addr16[5] = 0x;
-		memcpy(_addr32[3], >sin_addr,
-		sizeof(mapped.s6_addr32[3]));
+		in6_in_2_v4mapin6(>sin_addr, );
 		t6 = in6_pcblookup_port(table, , sin->sin_port, wild, );
 		if (t6 && (reuseport & t6->in6p_socket->so_options) == 0)
 			return (EADDRINUSE);

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.344 src/sys/netinet/tcp_input.c:1.345
--- src/sys/netinet/tcp_input.c:1.344	Mon Aug 24 22:21:26 2015
+++ src/sys/netinet/tcp_input.c	Mon Feb 15 14:59:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.344 2015/08/24 22:21:26 pooka Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.345 2016/02/15 14:59:03 rtr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.344 2015/08/24 22:21:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.345 2016/02/15 14:59:03 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1424,12 +1424,8 @@ findpcb:
 			struct in6_addr s, d;
 
 			/* mapped addr case */
-			memset(, 0, sizeof(s));
-			s.s6_addr16[5] = htons(0x);
-			bcopy(>ip_src, _addr32[3], sizeof(ip->ip_src));
-			memset(, 0, sizeof(d));
-			d.s6_addr16[5] = htons(0x);
-			bcopy(>ip_dst, _addr32[3], sizeof(ip->ip_dst));
+			in6_in_2_v4mapin6(>ip_src, );
+			in6_in_2_v4mapin6(>ip_dst, );
 			in6p = in6_pcblookup_connect(, ,
 		 th->th_sport, , th->th_dport,
 		 0, );
@@ -4086,14 +4082,7 @@ syn_cache_get(struct sockaddr *src, stru
 		memcpy(, src, src->sa_len);
 		if (src->sa_family == AF_INET) {
 			/* IPv4 packet to AF_INET6 socket */
-			memset(, 0, sizeof(sin6));
-			sin6.sin6_family = AF_INET6;
-			sin6.sin6_len = sizeof(sin6);
-			sin6.sin6_port = ((struct sockaddr_in *)src)->sin_port;
-			sin6.sin6_addr.s6_addr16[5] = htons(0x);
-			bcopy(&((struct sockaddr_in *)src)->sin_addr,
-_addr.s6_addr32[3],
-sizeof(sin6.sin6_addr.s6_addr32[3]));
+			in6_sin_2_v4mapsin6((struct sockaddr_in *)src, );
 		}
 		if (in6_pcbconnect(in6p, , NULL)) {
 			goto resetandabort;

Index: src/sys/netinet/tcp_subr.c
diff -u src/sys/netinet/tcp_subr.c:1.264 src/sys/netinet/tcp_subr.c:1.265
--- src/sys/netinet/tcp_subr.c:1.264	Mon Sep  7 01:56:50 2015
+++ src/sys/netinet/tcp_subr.c	Mon Feb 15 14:59:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_subr.c,v 1.264 2015/09/07 01:56:50 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_subr.c,v 1.265 2016/02/15 14:59:03 rtr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.264 2015/09/07 01:56:50 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.265 2016/02/15 14:59:03 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1603,11 +1603,8 @@ tcp_ctlinput(int cmd, const struct socka
 		 */
 		th = (struct tcphdr *)((char *)ip + (ip->ip_hl << 2));
 #ifdef INET6
-		memset(, 0, sizeof(src6));
-		memset(, 0, sizeof(dst6));
-		src6.s6_addr16[5] = dst6.s6_addr16[5] = 0x;
-		memcpy(_addr32[3], >ip_src, sizeof(struct in_addr));
-		memcpy(_addr32[3], >ip_dst, sizeof(struct in_addr));
+		in6_in_2_v4mapin6(>ip_src, );
+		in6_in_2_v4mapin6(>ip_dst, );
 #endif
 		if ((inp = 

CVS commit: src/tests/kernel

2016-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 15 14:59:38 UTC 2016

Modified Files:
src/tests/kernel: Makefile

Log Message:
This needs _KERNTYPES on some platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/kernel/Makefile

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

Modified files:

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.38 src/tests/kernel/Makefile:1.39
--- src/tests/kernel/Makefile:1.38	Sat Jan 23 16:22:48 2016
+++ src/tests/kernel/Makefile	Mon Feb 15 09:59:38 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.38 2016/01/23 21:22:48 christos Exp $
+# $NetBSD: Makefile,v 1.39 2016/02/15 14:59:38 christos Exp $
 
 NOMAN=		# defined
 
@@ -46,8 +46,8 @@ CPPFLAGS+=	-D_KERNTYPES
 .PATH:			${NETBSDSRCDIR}/sys/kern
 TESTS_C+=		t_extent
 SRCS.t_extent=		t_extent.c subr_extent.c
-CPPFLAGS.t_extent.c=	-D_EXTENT_TESTING -D__POOL_EXPOSE
-CPPFLAGS.subr_extent.c=	-D_EXTENT_TESTING -D__POOL_EXPOSE
+CPPFLAGS.t_extent.c=	-D_EXTENT_TESTING -D__POOL_EXPOSE -D_KERNTYPES
+CPPFLAGS.subr_extent.c=	-D_EXTENT_TESTING -D__POOL_EXPOSE -D_KERNTYPES
 
 t_subr_prf.c: gen_t_subr_prf ${NETBSDSRCDIR}/sys/kern/subr_prf.c
 	${HOST_SH} ${.ALLSRC} ${.TARGET}



CVS commit: src/tools/gcc

2016-02-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 15 13:25:12 UTC 2016

Modified Files:
src/tools/gcc: Makefile

Log Message:
Add missing closing ) and line continuation for mknative


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/tools/gcc/Makefile

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

Modified files:

Index: src/tools/gcc/Makefile
diff -u src/tools/gcc/Makefile:1.75 src/tools/gcc/Makefile:1.76
--- src/tools/gcc/Makefile:1.75	Sun Jan 24 05:10:26 2016
+++ src/tools/gcc/Makefile	Mon Feb 15 13:25:12 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.75 2016/01/24 05:10:26 mrg Exp $
+#	$NetBSD: Makefile,v 1.76 2016/02/15 13:25:12 martin Exp $
 
 .include 
 
@@ -209,7 +209,7 @@ MKENV_BUILD_MAKE=cd .native && ${MKNATIV
 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
 		(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e tree-check.h config.h multilib.h gcov-iov.h)
 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \
-		(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h unwind.h
+		(cd .native/gcc && ${MKNATIVE_ENV} ${BUILD_MAKE} -e libgcc.mvars tconfig.h unwind.h); \
 		(cd .native && touch gcc/cc1obj gcc/cc1plus gcc/f771 gcc/libgcc.a gcc/libgcc_s.so)
 .for _lib in ${MKNATIVE_CONFIG_TARGET_LIBS}
 	PATH=${TOOLDIR}/bin:$$PATH; export PATH; \



CVS commit: src/lib/libc/rpc

2016-02-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 15 11:07:48 UTC 2016

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

Log Message:
Avoid strict alias violation for VAX


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/rpc/xdr_float.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/xdr_float.c
diff -u src/lib/libc/rpc/xdr_float.c:1.40 src/lib/libc/rpc/xdr_float.c:1.41
--- src/lib/libc/rpc/xdr_float.c:1.40	Sun Aug 24 17:07:00 2014
+++ src/lib/libc/rpc/xdr_float.c	Mon Feb 15 11:07:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: xdr_float.c,v 1.40 2014/08/24 17:07:00 matt Exp $	*/
+/*	$NetBSD: xdr_float.c,v 1.41 2016/02/15 11:07:48 martin Exp $	*/
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -37,7 +37,7 @@
 static char *sccsid = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
 static char *sccsid = "@(#)xdr_float.c	2.1 88/07/29 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: xdr_float.c,v 1.40 2014/08/24 17:07:00 matt Exp $");
+__RCSID("$NetBSD: xdr_float.c,v 1.41 2016/02/15 11:07:48 martin Exp $");
 #endif
 #endif
 
@@ -57,6 +57,7 @@ __RCSID("$NetBSD: xdr_float.c,v 1.40 201
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -303,7 +304,7 @@ xdr_double(XDR *xdrs, double *dp)
 		vd.mantissa4 = (id.mantissa2 << 3);
 	doneit:
 		vd.sign = id.sign;
-		*dp = *((double *)(void *));
+		memcpy(dp, , sizeof(double));
 		return (TRUE);
 #endif
 



CVS commit: src/sys/net

2016-02-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb 15 08:08:04 UTC 2016

Modified Files:
src/sys/net: if.c if.h

Log Message:
Run if_link_state_change in softint

if_link_state_change can execute the network stack that is expected to
not run in hardware interrupt (at least now), however network drivers
may call it in hardware interrupt. Avoid that by introducing a new
softint for if_link_state_change.

The original patch is provided by mlelstv@ and tweaked a bit by me.

Should fix PR kern/50602.


To generate a diff of this commit:
cvs rdiff -u -r1.323 -r1.324 src/sys/net/if.c
cvs rdiff -u -r1.195 -r1.196 src/sys/net/if.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/net/if.c
diff -u src/sys/net/if.c:1.323 src/sys/net/if.c:1.324
--- src/sys/net/if.c:1.323	Tue Feb  9 08:32:12 2016
+++ src/sys/net/if.c	Mon Feb 15 08:08:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.323 2016/02/09 08:32:12 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.324 2016/02/15 08:08:04 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.323 2016/02/09 08:32:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.324 2016/02/15 08:08:04 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -200,6 +200,7 @@ static void if_attachdomain1(struct ifne
 static int ifconf(u_long, void *);
 static int if_clone_create(const char *);
 static int if_clone_destroy(const char *);
+static void if_link_state_change_si(void *);
 
 struct if_percpuq {
 	struct ifnet	*ipq_ifp;
@@ -602,6 +603,7 @@ if_initialize(ifnet_t *ifp)
 	ifp->if_broadcastaddr = 0; /* reliably crash if used uninitialized */
 
 	ifp->if_link_state = LINK_STATE_UNKNOWN;
+	ifp->if_old_link_state = LINK_STATE_UNKNOWN;
 
 	ifp->if_capenable = 0;
 	ifp->if_csum_flags_tx = 0;
@@ -627,6 +629,10 @@ if_initialize(ifnet_t *ifp)
 
 	IF_AFDATA_LOCK_INIT(ifp);
 
+	ifp->if_link_si = softint_establish(SOFTINT_NET, if_link_state_change_si, ifp);
+	if (ifp->if_link_si == NULL)
+		panic("%s: softint_establish() failed", __func__);
+
 	if_getindex(ifp);
 }
 
@@ -1045,6 +1051,9 @@ again:
 
 	IF_AFDATA_LOCK_DESTROY(ifp);
 
+	softint_disestablish(ifp->if_link_si);
+	ifp->if_link_si = NULL;
+
 	/*
 	 * remove packets that came from ifp, from software interrupt queues.
 	 */
@@ -1562,8 +1571,6 @@ void
 if_link_state_change(struct ifnet *ifp, int link_state)
 {
 	int s;
-	int old_link_state;
-	struct domain *dp;
 
 	s = splnet();
 	if (ifp->if_link_state == link_state) {
@@ -1571,8 +1578,26 @@ if_link_state_change(struct ifnet *ifp, 
 		return;
 	}
 
-	old_link_state = ifp->if_link_state;
 	ifp->if_link_state = link_state;
+	softint_schedule(ifp->if_link_si);
+
+	splx(s);
+}
+
+
+static void
+if_link_state_change_si(void *arg)
+{
+	struct ifnet *ifp = arg;
+	int s;
+	int link_state, old_link_state;
+	struct domain *dp;
+
+	s = splnet();
+	link_state = ifp->if_link_state;
+	old_link_state = ifp->if_old_link_state;
+	ifp->if_old_link_state = ifp->if_link_state;
+
 #ifdef DEBUG
 	log(LOG_DEBUG, "%s: link state %s (was %s)\n", ifp->if_xname,
 		link_state == LINK_STATE_UP ? "UP" :

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.195 src/sys/net/if.h:1.196
--- src/sys/net/if.h:1.195	Tue Feb  9 08:32:12 2016
+++ src/sys/net/if.h	Mon Feb 15 08:08:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.195 2016/02/09 08:32:12 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.196 2016/02/15 08:08:04 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -358,6 +358,8 @@ typedef struct ifnet {
 	struct krwlock	*if_afdata_lock;
 #endif
 	struct if_percpuq	*if_percpuq; /* We should remove it in the future */
+	void	*if_link_si;		/* softint to handle link state changes */
+	int	if_old_link_state;	/* previous link state */
 #endif
 } ifnet_t;