CVS commit: src/usr.bin/sed

2014-06-07 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sat Jun  7 06:02:27 UTC 2014

Modified Files:
src/usr.bin/sed: process.c

Log Message:
Restore G command


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/sed/process.c

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

Modified files:

Index: src/usr.bin/sed/process.c
diff -u src/usr.bin/sed/process.c:1.41 src/usr.bin/sed/process.c:1.42
--- src/usr.bin/sed/process.c:1.41	Fri Jun  6 12:46:54 2014
+++ src/usr.bin/sed/process.c	Sat Jun  7 06:02:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: process.c,v 1.41 2014/06/06 12:46:54 joerg Exp $	*/
+/*	$NetBSD: process.c,v 1.42 2014/06/07 06:02:27 ryoon Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -38,7 +38,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: process.c,v 1.41 2014/06/06 12:46:54 joerg Exp $);
+__RCSID($NetBSD: process.c,v 1.42 2014/06/07 06:02:27 ryoon Exp $);
 #ifdef __FBSDID
 __FBSDID($FreeBSD: head/usr.bin/sed/process.c 192732 2009-05-25 06:45:33Z brian $);
 #endif
@@ -155,7 +155,7 @@ redirect:
 break;
 			case 'G':
 if (hs == NULL)
-	cspace(PS, \n, 1, REPLACE);
+	cspace(HS, \n, 1, REPLACE);
 cspace(PS, hs, hsl, APPEND);
 break;
 			case 'h':



CVS commit: src/sys/net

2014-06-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  7 09:34:02 UTC 2014

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

Log Message:
Try to untangle the ifdef mess a bit more


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/net/if_fddisubr.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_fddisubr.c
diff -u src/sys/net/if_fddisubr.c:1.87 src/sys/net/if_fddisubr.c:1.88
--- src/sys/net/if_fddisubr.c:1.87	Fri Jun  6 00:25:28 2014
+++ src/sys/net/if_fddisubr.c	Sat Jun  7 09:34:02 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fddisubr.c,v 1.87 2014/06/06 00:25:28 rmind Exp $	*/
+/*	$NetBSD: if_fddisubr.c,v 1.88 2014/06/07 09:34:02 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_fddisubr.c,v 1.87 2014/06/06 00:25:28 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_fddisubr.c,v 1.88 2014/06/07 09:34:02 martin Exp $);
 
 #include opt_gateway.h
 #include opt_inet.h
@@ -462,13 +462,16 @@ fddi_input(struct ifnet *ifp, struct mbu
 #if defined(INET) || defined(INET6)
 	pktqueue_t *pktq = NULL;
 #endif
-#if defined(INET) || defined(INET6) || defined(NS) || defined(DECNET) || defined(IPX) || defined(NETATALK)
+#if defined(NS) || defined(DECNET) || defined(IPX) || defined(NETATALK)
 	struct ifqueue *inq = NULL;
+#endif
+#if defined(NS) || defined(DECNET) || defined(IPX) || defined(NETATALK)
+	int isr = 0;
 	int s;
 #endif
+
 	struct llc *l;
 	struct fddi_header *fh;
-	int isr = 0;
 
 	MCLAIM(m, ((struct ethercom *)ifp)-ec_rx_mowner);
 	if ((ifp-if_flags  IFF_UP) == 0) {
@@ -556,8 +559,10 @@ fddi_input(struct ifnet *ifp, struct mbu
 
 		case ETHERTYPE_ARP:
 #if !defined(__bsdi__) || _BSDI_VERSION = 199401
+#if defined(NS) || defined(DECNET) || defined(IPX) || defined(NETATALK)
 			isr = NETISR_ARP;
 			inq = arpintrq;
+#endif
 			break;
 #else
 			arpinput(ifp, m);



CVS commit: src/sys/fs/tmpfs

2014-06-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  7 09:54:34 UTC 2014

Modified Files:
src/sys/fs/tmpfs: tmpfs.h tmpfs_mem.c tmpfs_vfsops.c

Log Message:
Remove the hardcoded 4 MB free kernel memory limit and replace it
by uvmexp.freetarg, as discussed on tech-kern.
Main purpose is to make tmpfs usable (as far as possible) on small memory
machines.
This is a bit experimental, but we need to give it some real world exposure
to see how well it works.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/fs/tmpfs/tmpfs.h
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/tmpfs/tmpfs_mem.c
cvs rdiff -u -r1.61 -r1.62 src/sys/fs/tmpfs/tmpfs_vfsops.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/fs/tmpfs/tmpfs.h
diff -u src/sys/fs/tmpfs/tmpfs.h:1.49 src/sys/fs/tmpfs/tmpfs.h:1.50
--- src/sys/fs/tmpfs/tmpfs.h:1.49	Wed Apr 30 01:33:51 2014
+++ src/sys/fs/tmpfs/tmpfs.h	Sat Jun  7 09:54:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs.h,v 1.49 2014/04/30 01:33:51 christos Exp $	*/
+/*	$NetBSD: tmpfs.h,v 1.50 2014/06/07 09:54:34 martin Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -307,13 +307,6 @@ bool		tmpfs_strname_neqlen(struct compon
 KASSERT((node)-tn_size % sizeof(tmpfs_dirent_t) == 0);
 
 /*
- * Memory management stuff.
- */
-
-/* Amount of memory pages to reserve for the system. */
-#define	TMPFS_PAGES_RESERVED	(4 * 1024 * 1024 / PAGE_SIZE)
-
-/*
  * Routines to convert VFS structures to tmpfs internal ones.
  */
 

Index: src/sys/fs/tmpfs/tmpfs_mem.c
diff -u src/sys/fs/tmpfs/tmpfs_mem.c:1.5 src/sys/fs/tmpfs/tmpfs_mem.c:1.6
--- src/sys/fs/tmpfs/tmpfs_mem.c:1.5	Wed Apr 30 01:33:51 2014
+++ src/sys/fs/tmpfs/tmpfs_mem.c	Sat Jun  7 09:54:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_mem.c,v 1.5 2014/04/30 01:33:51 christos Exp $	*/
+/*	$NetBSD: tmpfs_mem.c,v 1.6 2014/06/07 09:54:34 martin Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tmpfs_mem.c,v 1.5 2014/04/30 01:33:51 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: tmpfs_mem.c,v 1.6 2014/06/07 09:54:34 martin Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -89,7 +89,7 @@ tmpfs_mntmem_set(struct tmpfs_mount *mp,
  * = If 'total' is true, then return _total_ amount of pages.
  * = If false, then return the amount of _free_ memory pages.
  *
- * Remember to remove TMPFS_PAGES_RESERVED from the returned value to avoid
+ * Remember to remove uvmexp.freetarg from the returned value to avoid
  * excessive memory usage.
  */
 size_t
@@ -118,10 +118,10 @@ tmpfs_bytes_max(struct tmpfs_mount *mp)
 	size_t freepages = tmpfs_mem_info(false);
 	uint64_t avail_mem;
 
-	if (freepages  TMPFS_PAGES_RESERVED) {
+	if (freepages  uvmexp.freetarg) {
 		freepages = 0;
 	} else {
-		freepages -= TMPFS_PAGES_RESERVED;
+		freepages -= uvmexp.freetarg;
 	}
 	avail_mem = round_page(mp-tm_bytes_used) + (freepages  PAGE_SHIFT);
 	return MIN(mp-tm_mem_limit, avail_mem);

Index: src/sys/fs/tmpfs/tmpfs_vfsops.c
diff -u src/sys/fs/tmpfs/tmpfs_vfsops.c:1.61 src/sys/fs/tmpfs/tmpfs_vfsops.c:1.62
--- src/sys/fs/tmpfs/tmpfs_vfsops.c:1.61	Wed Apr 30 01:59:30 2014
+++ src/sys/fs/tmpfs/tmpfs_vfsops.c	Sat Jun  7 09:54:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vfsops.c,v 1.61 2014/04/30 01:59:30 christos Exp $	*/
+/*	$NetBSD: tmpfs_vfsops.c,v 1.62 2014/06/07 09:54:34 martin Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tmpfs_vfsops.c,v 1.61 2014/04/30 01:59:30 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: tmpfs_vfsops.c,v 1.62 2014/06/07 09:54:34 martin Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -132,7 +132,7 @@ tmpfs_mount(struct mount *mp, const char
 
 
 	/* Prohibit mounts if there is not enough memory. */
-	if (tmpfs_mem_info(true)  TMPFS_PAGES_RESERVED)
+	if (tmpfs_mem_info(true)  uvmexp.freetarg)
 		return EINVAL;
 
 	/* Get the memory usage limit for this file-system. */



CVS commit: src/sbin/mount_tmpfs

2014-06-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun  7 10:03:44 UTC 2014

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

Log Message:
Remove reference to (no longer) fixed 4 mbyte kernel memory being reserved,
it is now dynamic.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sbin/mount_tmpfs/mount_tmpfs.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/mount_tmpfs/mount_tmpfs.8
diff -u src/sbin/mount_tmpfs/mount_tmpfs.8:1.17 src/sbin/mount_tmpfs/mount_tmpfs.8:1.18
--- src/sbin/mount_tmpfs/mount_tmpfs.8:1.17	Wed Dec  4 18:05:21 2013
+++ src/sbin/mount_tmpfs/mount_tmpfs.8	Sat Jun  7 10:03:44 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: mount_tmpfs.8,v 1.17 2013/12/04 18:05:21 wiz Exp $
+.\	$NetBSD: mount_tmpfs.8,v 1.18 2014/06/07 10:03:44 martin Exp $
 .\
 .\ Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -28,7 +28,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd December 4, 2013
+.Dd June 7, 2014
 .Dt MOUNT_TMPFS 8
 .Os
 .Sh NAME
@@ -83,8 +83,10 @@ man page for possible options and their 
 Specifies the total file system size in bytes.
 If zero is given (the default), the available amount of memory (including
 main memory and swap space) will be used.
-Note that four megabytes are always reserved for the system and cannot
+Note that some memory is always reserved for the system and cannot
 be assigned to the file system.
+The exact amount depends on the available memory and details of the
+kernel memory usage, it might even change slightly during runtime.
 .Ar Size
 can alternatively be specified as a percentage of the available
 system ram by using the notation



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

2014-06-07 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sat Jun  7 10:30:13 UTC 2014

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c

Log Message:
Fix reset parameters for omap3_ehci.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/evbarm/gumstix/gumstix_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/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.49 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.50
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.49	Fri May 23 13:56:18 2014
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Sat Jun  7 10:30:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.49 2014/05/23 13:56:18 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.50 2014/06/07 10:30:13 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -892,13 +892,13 @@ gumstix_device_register(device_t dev, vo
 	prop_dictionary_t dict = device_properties(dev);
 
 	if (device_is_a(dev, ehci)) {
-		prop_dictionary_set_cstring(dict, port0-mode, none);
-		prop_dictionary_set_cstring(dict, port1-mode, phy);
-		prop_dictionary_set_cstring(dict, port2-mode, none);
+		prop_dictionary_set_uint16(dict, nports, 2);
 		prop_dictionary_set_bool(dict, phy-reset, true);
+		prop_dictionary_set_cstring(dict, port0-mode, none);
 		prop_dictionary_set_int16(dict, port0-gpio, -1);
+		prop_dictionary_set_cstring(dict, port1-mode, phy);
 		prop_dictionary_set_int16(dict, port1-gpio, 183);
-		prop_dictionary_set_int16(dict, port2-gpio, -1);
+		prop_dictionary_set_bool(dict, port1-gpioval, true);
 		prop_dictionary_set_uint16(dict, dpll5-m, 443);
 		prop_dictionary_set_uint16(dict, dpll5-n, 11);
 		prop_dictionary_set_uint16(dict, dpll5-m2, 4);



CVS commit: src/sys/net

2014-06-07 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jun  7 11:00:29 UTC 2014

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

Log Message:
lostart: silence gcc warning (XXX: gcc is not right though).


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/net/if_loop.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_loop.c
diff -u src/sys/net/if_loop.c:1.79 src/sys/net/if_loop.c:1.80
--- src/sys/net/if_loop.c:1.79	Thu Jun  5 23:48:16 2014
+++ src/sys/net/if_loop.c	Sat Jun  7 11:00:29 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.79 2014/06/05 23:48:16 rmind Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.80 2014/06/07 11:00:29 rmind Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_loop.c,v 1.79 2014/06/05 23:48:16 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_loop.c,v 1.80 2014/06/07 11:00:29 rmind Exp $);
 
 #include opt_inet.h
 #include opt_atalk.h
@@ -359,11 +359,11 @@ lostart(struct ifnet *ifp)
 {
 	for (;;) {
 		pktqueue_t *pktq = NULL;
-		struct ifqueue *ifq;
+		struct ifqueue *ifq = NULL;
 		struct mbuf *m;
 		size_t pktlen;
 		uint32_t af;
-		int s, isr;
+		int s, isr = 0;
 
 		IFQ_DEQUEUE(ifp-if_snd, m);
 		if (m == NULL)



CVS commit: src/sys/rump/librump/rumpkern

2014-06-07 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Jun  7 11:08:09 UTC 2014

Modified Files:
src/sys/rump/librump/rumpkern: scheduler.c

Log Message:
Make kpreempt_disabled() always return true in RUMP kernels for now.
May revisit once RUMP provides better splfoo/splx() handling.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/librump/rumpkern/scheduler.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/rump/librump/rumpkern/scheduler.c
diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.38 src/sys/rump/librump/rumpkern/scheduler.c:1.39
--- src/sys/rump/librump/rumpkern/scheduler.c:1.38	Thu Jun  5 23:43:04 2014
+++ src/sys/rump/librump/rumpkern/scheduler.c	Sat Jun  7 11:08:09 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.38 2014/06/05 23:43:04 rmind Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.39 2014/06/07 11:08:09 rmind Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.38 2014/06/05 23:43:04 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.39 2014/06/07 11:08:09 rmind Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -526,10 +526,14 @@ kpreempt_enable(void)
 bool
 kpreempt_disabled(void)
 {
+#if 0
 	const lwp_t *l = curlwp;
 
 	return l-l_nopreempt != 0 || l-l_stat == LSZOMB ||
-	(l-l_flag  LW_IDLE) != 0 /* || cpu_kpreempt_disabled() */;
+	(l-l_flag  LW_IDLE) != 0 || cpu_kpreempt_disabled();
+#endif
+	/* XXX: emulate cpu_kpreempt_disabled() */
+	return true;
 }
 
 void



CVS commit: src/sys/net

2014-06-07 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sat Jun  7 13:25:33 UTC 2014

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

Log Message:
Include netinet/in.h before netinet/in_var.h to avoid build failure
for the COMPUTEX7750 kernel of evbsh3-eb.
Also, don't reference ip_pktq if INET isn't defined (found by the same
kernel).


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/net/if.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.c
diff -u src/sys/net/if.c:1.277 src/sys/net/if.c:1.278
--- src/sys/net/if.c:1.277	Fri Jun  6 01:02:47 2014
+++ src/sys/net/if.c	Sat Jun  7 13:25:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.277 2014/06/06 01:02:47 rmind Exp $	*/
+/*	$NetBSD: if.c,v 1.278 2014/06/07 13:25:33 he Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.277 2014/06/06 01:02:47 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.278 2014/06/07 13:25:33 he Exp $);
 
 #include opt_inet.h
 
@@ -130,10 +130,10 @@ __KERNEL_RCSID(0, $NetBSD: if.c,v 1.277
 #include netatalk/at.h
 #endif
 #include net/pfil.h
+#include netinet/in.h
 #include netinet/in_var.h
 
 #ifdef INET6
-#include netinet/in.h
 #include netinet6/in6_var.h
 #include netinet6/nd6.h
 #endif
@@ -872,7 +872,9 @@ again:
 	 * ensures that the packets are dequeued while a cross-call will
 	 * ensure that the interrupts have completed. FIXME: not quite..
 	 */
+#ifdef INET
 	pktq_barrier(ip_pktq);
+#endif
 	xc = xc_broadcast(0, (xcfunc_t)nullop, NULL, NULL);
 	xc_wait(xc);
 



CVS commit: src/usr.bin/sed

2014-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun  7 16:36:54 UTC 2014

Modified Files:
src/usr.bin/sed: Makefile process.c

Log Message:
PR/48880: Ryo ONODERA: Unapply one of our patches that broke 'G'.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/sed/Makefile
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/sed/process.c

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

Modified files:

Index: src/usr.bin/sed/Makefile
diff -u src/usr.bin/sed/Makefile:1.15 src/usr.bin/sed/Makefile:1.16
--- src/usr.bin/sed/Makefile:1.15	Thu Jun  5 20:13:13 2014
+++ src/usr.bin/sed/Makefile	Sat Jun  7 12:36:54 2014
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.15 2014/06/06 00:13:13 christos Exp $
+#	$NetBSD: Makefile,v 1.16 2014/06/07 16:36:54 christos Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include bsd.own.mk
-WARNS=6
+WARNS=0
 
 PROG=	sed
 SRCS=	compile.c main.c misc.c process.c

Index: src/usr.bin/sed/process.c
diff -u src/usr.bin/sed/process.c:1.42 src/usr.bin/sed/process.c:1.43
--- src/usr.bin/sed/process.c:1.42	Sat Jun  7 02:02:27 2014
+++ src/usr.bin/sed/process.c	Sat Jun  7 12:36:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: process.c,v 1.42 2014/06/07 06:02:27 ryoon Exp $	*/
+/*	$NetBSD: process.c,v 1.43 2014/06/07 16:36:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992 Diomidis Spinellis.
@@ -38,7 +38,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: process.c,v 1.42 2014/06/07 06:02:27 ryoon Exp $);
+__RCSID($NetBSD: process.c,v 1.43 2014/06/07 16:36:54 christos Exp $);
 #ifdef __FBSDID
 __FBSDID($FreeBSD: head/usr.bin/sed/process.c 192732 2009-05-25 06:45:33Z brian $);
 #endif
@@ -154,8 +154,7 @@ redirect:
 cspace(PS, hs, hsl, REPLACE);
 break;
 			case 'G':
-if (hs == NULL)
-	cspace(HS, \n, 1, REPLACE);
+cspace(PS, \n, 1, APPEND);
 cspace(PS, hs, hsl, APPEND);
 break;
 			case 'h':



CVS commit: src/usr.bin/sed

2014-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun  7 16:37:32 UTC 2014

Modified Files:
src/usr.bin/sed: Makefile

Log Message:
put back WARNS=6


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/sed/Makefile

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/sed/Makefile
diff -u src/usr.bin/sed/Makefile:1.16 src/usr.bin/sed/Makefile:1.17
--- src/usr.bin/sed/Makefile:1.16	Sat Jun  7 12:36:54 2014
+++ src/usr.bin/sed/Makefile	Sat Jun  7 12:37:32 2014
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.16 2014/06/07 16:36:54 christos Exp $
+#	$NetBSD: Makefile,v 1.17 2014/06/07 16:37:32 christos Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
 
 .include bsd.own.mk
-WARNS=0
+WARNS=6
 
 PROG=	sed
 SRCS=	compile.c main.c misc.c process.c



CVS commit: src/sys/arch/hpcmips/tx

2014-06-07 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sat Jun  7 18:59:16 UTC 2014

Modified Files:
src/sys/arch/hpcmips/tx: tx3912video.c

Log Message:
Remove set-but-not-used variable bit8.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/hpcmips/tx/tx3912video.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/hpcmips/tx/tx3912video.c
diff -u src/sys/arch/hpcmips/tx/tx3912video.c:1.42 src/sys/arch/hpcmips/tx/tx3912video.c:1.43
--- src/sys/arch/hpcmips/tx/tx3912video.c:1.42	Sat Oct 27 17:17:54 2012
+++ src/sys/arch/hpcmips/tx/tx3912video.c	Sat Jun  7 18:59:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tx3912video.c,v 1.42 2012/10/27 17:17:54 chs Exp $ */
+/*	$NetBSD: tx3912video.c,v 1.43 2014/06/07 18:59:16 he Exp $ */
 
 /*-
  * Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tx3912video.c,v 1.42 2012/10/27 17:17:54 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: tx3912video.c,v 1.43 2014/06/07 18:59:16 he Exp $);
 
 #define TX3912VIDEO_DEBUG
 
@@ -434,7 +434,7 @@ tx3912video_framebuffer_init(struct vide
 void
 tx3912video_resolution_init(struct video_chip *chip)
 {
-	int h, v, split, bit8, horzval, lineval;
+	int h, v, split, horzval, lineval;
 	tx_chipset_tag_t tc = chip-vc_v;
 	txreg_t reg;
 	u_int32_t val;
@@ -443,8 +443,6 @@ tx3912video_resolution_init(struct video
 	v = chip-vc_fbheight;
 	reg = tx_conf_read(tc, TX3912_VIDEOCTRL1_REG);
 	split = reg  TX3912_VIDEOCTRL1_DISPSPLIT;
-	bit8  = (TX3912_VIDEOCTRL1_BITSEL(reg) == 
-	TX3912_VIDEOCTRL1_BITSEL_8BITCOLOR);
 	val = TX3912_VIDEOCTRL1_BITSEL(reg);
 
 	if ((val == TX3912_VIDEOCTRL1_BITSEL_8BITCOLOR)  !split) {



CVS commit: src/lib/libc/gen

2014-06-07 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Jun  7 20:55:47 UTC 2014

Modified Files:
src/lib/libc/gen: arc4random.c

Log Message:
Re-stir after forking, fixes PR lib/25367.
Re-stir after consuming 160 bytes, fixes PR lib/45952.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libc/gen/arc4random.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/gen/arc4random.c
diff -u src/lib/libc/gen/arc4random.c:1.21 src/lib/libc/gen/arc4random.c:1.22
--- src/lib/libc/gen/arc4random.c:1.21	Thu Oct 17 23:56:17 2013
+++ src/lib/libc/gen/arc4random.c	Sat Jun  7 20:55:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.21 2013/10/17 23:56:17 christos Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.22 2014/06/07 20:55:47 roy Exp $	*/
 /*	$OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $	*/
 
 /*
@@ -27,12 +27,14 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: arc4random.c,v 1.21 2013/10/17 23:56:17 christos Exp $);
+__RCSID($NetBSD: arc4random.c,v 1.22 2014/06/07 20:55:47 roy Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
 #include reentrant.h
 #include fcntl.h
+#include pthread.h
+#include stdbool.h
 #include stdlib.h
 #include unistd.h
 #include sys/types.h
@@ -49,25 +51,19 @@ __weak_alias(arc4random_uniform,_arc4ran
 #endif
 
 struct arc4_stream {
-	uint8_t stirred;
-	uint8_t pad;
+	bool inited;
 	uint8_t i;
 	uint8_t j;
 	uint8_t s[(uint8_t)~0u + 1u];	/* 256 to you and me */
+	size_t count;
 	mutex_t mtx;
 };
 
 #ifdef _REENTRANT
-#define LOCK(rs) { \
-		int isthreaded = __isthreaded; \
-		if (isthreaded)\
-			mutex_lock((rs)-mtx);
-#define UNLOCK(rs) \
-		if (isthreaded)\
-			mutex_unlock((rs)-mtx);  \
-	}
+#define LOCK(rs)	if (__isthreaded) mutex_lock((rs)-mtx);
+#define UNLOCK(rs)	if (__isthreaded) mutex_unlock((rs)-mtx);
 #else
-#define LOCK(rs) 
+#define LOCK(rs)
 #define UNLOCK(rs)
 #endif
 
@@ -77,8 +73,9 @@ struct arc4_stream {
 #define S64(n) S16(n), S16(n + 16), S16(n + 32), S16(n + 48)
 #define S256 S64(0), S64(64), S64(128), S64(192)
 
-static struct arc4_stream rs = { .i = 0xff, .j = 0, .s = { S256 },
-		.stirred = 0, .mtx = MUTEX_INITIALIZER };
+static struct arc4_stream rs = { .inited = false,
+		.i = 0xff, .j = 0, .s = { S256 },
+		.count = 0, .mtx = MUTEX_INITIALIZER };
 
 #undef S
 #undef S4
@@ -91,14 +88,43 @@ static __noinline void arc4_stir(struct 
 static inline uint8_t arc4_getbyte(struct arc4_stream *);
 static inline uint32_t arc4_getword(struct arc4_stream *);
 
-static inline int
+#ifdef _REENTRANT
+static void
+arc4_fork_prepare(void)
+{
+
+	LOCK(rs);
+}
+
+static void
+arc4_fork_parent(void)
+{
+
+	UNLOCK(rs);
+}
+#else
+#define arc4_fork_prepare	NULL
+#define arc4_fork_parent	NULL
+#endif
+
+static void
+arc4_fork_child(void)
+{
+
+	/* Reset the counter to a force new stir after forking */
+	rs.count = 0;
+	UNLOCK(rs);
+}
+
+static inline void
 arc4_check_init(struct arc4_stream *as)
 {
-	if (__predict_true(rs.stirred))
-		return 0;
 
-	arc4_stir(as);
-	return 1;
+	if (__predict_false(!as-inited)) {
+		as-inited = true;
+		pthread_atfork(arc4_fork_prepare,
+		arc4_fork_parent, arc4_fork_child);
+	}
 }
 
 static inline void
@@ -124,6 +150,8 @@ arc4_stir(struct arc4_stream *as)
 	size_t len;
 	size_t i, j;
 
+	arc4_check_init(as);
+
 	/*
 	 * This code once opened and read /dev/urandom on each
 	 * call.  That causes repeated rekeying of the kernel stream
@@ -146,10 +174,21 @@ arc4_stir(struct arc4_stream *as)
 	 * paper Weaknesses in the Key Scheduling Algorithm of RC4
 	 * by Fluher, Mantin, and Shamir.  (N = 256 in our case.)
 	 */
-	for (j = 0; j  __arraycount(as-s) * 4; j++)
+	for (j = 0; j  __arraycount(as-s) * sizeof(uint32_t); j++)
 		arc4_getbyte(as);
 
-	as-stirred = 1;
+	/* Stir again after swallowing 160 bytes or if the pid changes */
+	as-count = 160;
+}
+
+static inline void
+arc4_stir_if_needed(struct arc4_stream *as, size_t len)
+{
+
+	if (__predict_false(as-count = len))
+		arc4_stir(as);
+	else
+		as-count -= len;
 }
 
 static __inline uint8_t
@@ -169,6 +208,7 @@ arc4_getbyte_ij(struct arc4_stream *as, 
 static inline uint8_t
 arc4_getbyte(struct arc4_stream *as)
 {
+
 	return arc4_getbyte_ij(as, as-i, as-j);
 }
 
@@ -176,6 +216,7 @@ static inline uint32_t
 arc4_getword(struct arc4_stream *as)
 {
 	uint32_t val;
+
 	val = arc4_getbyte(as)  24;
 	val |= arc4_getbyte(as)  16;
 	val |= arc4_getbyte(as)  8;
@@ -186,6 +227,7 @@ arc4_getword(struct arc4_stream *as)
 void
 arc4random_stir(void)
 {
+
 	LOCK(rs);
 	arc4_stir(rs);
 	UNLOCK(rs);
@@ -194,8 +236,9 @@ arc4random_stir(void)
 void
 arc4random_addrandom(u_char *dat, int datlen)
 {
+
 	LOCK(rs);
-	arc4_check_init(rs);
+	arc4_stir_if_needed(rs, datlen);
 	arc4_addrandom(rs, dat, datlen);
 	UNLOCK(rs);
 }
@@ -206,7 +249,7 @@ arc4random(void)
 	uint32_t v;
 
 	LOCK(rs);
-	

CVS commit: src/usr.bin/rsh

2014-06-07 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Sun Jun  8 01:44:52 UTC 2014

Modified Files:
src/usr.bin/rsh: rsh.c

Log Message:
Remove kerberos support code completely.  It no longer compiles anyway.
OK'ed by christos on tech-userlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/rsh/rsh.c

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

Modified files:

Index: src/usr.bin/rsh/rsh.c
diff -u src/usr.bin/rsh/rsh.c:1.33 src/usr.bin/rsh/rsh.c:1.34
--- src/usr.bin/rsh/rsh.c:1.33	Mon Aug 29 14:22:46 2011
+++ src/usr.bin/rsh/rsh.c	Sun Jun  8 01:44:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rsh.c,v 1.33 2011/08/29 14:22:46 joerg Exp $	*/
+/*	$NetBSD: rsh.c,v 1.34 2014/06/08 01:44:52 enami Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1990, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)rsh.c	8.4 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: rsh.c,v 1.33 2011/08/29 14:22:46 joerg Exp $);
+__RCSID($NetBSD: rsh.c,v 1.34 2014/06/08 01:44:52 enami Exp $);
 #endif
 #endif /* not lint */
 
@@ -282,13 +282,8 @@ main(int argc, char **argv)
 	else
 		pid = -1;
 
-#if defined(KERBEROS)  defined(CRYPT)
-	if (!doencrypt)
-#endif
-	{
-		(void)ioctl(remerr, FIONBIO, one);
-		(void)ioctl(rem, FIONBIO, one);
-	}
+	(void)ioctl(remerr, FIONBIO, one);
+	(void)ioctl(rem, FIONBIO, one);
 
 	talk(nflag, oset, pid, rem);
 
@@ -310,12 +305,7 @@ checkfd(struct pollfd *fdp, int outfd)
 		return 0;
 
 	errno = 0;
-#if defined(KERBEROS)  defined(CRYPT)
-	if (doencrypt)
-		nr = des_read(fdp-fd, buf, sizeof buf);
-	else
-#endif
-		nr = read(fdp-fd, buf, sizeof buf);
+	nr = read(fdp-fd, buf, sizeof buf);
 
 	if (nr = 0) {
 		if (errno != EAGAIN)
@@ -380,12 +370,7 @@ rewrite:		if (poll(fdp, 1, INFTIM) == -1
 			if ((fdp-revents  POLLOUT) == 0)
 goto rewrite;
 
-#if defined(KERBEROS)  defined(CRYPT)
-			if (doencrypt)
-nw = des_write(rem, bp, nr);
-			else
-#endif
-nw = write(rem, bp, nr);
+			nw = write(rem, bp, nr);
 
 			if (nw  0) {
 if (errno == EAGAIN)



CVS commit: src/usr.bin/rsh

2014-06-07 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Sun Jun  8 02:02:41 UTC 2014

Modified Files:
src/usr.bin/rsh: rsh.c

Log Message:
Whitespace nits.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/rsh/rsh.c

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

Modified files:

Index: src/usr.bin/rsh/rsh.c
diff -u src/usr.bin/rsh/rsh.c:1.34 src/usr.bin/rsh/rsh.c:1.35
--- src/usr.bin/rsh/rsh.c:1.34	Sun Jun  8 01:44:52 2014
+++ src/usr.bin/rsh/rsh.c	Sun Jun  8 02:02:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rsh.c,v 1.34 2014/06/08 01:44:52 enami Exp $	*/
+/*	$NetBSD: rsh.c,v 1.35 2014/06/08 02:02:41 enami Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1990, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)rsh.c	8.4 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: rsh.c,v 1.34 2014/06/08 01:44:52 enami Exp $);
+__RCSID($NetBSD: rsh.c,v 1.35 2014/06/08 02:02:41 enami Exp $);
 #endif
 #endif /* not lint */
 
@@ -300,7 +300,7 @@ checkfd(struct pollfd *fdp, int outfd)
 
 	if (fdp-revents  (POLLNVAL|POLLERR|POLLHUP))
 		return -1;
-	   
+
 	if ((fdp-revents  POLLIN) == 0)
 		return 0;
 
@@ -416,7 +416,7 @@ sendsig(int sig)
 	char signo;
 
 	signo = sig;
-		(void)write(remerr, signo, 1);
+	(void)write(remerr, signo, 1);
 }
 
 



CVS commit: src/external/gpl3/gcc/lib/libstdc++-v3

2014-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  8 02:23:46 UTC 2014

Modified Files:
src/external/gpl3/gcc/lib/libstdc++-v3: Makefile.inc

Log Message:
include relative to the parse directory.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc/lib/libstdc++-v3/Makefile.inc

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/lib/libstdc++-v3/Makefile.inc
diff -u src/external/gpl3/gcc/lib/libstdc++-v3/Makefile.inc:1.4 src/external/gpl3/gcc/lib/libstdc++-v3/Makefile.inc:1.5
--- src/external/gpl3/gcc/lib/libstdc++-v3/Makefile.inc:1.4	Sun Jun  1 15:51:01 2014
+++ src/external/gpl3/gcc/lib/libstdc++-v3/Makefile.inc	Sat Jun  7 22:23:46 2014
@@ -1,12 +1,11 @@
-# $NetBSD: Makefile.inc,v 1.4 2014/06/01 19:51:01 mrg Exp $
+# $NetBSD: Makefile.inc,v 1.5 2014/06/08 02:23:46 christos Exp $
 
 .ifndef _EXTERNAL_GPL3_GCC_LIB_LIBSTDCXX_MAKEFILE_INC_
 _EXTERNAL_GPL3_GCC_LIB_LIBSTDCXX_MAKEFILE_INC_=1
 
 GCC_MACHINE_ARCH=${MACHINE_ARCH:S/earmv5/earm/}
 
-.include ../../Makefile.inc
-.sinclude ../../../Makefile.gcc_path
-.sinclude ../../../../Makefile.gcc_path
+.include ${.PARSEDIR}/../Makefile.inc
+.include ${.PARSEDIR}/../../Makefile.gcc_path
 
 .endif



CVS commit: src/usr.bin/rsh

2014-06-07 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Sun Jun  8 02:44:15 UTC 2014

Modified Files:
src/usr.bin/rsh: rsh.c

Log Message:
Fix signal delivery to remote process; As described in rcmd(3), a signal
is delivered to the remote process via the secondary channel.  So,
the backend driver, rcmd(1), is responsible to watch the file descriptor 2
and transfer the data to the remote process, rather than receiving signal
by itself.  Previously, signal generated by tty was sent since rcmd was
incorrectly generated the data, but, for example, signal sent to rsh command
by kill command was ignored.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/rsh/rsh.c

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

Modified files:

Index: src/usr.bin/rsh/rsh.c
diff -u src/usr.bin/rsh/rsh.c:1.35 src/usr.bin/rsh/rsh.c:1.36
--- src/usr.bin/rsh/rsh.c:1.35	Sun Jun  8 02:02:41 2014
+++ src/usr.bin/rsh/rsh.c	Sun Jun  8 02:44:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rsh.c,v 1.35 2014/06/08 02:02:41 enami Exp $	*/
+/*	$NetBSD: rsh.c,v 1.36 2014/06/08 02:44:15 enami Exp $	*/
 
 /*-
  * Copyright (c) 1983, 1990, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)rsh.c	8.4 (Berkeley) 4/29/95;
 #else
-__RCSID($NetBSD: rsh.c,v 1.35 2014/06/08 02:02:41 enami Exp $);
+__RCSID($NetBSD: rsh.c,v 1.36 2014/06/08 02:44:15 enami Exp $);
 #endif
 #endif /* not lint */
 
@@ -76,7 +76,9 @@ int	remerr;
 static int sigs[] = { SIGINT, SIGTERM, SIGQUIT };
 
 static char   *copyargs(char **);
+#ifndef IN_RCMD
 static void	sendsig(int);
+#endif
 static int	checkfd(struct pollfd *, int);
 static void	talk(int, sigset_t *, pid_t, int);
 __dead static void	usage(void);
@@ -265,6 +267,7 @@ main(int argc, char **argv)
 
 	(void)sigprocmask(SIG_BLOCK, nset, oset);
 
+#ifndef IN_RCMD
 	for (i = 0; i  sizeof(sigs) / sizeof(sigs[0]); i++) {
 		struct sigaction sa;
 
@@ -273,6 +276,7 @@ main(int argc, char **argv)
 			(void)sigaction(sigs[i], sa, NULL);
 		}
 	}
+#endif
 
 	if (!nflag) {
 		pid = fork();
@@ -329,7 +333,7 @@ static void
 talk(int nflag, sigset_t *oset, __pid_t pid, int rem)
 {
 	int nr, nw, nfds;
-	struct pollfd fds[2], *fdp = fds[0];
+	struct pollfd fds[3], *fdp = fds[0];
 	char *bp, buf[BUFSIZ];
 
 	if (!nflag  pid == 0) {
@@ -385,31 +389,48 @@ done:
 		exit(0);
 	}
 
-	(void)sigprocmask(SIG_SETMASK, oset, NULL);
-	fds[0].events = fds[1].events = POLLIN|POLLNVAL|POLLERR|POLLHUP;
-	fds[0].fd = remerr;
-	fds[1].fd = rem;
+#ifdef IN_RCMD
 	fdp = fds[0];
+	nfds = 3;
+	fds[0].events = POLLIN|POLLNVAL|POLLERR|POLLHUP;
+	fds[0].fd = 2;
+#else
+	(void)sigprocmask(SIG_SETMASK, oset, NULL);
+	fdp = fds[1];
 	nfds = 2;
+	fds[0].events = 0;
+#endif
+	fds[1].events = fds[2].events = POLLIN|POLLNVAL|POLLERR|POLLHUP;
+	fds[1].fd = remerr;
+	fds[2].fd = rem;
 	do {
 		if (poll(fdp, nfds, INFTIM) == -1) {
 			if (errno != EINTR)
 err(1, poll);
 			continue;
 		}
-		if (fds[0].events != 0  checkfd(fds[0], 2) == -1) {
+		if ((fds[1].events != 0  checkfd(fds[1], 2) == -1)
+#ifdef IN_RCMD
+		|| (fds[0].events != 0  checkfd(fds[0], remerr) == -1)
+#endif
+		) {
+			nfds--;
+			fds[1].events = 0;
+#ifdef IN_RCMD
 			nfds--;
 			fds[0].events = 0;
-			fdp = fds[1];
+#endif
+			fdp = fds[2];
 		}
-		if (fds[1].events != 0  checkfd(fds[1], 1) == -1) {
+		if (fds[2].events != 0  checkfd(fds[2], 1) == -1) {
 			nfds--;
-			fds[1].events = 0;
+			fds[2].events = 0;
 		}
 	}
 	while (nfds);
 }
 
+#ifndef IN_RCMD
 static void
 sendsig(int sig)
 {
@@ -418,6 +439,7 @@ sendsig(int sig)
 	signo = sig;
 	(void)write(remerr, signo, 1);
 }
+#endif
 
 
 static char *



CVS commit: src/sys/kern

2014-06-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun  8 02:52:50 UTC 2014

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

Log Message:
Handle race where the server closed the socket between us 'connecting' and
sending data.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/kern/uipc_usrreq.c

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

Modified files:

Index: src/sys/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.152 src/sys/kern/uipc_usrreq.c:1.153
--- src/sys/kern/uipc_usrreq.c:1.152	Sun May 18 22:51:24 2014
+++ src/sys/kern/uipc_usrreq.c	Sat Jun  7 22:52:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.152 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.153 2014/06/08 02:52:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.152 2014/05/19 02:51:24 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.153 2014/06/08 02:52:50 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -303,6 +303,9 @@ unp_output(struct mbuf *m, struct mbuf *
 	struct socket *so2;
 	const struct sockaddr_un *sun;
 
+	/* XXX: server side closed the socket */
+	if (unp-unp_conn == NULL)
+		return ECONNREFUSED;
 	so2 = unp-unp_conn-unp_socket;
 
 	KASSERT(solocked(so2));