CVS commit: src/sys/net

2014-09-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Sep 15 06:07:37 UTC 2014

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

Log Message:
Delete link local addresses of a vlan interface when detaching its parent

This fixes PR 49197.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.73 src/sys/net/if_vlan.c:1.74
--- src/sys/net/if_vlan.c:1.73	Mon Sep 15 05:54:02 2014
+++ src/sys/net/if_vlan.c	Mon Sep 15 06:07:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.73 2014/09/15 05:54:02 ozaki-r Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.74 2014/09/15 06:07:37 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.73 2014/09/15 05:54:02 ozaki-r Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.74 2014/09/15 06:07:37 ozaki-r Exp $);
 
 #include opt_inet.h
 
@@ -103,6 +103,9 @@ __KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 
 #include netinet/in.h
 #include netinet/if_inarp.h
 #endif
+#ifdef INET6
+#include netinet6/in6_ifattach.h
+#endif
 
 struct vlan_mc_entry {
 	LIST_ENTRY(vlan_mc_entry)	mc_entries;
@@ -400,6 +403,10 @@ vlan_unconfig(struct ifnet *ifp)
 	ifv-ifv_if.if_mtu = 0;
 	ifv-ifv_flags = 0;
 
+#ifdef INET6
+	/* To delete v6 link local addresses */
+	in6_ifdetach(ifp);
+#endif
 	if ((ifp-if_flags  IFF_PROMISC) != 0)
 		ifpromisc(ifp, 0);
 	if_down(ifp);



CVS commit: src/sbin/ifconfig

2014-09-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Sep 15 06:46:04 UTC 2014

Modified Files:
src/sbin/ifconfig: vlan.c

Log Message:
Add -vlanif to the help message of ifconfig

PR 49114


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sbin/ifconfig/vlan.c

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

Modified files:

Index: src/sbin/ifconfig/vlan.c
diff -u src/sbin/ifconfig/vlan.c:1.13 src/sbin/ifconfig/vlan.c:1.14
--- src/sbin/ifconfig/vlan.c:1.13	Tue Jul 28 18:22:33 2009
+++ src/sbin/ifconfig/vlan.c	Mon Sep 15 06:46:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $	*/
+/*	$NetBSD: vlan.c,v 1.14 2014/09/15 06:46:04 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $);
+__RCSID($NetBSD: vlan.c,v 1.14 2014/09/15 06:46:04 ozaki-r Exp $);
 #endif /* not lint */
 
 #include sys/param.h 
@@ -175,7 +175,7 @@ vlan_status(prop_dictionary_t env, prop_
 static void
 vlan_usage(prop_dictionary_t env)
 {
-	fprintf(stderr, \t[ vlan n vlanif i ]\n);
+	fprintf(stderr, \t[ vlan n vlanif i ] [ -vlanif i ]\n);
 }
 
 static void



CVS commit: src/sbin/ifconfig

2014-09-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Sep 15 06:48:05 UTC 2014

Modified Files:
src/sbin/ifconfig: ifconfig.8

Log Message:
Write about -vlanif in ifconfig.8

PR 49114


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sbin/ifconfig/ifconfig.8

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.107 src/sbin/ifconfig/ifconfig.8:1.108
--- src/sbin/ifconfig/ifconfig.8:1.107	Thu Sep 11 13:10:04 2014
+++ src/sbin/ifconfig/ifconfig.8	Mon Sep 15 06:48:05 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: ifconfig.8,v 1.107 2014/09/11 13:10:04 roy Exp $
+.\	$NetBSD: ifconfig.8,v 1.108 2014/09/15 06:48:05 ozaki-r Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)ifconfig.8	8.4 (Berkeley) 6/1/94
 .\
-.Dd January 28, 2012
+.Dd September 15, 2014
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -637,6 +637,12 @@ Note that
 and
 .Cm vlan
 must be set at the same time.
+.It Cm -vlanif Ar iface
+Dissociate
+.Ar iface
+from the
+.Xr vlan 4
+interface.
 .It Cm agrport Ar iface
 Add
 .Ar iface



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

2014-09-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Mon Sep 15 11:49:01 UTC 2014

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S

Log Message:
fix to invalidate all way of own processor


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/cortex/a9_mpsubr.S

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

Modified files:

Index: src/sys/arch/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.19 src/sys/arch/arm/cortex/a9_mpsubr.S:1.20
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.19	Mon Sep 15 00:35:37 2014
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Mon Sep 15 11:49:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.19 2014/09/15 00:35:37 matt Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.20 2014/09/15 11:49:01 ryo Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -369,9 +369,9 @@ cortex_init:
 #ifdef __ARMEB__
 	setend	le
 #endif
-	ldr	r0, [r3, #SCU_CFG]		// read scu config
-	and	r0, r0, #7			// get cpu max
-	add	r0, r0, #2			// adjust to cpu num shift
+	mrc	p15, 0, r0, c0, c0, 5		// MPIDR get
+	and	r0, r0, #3			// get our cpu numder
+	lsl	r0, r0, #2			// adjust to cpu num shift
 	mov	r1, #0xf			// select all ways
 	lsl	r1, r1, r0			// shift into place
 	str	r1, [r3, #SCU_INV_ALL_REG]	// write scu invalidate all



CVS commit: src/external/gpl3/gcc.old/dist/gcc/config/i386

2014-09-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Sep 15 16:29:18 UTC 2014

Modified Files:
src/external/gpl3/gcc.old/dist/gcc/config/i386: pmm_malloc.h

Log Message:
Apply r1.2 from our GCC 4.8 version of the same file:

Kill the throw() on a forward declaration for posix_memalign (it does
not match our base declaration and may cause warnings).


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc.old/dist/gcc/config/i386/pmm_malloc.h

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

Modified files:

Index: src/external/gpl3/gcc.old/dist/gcc/config/i386/pmm_malloc.h
diff -u src/external/gpl3/gcc.old/dist/gcc/config/i386/pmm_malloc.h:1.1.1.1 src/external/gpl3/gcc.old/dist/gcc/config/i386/pmm_malloc.h:1.2
--- src/external/gpl3/gcc.old/dist/gcc/config/i386/pmm_malloc.h:1.1.1.1	Tue Feb 25 18:38:57 2014
+++ src/external/gpl3/gcc.old/dist/gcc/config/i386/pmm_malloc.h	Mon Sep 15 16:29:18 2014
@@ -31,7 +31,7 @@
 #ifndef __cplusplus
 extern int posix_memalign (void **, size_t, size_t);
 #else
-extern C int posix_memalign (void **, size_t, size_t) throw ();
+extern C int posix_memalign (void **, size_t, size_t);
 #endif
 
 static __inline void *



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

2014-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Sep 15 19:02:38 UTC 2014

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S

Log Message:
Don't set CORTEXA9_AUXCTL_FW on A7. It's undefined.

Misc. cleanup while I'm here.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/cortex/a9_mpsubr.S

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

Modified files:

Index: src/sys/arch/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.20 src/sys/arch/arm/cortex/a9_mpsubr.S:1.21
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.20	Mon Sep 15 11:49:01 2014
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Mon Sep 15 19:02:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.20 2014/09/15 11:49:01 ryo Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.21 2014/09/15 19:02:38 skrll Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -443,26 +443,29 @@ cortex_init:
 	mcr	p15, 0, r1, c8, c7, 0	// TLBIALL (just this core)
 #endif
 
+#if defined(MULTIPROCESSOR)
+#if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9)
 	//
-	// Step 4b, set ACTLR.SMP=1
+	// Step 4a, set ACTLR.SMP=1
 	//
 	mrc	p15, 0, r0, c1, c0, 1		// ACTLR read
 	orr	r0, r0, #CORTEXA9_AUXCTL_SMP	// enable SMP
-	mcr	p15, 0, r0, c1, c0, 1		// ACTLR write
-	isb
 
-#if defined(MULTIPROCESSOR)  (defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9))
+#if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA9)
 	//
-	// Step 4b (continued on A5/A9), ACTRL.FW=1)
+	// Step 4a (continued on A5/A9), ACTLR.FW=1)
 	//
 	orr	r0, r0, #CORTEXA9_AUXCTL_FW	// enable cache/tlb/coherency
-	mcr	p15, 0, r0, c1, c0, 1		// ACTRL write
+#endif	/* A5 || A9 */
+
+	mcr	p15, 0, r0, c1, c0, 1		// ACTLR write
 	isb
 	dsb
-#endif
+#endif	/* A5 || A7 || A9 */
+#endif	/* MULTIPROCESSOR */
 
 	//
-	// Step 4a, resoter SCTRL (enable the data cache)
+	// Step 4b, restore SCTRL (enable the data cache)
 	//
 	orr	r4, r4, #CPU_CONTROL_IC_ENABLE	// enable icache
 	orr	r4, r4, #CPU_CONTROL_DC_ENABLE	// enable dcache
@@ -509,7 +512,7 @@ cortex_mpstart:
 
 #if 0
 	mrc	p15, 0, r0, c1, c1, 2		// NSACR read
-	// Allow non-secure access to ACTRL[SMP]
+	// Allow non-secure access to ACTLR[SMP]
 	orr	r0, r0, #NSACR_SMP
 #ifdef FPU_VFP
 	// Allow non-secure access to VFP/Neon



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

2014-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Sep 15 19:28:49 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: mk.awin

Log Message:
Pass BOARDTYPE as a string to awin_machdep.c


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/mk.awin

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/evbarm/conf/mk.awin
diff -u src/sys/arch/evbarm/conf/mk.awin:1.2 src/sys/arch/evbarm/conf/mk.awin:1.3
--- src/sys/arch/evbarm/conf/mk.awin:1.2	Sun Sep  7 06:14:13 2014
+++ src/sys/arch/evbarm/conf/mk.awin	Mon Sep 15 19:28:49 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.awin,v 1.2 2014/09/07 06:14:13 skrll Exp $
+#	$NetBSD: mk.awin,v 1.3 2014/09/15 19:28:49 martin Exp $
 CPPFLAGS+= -mcpu=cortex-a8 -mfpu=neon
 
 .if !empty(MACHINE_ARCH:M*eb)
@@ -8,7 +8,7 @@ EXTRA_LINKFLAGS+=	--be8
 SYSTEM_FIRST_OBJ=	awin_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/awin/awin_start.S
 
-CPPFLAGS.awin_machdep.c+=	-DBOARDTYPE=${BOARDTYPE}
+CPPFLAGS.awin_machdep.c+=	-DBOARDTYPE='${BOARDTYPE}'
 CPPFLAGS.awin_machdep.c+=	-DAWIN_board=AWIN_${BOARDTYPE}
 
 GENASSYM_EXTRAS+=	${THISARM}/awin/genassym.cf



CVS commit: src/sys/arch/evbarm/awin

2014-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Sep 15 19:30:16 UTC 2014

Modified Files:
src/sys/arch/evbarm/awin: awin_machdep.c

Log Message:
BOARDTYPE is now a string, use it directly.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/awin/awin_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/evbarm/awin/awin_machdep.c
diff -u src/sys/arch/evbarm/awin/awin_machdep.c:1.10 src/sys/arch/evbarm/awin/awin_machdep.c:1.11
--- src/sys/arch/evbarm/awin/awin_machdep.c:1.10	Sat Sep 13 02:21:52 2014
+++ src/sys/arch/evbarm/awin/awin_machdep.c	Mon Sep 15 19:30:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_machdep.c,v 1.10 2014/09/13 02:21:52 jmcneill Exp $ */
+/*	$NetBSD: awin_machdep.c,v 1.11 2014/09/15 19:30:16 martin Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_machdep.c,v 1.10 2014/09/13 02:21:52 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_machdep.c,v 1.11 2014/09/15 19:30:16 martin Exp $);
 
 #include opt_machdep.h
 #include opt_ddb.h
@@ -335,7 +335,7 @@ initarm(void *arg)
 
 #ifdef VERBOSE_INIT_ARM
 	/* Talk to the user */
-	printf(\nNetBSD/evbarm ( __STRING(BOARDTYPE) ) booting ...\n);
+	printf(\nNetBSD/evbarm ( BOARDTYPE ) booting ...\n);
 #endif
 
 #ifdef BOOT_ARGS



CVS commit: src/sys/external/bsd/drm2/include/linux

2014-09-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Sep 15 20:24:55 UTC 2014

Modified Files:
src/sys/external/bsd/drm2/include/linux: ww_mutex.h

Log Message:
Fix mistakes in Linux ww_mutex code.

I wrote some cases for the WW_WANTOWN state forgetting that there is
an acquisition context associated with it.

- On acceptance of a lock, allow WW_WANTOWN as well as WW_CTX.
- On unlock when WW_WANTOWN, decrement the context's acquire count.

Fixes KASSERT(ctx-wwx_acquired == 0) failure in ww_acquire_fini, and
would fix unlikely but possible kasserts in ww_mutex_lock* if another
lwp swoops in to lock without a context quickly enough.

While here, add some comments and kassert up the wazoo.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/ww_mutex.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/external/bsd/drm2/include/linux/ww_mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.6 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.7
--- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.6	Sat Sep 13 00:33:45 2014
+++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h	Mon Sep 15 20:24:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ww_mutex.h,v 1.6 2014/09/13 00:33:45 riastradh Exp $	*/
+/*	$NetBSD: ww_mutex.h,v 1.7 2014/09/15 20:24:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -47,6 +47,7 @@ struct ww_class {
 
 struct ww_acquire_ctx {
 	struct ww_class	*wwx_class __diagused;
+	struct lwp	*wwx_owner __diagused;
 	uint64_t	wwx_ticket;
 	unsigned	wwx_acquired;
 	bool		wwx_acquire_done;
@@ -92,6 +93,7 @@ ww_acquire_init(struct ww_acquire_ctx *c
 {
 
 	ctx-wwx_class = class;
+	ctx-wwx_owner = curlwp;
 	ctx-wwx_ticket = atomic_inc_64_nv(class-wwc_ticket);
 	ctx-wwx_acquired = 0;
 	ctx-wwx_acquire_done = false;
@@ -101,6 +103,9 @@ static inline void
 ww_acquire_done(struct ww_acquire_ctx *ctx)
 {
 
+	KASSERTMSG((ctx-wwx_owner == curlwp),
+	ctx %p owned by %p, not self (%p), ctx, ctx-wwx_owner, curlwp);
+
 	ctx-wwx_acquire_done = true;
 }
 
@@ -108,18 +113,22 @@ static inline void
 ww_acquire_fini(struct ww_acquire_ctx *ctx)
 {
 
+	KASSERTMSG((ctx-wwx_owner == curlwp),
+	ctx %p owned by %p, not self (%p), ctx, ctx-wwx_owner, curlwp);
 	KASSERTMSG((ctx-wwx_acquired == 0), ctx %p still holds %u locks,
 	ctx, ctx-wwx_acquired);
+
 	ctx-wwx_acquired = ~0U;	/* Fail if called again. */
+	ctx-wwx_owner = NULL;
 }
 
 struct ww_mutex {
 	kmutex_t		wwm_lock;
 	enum ww_mutex_state {
-		WW_UNLOCKED,
-		WW_OWNED,
-		WW_CTX,
-		WW_WANTOWN,
+		WW_UNLOCKED,	/* nobody owns it */
+		WW_OWNED,	/* owned by a lwp without a context */
+		WW_CTX,		/* owned by a context */
+		WW_WANTOWN,	/* owned by ctx, waiters w/o ctx waiting */
 	}			wwm_state;
 	union {
 		struct lwp		*owner;
@@ -218,7 +227,9 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 
 	KASSERT(mutex_owned(mutex-wwm_lock));
 
-	KASSERT(mutex-wwm_state == WW_CTX);
+	KASSERT((mutex-wwm_state == WW_CTX) ||
+	(mutex-wwm_state == WW_WANTOWN));
+	KASSERT(mutex-wwm_u.ctx != ctx);
 	KASSERTMSG((ctx-wwx_class == mutex-wwm_u.ctx-wwx_class),
 	ww mutex class mismatch: %p != %p,
 	ctx-wwx_class, mutex-wwm_u.ctx-wwx_class);
@@ -233,7 +244,9 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	ctx-wwx_ticket, ctx, collision-wwx_ticket, collision);
 
 	do cv_wait(mutex-wwm_cv, mutex-wwm_lock);
-	while (!((mutex-wwm_state == WW_CTX)  (mutex-wwm_u.ctx == ctx)));
+	while (!(((mutex-wwm_state == WW_CTX) ||
+		(mutex-wwm_state == WW_WANTOWN)) 
+		 (mutex-wwm_u.ctx == ctx)));
 
 	rb_tree_remove_node(mutex-wwm_waiters, ctx);
 }
@@ -246,7 +259,9 @@ ww_mutex_lock_wait_sig(struct ww_mutex *
 
 	KASSERT(mutex_owned(mutex-wwm_lock));
 
-	KASSERT(mutex-wwm_state == WW_CTX);
+	KASSERT((mutex-wwm_state == WW_CTX) ||
+	(mutex-wwm_state == WW_WANTOWN));
+	KASSERT(mutex-wwm_u.ctx != ctx);
 	KASSERTMSG((ctx-wwx_class == mutex-wwm_u.ctx-wwx_class),
 	ww mutex class mismatch: %p != %p,
 	ctx-wwx_class, mutex-wwm_u.ctx-wwx_class);
@@ -265,7 +280,9 @@ ww_mutex_lock_wait_sig(struct ww_mutex *
 		ret = -cv_wait_sig(mutex-wwm_cv, mutex-wwm_lock);
 		if (ret)
 			goto out;
-	} while (!((mutex-wwm_state == WW_CTX)  (mutex-wwm_u.ctx == ctx)));
+	} while (!(((mutex-wwm_state == WW_CTX) ||
+		(mutex-wwm_state == WW_WANTOWN)) 
+		(mutex-wwm_u.ctx == ctx)));
 
 out:	rb_tree_remove_node(mutex-wwm_waiters, ctx);
 	return ret;
@@ -283,13 +300,16 @@ retry:	switch (mutex-wwm_state) {
 		break;
 	case WW_OWNED:
 		KASSERTMSG((mutex-wwm_u.owner != curlwp),
-		locking against myself: %p, curlwp);
+		locking %p against myself: %p, mutex, curlwp);
 		ww_mutex_state_wait(mutex, WW_OWNED);
 		goto retry;
 	case WW_CTX:
 		KASSERT(mutex-wwm_u.ctx != NULL);
 		mutex-wwm_state = WW_WANTOWN;
+		/* FALLTHROUGH */
 	case WW_WANTOWN:
+		KASSERTMSG((mutex-wwm_u.ctx-wwx_owner != 

CVS commit: src/lib/libc/stdio

2014-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep 15 23:29:16 UTC 2014

Modified Files:
src/lib/libc/stdio: getdelim.3

Log Message:
Fix documentation to reflect what happens when EOF is found before delimiter,
aligning us with POSIX.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/stdio/getdelim.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/libc/stdio/getdelim.3
diff -u src/lib/libc/stdio/getdelim.3:1.9 src/lib/libc/stdio/getdelim.3:1.10
--- src/lib/libc/stdio/getdelim.3:1.9	Wed Apr 20 19:37:51 2011
+++ src/lib/libc/stdio/getdelim.3	Mon Sep 15 19:29:16 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: getdelim.3,v 1.9 2011/04/20 23:37:51 enami Exp $
+.\ $NetBSD: getdelim.3,v 1.10 2014/09/15 23:29:16 christos Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd June 30, 2010
+.Dd September 15, 2014
 .Dt GETDELIM 3
 .Os
 .Sh NAME
@@ -48,12 +48,14 @@ The
 function reads from the
 .Fa stream
 until it encounters a character matching
-.Fa delimiter ,
+.Fa delimiter 
+or.
+.DV EOF ,
 storing the input in
 .Fa *lineptr .
 The buffer is
 .Dv NUL Ns No -terminated
-and includes the delimiter.
+and includes the delimiter, if one was found.
 The
 .Fa delimiter
 character must be representable as an unsigned char.
@@ -88,7 +90,8 @@ The
 .Fn getdelim
 and
 .Fn getline
-functions return the number of characters read, including the delimiter.
+functions return the number of characters read, including the delimiter if
+one was found.
 If no characters were read and the stream is at end-of-file, the functions
 return \-1.
 If an error occurs, the functions return \-1 and the global variable



CVS commit: src/lib/libc/stdio

2014-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep 15 23:31:17 UTC 2014

Modified Files:
src/lib/libc/stdio: getdelim.3

Log Message:
fix markup.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/stdio/getdelim.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/libc/stdio/getdelim.3
diff -u src/lib/libc/stdio/getdelim.3:1.10 src/lib/libc/stdio/getdelim.3:1.11
--- src/lib/libc/stdio/getdelim.3:1.10	Mon Sep 15 19:29:16 2014
+++ src/lib/libc/stdio/getdelim.3	Mon Sep 15 19:31:17 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: getdelim.3,v 1.10 2014/09/15 23:29:16 christos Exp $
+.\ $NetBSD: getdelim.3,v 1.11 2014/09/15 23:31:17 christos Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -49,8 +49,8 @@ function reads from the
 .Fa stream
 until it encounters a character matching
 .Fa delimiter 
-or.
-.DV EOF ,
+or
+.Dv EOF ,
 storing the input in
 .Fa *lineptr .
 The buffer is



CVS commit: src/lib/libc/stdio

2014-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Sep 15 23:41:16 UTC 2014

Modified Files:
src/lib/libc/stdio: getdelim.3

Log Message:
mention what happens if the line contains NUL's.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/stdio/getdelim.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/libc/stdio/getdelim.3
diff -u src/lib/libc/stdio/getdelim.3:1.11 src/lib/libc/stdio/getdelim.3:1.12
--- src/lib/libc/stdio/getdelim.3:1.11	Mon Sep 15 19:31:17 2014
+++ src/lib/libc/stdio/getdelim.3	Mon Sep 15 19:41:16 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: getdelim.3,v 1.11 2014/09/15 23:31:17 christos Exp $
+.\ $NetBSD: getdelim.3,v 1.12 2014/09/15 23:41:16 christos Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -147,7 +147,8 @@ or
 .Sh SEE ALSO
 .Xr ferror 3 ,
 .Xr fgets 3 ,
-.Xr fopen 3
+.Xr fopen 3 ,
+.Xr strlen 3
 .Sh STANDARDS
 The
 .Fn getdelim
@@ -155,3 +156,14 @@ and
 .Fn getline
 functions conform to
 .St -p1003.1-2008 .
+.Sh NOTES
+The
+.Fn getdelim
+and
+.Fn getline
+functions can return strings with length (as returned by
+.Xr strlen 3
+on the returned line) less than the return value of the functions
+if the line happened to contain
+.Dv NUL
+characters.



CVS commit: src/lib/libc/resolv

2014-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 16 01:29:48 UTC 2014

Modified Files:
src/lib/libc/resolv: res_init.c

Log Message:
Mark the dup of the resolv fd for close on exec.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/resolv/res_init.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/resolv/res_init.c
diff -u src/lib/libc/resolv/res_init.c:1.28 src/lib/libc/resolv/res_init.c:1.29
--- src/lib/libc/resolv/res_init.c:1.28	Wed Jan  8 17:58:50 2014
+++ src/lib/libc/resolv/res_init.c	Mon Sep 15 21:29:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: res_init.c,v 1.28 2014/01/08 22:58:50 christos Exp $	*/
+/*	$NetBSD: res_init.c,v 1.29 2014/09/16 01:29:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1993
@@ -76,7 +76,7 @@
 static const char sccsid[] = @(#)res_init.c	8.1 (Berkeley) 6/7/93;
 static const char rcsid[] = Id: res_init.c,v 1.26 2008/12/11 09:59:00 marka Exp;
 #else
-__RCSID($NetBSD: res_init.c,v 1.28 2014/01/08 22:58:50 christos Exp $);
+__RCSID($NetBSD: res_init.c,v 1.29 2014/09/16 01:29:48 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -499,7 +499,7 @@ __res_vinit(res_state statp, int preinit
 #ifdef RESOLVSORT
 	statp-nsort = nsort;
 #endif
-	statp-_u._ext.ext-resfd = dup(fileno(fp));
+	statp-_u._ext.ext-resfd = fcntl(fileno(fp), F_DUPFD_CLOEXEC);
 	(void) fclose(fp);
 	if (fstat(statp-_u._ext.ext-resfd, st) != -1)
 		__res_conf_time = statp-_u._ext.ext-res_conf_time =



CVS commit: src/lib/libc/resolv

2014-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 16 01:30:00 UTC 2014

Modified Files:
src/lib/libc/resolv: res_query.c

Log Message:
close on exec hostaliases


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/resolv/res_query.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/resolv/res_query.c
diff -u src/lib/libc/resolv/res_query.c:1.14 src/lib/libc/resolv/res_query.c:1.15
--- src/lib/libc/resolv/res_query.c:1.14	Tue Mar 13 17:13:44 2012
+++ src/lib/libc/resolv/res_query.c	Mon Sep 15 21:30:00 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: res_query.c,v 1.14 2012/03/13 21:13:44 christos Exp $	*/
+/*	$NetBSD: res_query.c,v 1.15 2014/09/16 01:30:00 christos Exp $	*/
 
 /*
  * Portions Copyright (C) 2004, 2005, 2008  Internet Systems Consortium, Inc. (ISC)
@@ -93,7 +93,7 @@
 static const char sccsid[] = @(#)res_query.c	8.1 (Berkeley) 6/4/93;
 static const char rcsid[] = Id: res_query.c,v 1.11 2008/11/14 02:36:51 marka Exp;
 #else
-__RCSID($NetBSD: res_query.c,v 1.14 2012/03/13 21:13:44 christos Exp $);
+__RCSID($NetBSD: res_query.c,v 1.15 2014/09/16 01:30:00 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -451,7 +451,7 @@ res_hostalias(const res_state statp, con
 	if (issetugid())
 		return (NULL);
 	file = getenv(HOSTALIASES);
-	if (file == NULL || (fp = fopen(file, r)) == NULL)
+	if (file == NULL || (fp = fopen(file, re)) == NULL)
 		return (NULL);
 	buf[sizeof(buf) - 1] = '\0';
 	while (fgets(buf, (int)sizeof(buf), fp)) {



CVS commit: src/lib/libc/nls

2014-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 16 01:30:28 UTC 2014

Modified Files:
src/lib/libc/nls: catopen.c

Log Message:
belt-n-suspenders, close on exec catalog files.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/nls/catopen.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/nls/catopen.c
diff -u src/lib/libc/nls/catopen.c:1.32 src/lib/libc/nls/catopen.c:1.33
--- src/lib/libc/nls/catopen.c:1.32	Mon Aug 19 04:03:34 2013
+++ src/lib/libc/nls/catopen.c	Mon Sep 15 21:30:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: catopen.c,v 1.32 2013/08/19 08:03:34 joerg Exp $	*/
+/*	$NetBSD: catopen.c,v 1.33 2014/09/16 01:30:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: catopen.c,v 1.32 2013/08/19 08:03:34 joerg Exp $);
+__RCSID($NetBSD: catopen.c,v 1.33 2014/09/16 01:30:28 christos Exp $);
 
 #define _NLS_PRIVATE
 #define __SETLOCALE_SOURCE__
@@ -163,7 +163,7 @@ load_msgcat(const char *path)
 
 	_DIAGASSERT(path != NULL);
 
-	if ((fd = open(path, O_RDONLY)) == -1)
+	if ((fd = open(path, O_RDONLY|O_CLOEXEC)) == -1)
 		return (nl_catd)-1;
 
 	if (fstat(fd, st) != 0) {