CVS commit: src/sys

2009-12-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Dec 20 09:36:06 UTC 2009

Modified Files:
src/sys/arch/xen/xen: xenevt.c
src/sys/compat/svr4: svr4_net.c
src/sys/compat/svr4_32: svr4_32_net.c
src/sys/dev/dmover: dmover_io.c
src/sys/dev/putter: putter.c
src/sys/kern: kern_descrip.c kern_drvctl.c kern_event.c sys_mqueue.c
sys_pipe.c sys_socket.c uipc_socket.c uipc_syscalls.c vfs_vnops.c
src/sys/net: bpf.c if_tap.c
src/sys/opencrypto: cryptodev.c
src/sys/sys: file.h pipe.h socketvar.h

Log Message:
If a multithreaded app closes an fd while another thread is blocked in
read/write/accept, then the expectation is that the blocked thread will
exit and the close complete.
Since only one fd is affected, but many fd can refer to the same file,
the close code can only request the fs code unblock with ERESTART.
Fixed for pipes and sockets, ERESTART will only be generated after such
a close - so there should be no change for other programs.
Also rename fo_abort() to fo_restart() (this used to be fo_drain()).
Fixes PR/26567


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/xen/xen/xenevt.c
cvs rdiff -u -r1.57 -r1.58 src/sys/compat/svr4/svr4_net.c
cvs rdiff -u -r1.20 -r1.21 src/sys/compat/svr4_32/svr4_32_net.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/dmover/dmover_io.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/putter/putter.c
cvs rdiff -u -r1.201 -r1.202 src/sys/kern/kern_descrip.c
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/kern_drvctl.c
cvs rdiff -u -r1.67 -r1.68 src/sys/kern/kern_event.c
cvs rdiff -u -r1.28 -r1.29 src/sys/kern/sys_mqueue.c
cvs rdiff -u -r1.126 -r1.127 src/sys/kern/sys_pipe.c
cvs rdiff -u -r1.62 -r1.63 src/sys/kern/sys_socket.c
cvs rdiff -u -r1.195 -r1.196 src/sys/kern/uipc_socket.c
cvs rdiff -u -r1.137 -r1.138 src/sys/kern/uipc_syscalls.c
cvs rdiff -u -r1.167 -r1.168 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.149 -r1.150 src/sys/net/bpf.c
cvs rdiff -u -r1.61 -r1.62 src/sys/net/if_tap.c
cvs rdiff -u -r1.50 -r1.51 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.69 -r1.70 src/sys/sys/file.h
cvs rdiff -u -r1.31 -r1.32 src/sys/sys/pipe.h
cvs rdiff -u -r1.122 -r1.123 src/sys/sys/socketvar.h

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

Modified files:

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.35 src/sys/arch/xen/xen/xenevt.c:1.36
--- src/sys/arch/xen/xen/xenevt.c:1.35	Wed Dec  9 21:32:58 2009
+++ src/sys/arch/xen/xen/xenevt.c	Sun Dec 20 09:36:05 2009
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.35 2009/12/09 21:32:58 dsl Exp $  */
+/*  $NetBSD: xenevt.c,v 1.36 2009/12/20 09:36:05 dsl Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.35 2009/12/09 21:32:58 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.36 2009/12/20 09:36:05 dsl Exp $);
 
 #include opt_xen.h
 #include sys/param.h
@@ -81,7 +81,7 @@
 	.fo_stat = fbadop_stat,
 	.fo_close = xenevt_fclose,
 	.fo_kqfilter = /* xenevt_fkqfilter */ fnullop_kqfilter,
-	.fo_abort = fnullop_abort,
+	.fo_restart = fnullop_restart,
 };
 
 dev_type_open(xenevtopen);

Index: src/sys/compat/svr4/svr4_net.c
diff -u src/sys/compat/svr4/svr4_net.c:1.57 src/sys/compat/svr4/svr4_net.c:1.58
--- src/sys/compat/svr4/svr4_net.c:1.57	Wed Dec  9 21:32:58 2009
+++ src/sys/compat/svr4/svr4_net.c	Sun Dec 20 09:36:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_net.c,v 1.57 2009/12/09 21:32:58 dsl Exp $	*/
+/*	$NetBSD: svr4_net.c,v 1.58 2009/12/20 09:36:05 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_net.c,v 1.57 2009/12/09 21:32:58 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_net.c,v 1.58 2009/12/20 09:36:05 dsl Exp $);
 
 #define COMPAT_SVR4 1
 
@@ -108,7 +108,7 @@
 	.fo_stat = soo_stat,
 	.fo_close = svr4_soo_close,
 	.fo_kqfilter = soo_kqfilter,
-	.fo_abort = soo_abort,
+	.fo_restart = soo_restart,
 };
 
 

Index: src/sys/compat/svr4_32/svr4_32_net.c
diff -u src/sys/compat/svr4_32/svr4_32_net.c:1.20 src/sys/compat/svr4_32/svr4_32_net.c:1.21
--- src/sys/compat/svr4_32/svr4_32_net.c:1.20	Wed Dec  9 21:32:58 2009
+++ src/sys/compat/svr4_32/svr4_32_net.c	Sun Dec 20 09:36:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_net.c,v 1.20 2009/12/09 21:32:58 dsl Exp $	 */
+/*	$NetBSD: svr4_32_net.c,v 1.21 2009/12/20 09:36:05 dsl Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: svr4_32_net.c,v 1.20 2009/12/09 21:32:58 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: svr4_32_net.c,v 1.21 2009/12/20 09:36:05 dsl Exp $);
 
 #define COMPAT_SVR4 1
 
@@ -102,7 +102,7 @@
 	.fo_poll = soo_poll,
 	.fo_stat = soo_stat,
 	.fo_close = svr4_soo_close,
-	.fo_abort = soo_abort,
+	

CVS commit: src/sys/dev/ic

2009-12-20 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Sun Dec 20 10:57:35 UTC 2009

Modified Files:
src/sys/dev/ic: lan9118.c

Log Message:
Set filter at lan9118_init() and lan9118_ioctl with SIOCSIFFLAGS.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/lan9118.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/ic/lan9118.c
diff -u src/sys/dev/ic/lan9118.c:1.11 src/sys/dev/ic/lan9118.c:1.12
--- src/sys/dev/ic/lan9118.c:1.11	Sun Dec  6 12:22:17 2009
+++ src/sys/dev/ic/lan9118.c	Sun Dec 20 10:57:35 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: lan9118.c,v 1.11 2009/12/06 12:22:17 kiyohara Exp $	*/
+/*	$NetBSD: lan9118.c,v 1.12 2009/12/20 10:57:35 kiyohara Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lan9118.c,v 1.11 2009/12/06 12:22:17 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: lan9118.c,v 1.12 2009/12/20 10:57:35 kiyohara Exp $);
 
 /*
  * The LAN9118 Family
@@ -490,6 +490,9 @@
 		case IFF_UP:
 			lan9118_init(ifp);
 			break;
+		case IFF_UP|IFF_RUNNING:
+			lan9118_set_filter(sc);
+			break;
 		default:
 			break;
 		}
@@ -625,6 +628,8 @@
 	lan9118_mac_writereg(sc, LAN9118_MAC_CR,
 	mac_cr | LAN9118_MAC_CR_TXEN | LAN9118_MAC_CR_RXEN);
 
+	lan9118_set_filter(sc);
+
 	ifp-if_flags |= IFF_RUNNING;
 	ifp-if_flags = ~IFF_OACTIVE;
 



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

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 13:49:36 UTC 2009

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

Log Message:
pthread_cond_timedwait (and therefore rumpuser_cv_timedwait) wants
an absolute time instead of a delta.  Fix bug which caused timed
tsleeps to always wake up immediately (unless the system clock was
around 0, which was not very probable ;).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/rump/librump/rumpkern/ltsleep.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/ltsleep.c
diff -u src/sys/rump/librump/rumpkern/ltsleep.c:1.23 src/sys/rump/librump/rumpkern/ltsleep.c:1.24
--- src/sys/rump/librump/rumpkern/ltsleep.c:1.23	Sat Dec  5 22:44:08 2009
+++ src/sys/rump/librump/rumpkern/ltsleep.c	Sun Dec 20 13:49:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ltsleep.c,v 1.23 2009/12/05 22:44:08 pooka Exp $	*/
+/*	$NetBSD: ltsleep.c,v 1.24 2009/12/20 13:49:36 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.23 2009/12/05 22:44:08 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.24 2009/12/20 13:49:36 pooka Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -58,6 +58,7 @@
 static int
 sleeper(struct ltsleeper *ltsp, int timo)
 {
+	struct timespec ts, ticks;
 	int rv, nlocks;
 
 	LIST_INSERT_HEAD(sleepers, ltsp, entries);
@@ -65,8 +66,12 @@
 
 	/* protected by biglock */
 	if (timo) {
+		ticks.tv_sec = timo / hz;
+		ticks.tv_nsec = (timo % hz) * (10/hz);
+		nanotime(ts);
+		timespecadd(ts, ticks, ts);
 		if (rumpuser_cv_timedwait(ltsp-cv, rump_giantlock,
-		timo / hz, (timo % hz) * (10/hz)) == 0)
+		ts.tv_sec, ts.tv_nsec) == 0)
 			rv = 0;
 		else
 			rv = EWOULDBLOCK;



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

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 13:56:36 UTC 2009

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

Log Message:
add comment about prospective perils to previous


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/rump/librump/rumpkern/ltsleep.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/ltsleep.c
diff -u src/sys/rump/librump/rumpkern/ltsleep.c:1.24 src/sys/rump/librump/rumpkern/ltsleep.c:1.25
--- src/sys/rump/librump/rumpkern/ltsleep.c:1.24	Sun Dec 20 13:49:36 2009
+++ src/sys/rump/librump/rumpkern/ltsleep.c	Sun Dec 20 13:56:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ltsleep.c,v 1.24 2009/12/20 13:49:36 pooka Exp $	*/
+/*	$NetBSD: ltsleep.c,v 1.25 2009/12/20 13:56:36 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.24 2009/12/20 13:49:36 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: ltsleep.c,v 1.25 2009/12/20 13:56:36 pooka Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -66,10 +66,16 @@
 
 	/* protected by biglock */
 	if (timo) {
+		/*
+		 * Calculate wakeup-time.
+		 * XXX: should assert nanotime() does not block,
+		 * i.e. yield the cpu and/or biglock.
+		 */
 		ticks.tv_sec = timo / hz;
 		ticks.tv_nsec = (timo % hz) * (10/hz);
 		nanotime(ts);
 		timespecadd(ts, ticks, ts);
+
 		if (rumpuser_cv_timedwait(ltsp-cv, rump_giantlock,
 		ts.tv_sec, ts.tv_nsec) == 0)
 			rv = 0;



CVS commit: src/sbin/newfs

2009-12-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Dec 20 15:21:13 UTC 2009

Modified Files:
src/sbin/newfs: Makefile newfs.c

Log Message:
Push the mount path for mount_mfs through realpath().
This matches what other fs do.
Fixes PR/20362


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sbin/newfs/Makefile
cvs rdiff -u -r1.105 -r1.106 src/sbin/newfs/newfs.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/newfs/Makefile
diff -u src/sbin/newfs/Makefile:1.34 src/sbin/newfs/Makefile:1.35
--- src/sbin/newfs/Makefile:1.34	Sat Jun  6 11:09:16 2009
+++ src/sbin/newfs/Makefile	Sun Dec 20 15:21:13 2009
@@ -1,15 +1,17 @@
-#	$NetBSD: Makefile,v 1.34 2009/06/06 11:09:16 haad Exp $
+#	$NetBSD: Makefile,v 1.35 2009/12/20 15:21:13 dsl Exp $
 #	@(#)Makefile	8.2 (Berkeley) 3/27/94
 
 .include bsd.own.mk
 
 PROG=	newfs
 SRCS=	dkcksum.c newfs.c mkfs.c ffs_bswap.c ffs_appleufs.c partutil.c
+SRCS+=	pathadj.c
 MAN=	newfs.8 mount_mfs.8
 
 DISKLABEL=${NETBSDSRCDIR}/sbin/disklabel
 FSCK=${NETBSDSRCDIR}/sbin/fsck
-CPPFLAGS+=-DMFS -I${.CURDIR} -I${DISKLABEL} -I${FSCK}
+MOUNT=${NETBSDSRCDIR}/sbin/mount
+CPPFLAGS+=-DMFS -I${.CURDIR} -I${DISKLABEL} -I${FSCK} -I${MOUNT}
 
 DPADD+= ${LIBUTIL}
 LDADD+= -lutil
@@ -17,7 +19,7 @@
 LDADD+=-lprop
 DPADD+=${LIBPROP}
 
-.PATH:	${DISKLABEL} ${NETBSDSRCDIR}/sys/ufs/ffs ${FSCK}
+.PATH:	${DISKLABEL} ${NETBSDSRCDIR}/sys/ufs/ffs ${FSCK} ${MOUNT}
 
 LINKS=	${BINDIR}/newfs ${BINDIR}/mount_mfs
 MLINKS=	mount_mfs.8 mfs.8

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.105 src/sbin/newfs/newfs.c:1.106
--- src/sbin/newfs/newfs.c:1.105	Thu May  7 06:56:56 2009
+++ src/sbin/newfs/newfs.c	Sun Dec 20 15:21:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.105 2009/05/07 06:56:56 lukem Exp $	*/
+/*	$NetBSD: newfs.c,v 1.106 2009/12/20 15:21:13 dsl Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@
 #if 0
 static char sccsid[] = @(#)newfs.c	8.13 (Berkeley) 5/1/95;
 #else
-__RCSID($NetBSD: newfs.c,v 1.105 2009/05/07 06:56:56 lukem Exp $);
+__RCSID($NetBSD: newfs.c,v 1.106 2009/12/20 15:21:13 dsl Exp $);
 #endif
 #endif /* not lint */
 
@@ -117,6 +117,10 @@
 #include util.h
 #include mntopts.h
 
+#ifdef MFS
+#include mountprog.h
+#endif
+
 #include dkcksum.h
 #include extern.h
 #include partutil.h
@@ -238,6 +242,7 @@
 #ifdef MFS
 	struct mfs_args args;
 	char mountfromname[100];
+	char mounttoname[MAXPATHLEN];
 	pid_t pid, res;
 	struct statvfs sf;
 	int status;
@@ -653,6 +658,7 @@
 #ifdef MFS
 	if (mfs) {
 
+		pathadj(argv[1], mounttoname);
 		switch (pid = fork()) {
 		case -1:
 			perror(mfs);
@@ -676,10 +682,10 @@
  * can mount a filesystem which hides our
  * ramdisk before we see the success.
  */
-if (statvfs(argv[1], sf)  0)
-	err(88, statvfs %s, argv[1]);
+if (statvfs(mounttoname, sf)  0)
+	err(88, statvfs %s, mounttoname);
 if (!strcmp(sf.f_mntfromname, mountfromname) 
-!strncmp(sf.f_mntonname, argv[1],
+!strncmp(sf.f_mntonname, mounttoname,
 	 MNAMELEN) 
 !strcmp(sf.f_fstypename, mfs))
 	exit(0);
@@ -692,7 +698,7 @@
 if (WIFEXITED(status)) {
 	if (WEXITSTATUS(status) == 0)
 		exit(0);
-	errx(1, %s: mount: %s, argv[1],
+	errx(1, %s: mount: %s, mounttoname,
 	 strerror(WEXITSTATUS(status)));
 } else
 	errx(11, abnormal termination);
@@ -708,7 +714,7 @@
 
 		args.base = membase;
 		args.size = fssize * sectorsize;
-		if (mount(MOUNT_MFS, argv[1], mntflags | MNT_ASYNC,
+		if (mount(MOUNT_MFS, mounttoname, mntflags | MNT_ASYNC,
 		args, sizeof args) == -1)
 			exit(errno); /* parent prints message */
 	}



CVS commit: src/sys/rump/dev/wip/librumpusbhc

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 15:32:47 UTC 2009

Modified Files:
src/sys/rump/dev/wip/librumpusbhc: rumpusbhc.c

Log Message:
Improve bulk transfer implementation by adding more complete
support for short reads.

Ironically, in some cases this works *worse* than the previous
incorrect implementation which silently ignored short reads.
Namely, I can now probe my s...@umass USB stick only once without
having to replug it.  Some ugen bus reset is probably needed,
but what exactly is unknown, and manual handjobs will have to
suffice for now.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.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/dev/wip/librumpusbhc/rumpusbhc.c
diff -u src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.9 src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.10
--- src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c:1.9	Tue Dec 15 15:50:37 2009
+++ src/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c	Sun Dec 20 15:32:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpusbhc.c,v 1.9 2009/12/15 15:50:37 pooka Exp $	*/
+/*	$NetBSD: rumpusbhc.c,v 1.10 2009/12/20 15:32:46 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rumpusbhc.c,v 1.9 2009/12/15 15:50:37 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rumpusbhc.c,v 1.10 2009/12/20 15:32:46 pooka Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -499,6 +499,8 @@
 	case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
 	case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
 	case C(0xff, UT_WRITE_CLASS_INTERFACE):
+	case C(0x20, UT_WRITE_CLASS_INTERFACE):
+	case C(0x22, UT_WRITE_CLASS_INTERFACE):
 	case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER):
 	case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_OTHER):
 	case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT):
@@ -659,9 +661,12 @@
 {
 	struct rumpusbhc_softc *sc = xfer-pipe-device-bus-hci_private;
 	ssize_t n;
+	ssize_t done;
 	bool isread;
 	int len, error, endpt;
 	uint8_t *buf;
+	int xfererr = 0;
+	int val;
 
 	endpt = xfer-pipe-endpoint-edesc-bEndpointAddress;
 	isread = UE_GET_DIR(endpt) == UE_DIR_IN;
@@ -671,34 +676,57 @@
 	KASSERT(xfer-length);
 	len = xfer-length;
 	buf = KERNADDR(xfer-dmabuf, 0);
+	done = 0;
 
 	while (RUSB(xfer)-rusb_status == 0) {
 		if (isread) {
+			if (xfer-flags  USBD_SHORT_XFER_OK)
+val = 1;
+			else
+val = 0;
+			rumpuser_ioctl(sc-sc_ugenfd[endpt],
+			USB_SET_SHORT_XFER, val, error);
 			n = rumpuser_read(sc-sc_ugenfd[endpt],
-			buf, len, error);
-			if (n == len)
-break;
-			if (error != EAGAIN) {
+			buf+done, len-done, error);
+			if (n == -1) {
+if (error == ETIMEDOUT)
+	continue;
 n = 0;
-break;
+xfer-status = USBD_IOERROR;
+goto out;
 			}
+			done += n;
+			if (done == len)
+break;
 		} else {
 			n = rumpuser_write(sc-sc_ugenfd[endpt],
 			buf, len, error);
-			if (n == len)
+			done = n;
+			if (done == len)
 break;
 			else
 panic(short write);
 		}
+
+		if (xfer-flags  USBD_SHORT_XFER_OK)
+			break;
 	}
 
 	if (RUSB(xfer)-rusb_status == 0) {
-		xfer-actlen = n;
+		xfer-actlen = done;
 		xfer-status = USBD_NORMAL_COMPLETION;
+		/* override */
+		if (xfererr) {
+			printf(err!\n);
+			xfer-status = xfererr;
+		}
 	} else {
 		xfer-status = USBD_CANCELLED;
 		RUSB(xfer)-rusb_status = 2;
 	}
+ out:
+	val = 0;
+	rumpuser_ioctl(sc-sc_ugenfd[endpt], USB_SET_SHORT_XFER, val, error);
 	usb_transfer_complete(xfer);
 	return (USBD_IN_PROGRESS);
 }



CVS commit: src/sys/rump/dev/wip

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 15:43:13 UTC 2009

Modified Files:
src/sys/rump/dev/wip: Makefile
Added Files:
src/sys/rump/dev/wip/libucom: Makefile locators.h shlib_version ucom.h
ucom_at_usb.c

Log Message:
Add u...@usb support.  This uses the uplcom hardware driver currently
(because that's the hardware I happen to have), but others can just
be plugged in if a need arises.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/wip/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/rump/dev/wip/libucom/Makefile \
src/sys/rump/dev/wip/libucom/locators.h \
src/sys/rump/dev/wip/libucom/shlib_version \
src/sys/rump/dev/wip/libucom/ucom.h \
src/sys/rump/dev/wip/libucom/ucom_at_usb.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/dev/wip/Makefile
diff -u src/sys/rump/dev/wip/Makefile:1.1 src/sys/rump/dev/wip/Makefile:1.2
--- src/sys/rump/dev/wip/Makefile:1.1	Wed Nov 11 13:54:54 2009
+++ src/sys/rump/dev/wip/Makefile	Sun Dec 20 15:43:13 2009
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.1 2009/11/11 13:54:54 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2009/12/20 15:43:13 pooka Exp $
 #
 
-SUBDIR=	libnet80211 librumpusbhc libumass libusb libusbrum
+SUBDIR=	libnet80211 librumpusbhc libucom libumass libusb libusbrum
 
 .include bsd.subdir.mk

Added files:

Index: src/sys/rump/dev/wip/libucom/Makefile
diff -u /dev/null src/sys/rump/dev/wip/libucom/Makefile:1.1
--- /dev/null	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/libucom/Makefile	Sun Dec 20 15:43:13 2009
@@ -0,0 +1,16 @@
+#	$NetBSD: Makefile,v 1.1 2009/12/20 15:43:13 pooka Exp $
+#
+
+.PATH:	${.CURDIR}/../../../../dev/usb
+
+LIB=	rumpdev_ucom
+
+SRCS=	ucom.c uplcom.c
+
+SRCS+=	ucom_at_usb.c
+
+CFLAGS+=	-Wno-pointer-sign
+CPPFLAGS+=	-I${RUMPTOP}/librump/rumpvfs
+
+.include bsd.lib.mk
+.include bsd.klinks.mk
Index: src/sys/rump/dev/wip/libucom/locators.h
diff -u /dev/null src/sys/rump/dev/wip/libucom/locators.h:1.1
--- /dev/null	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/libucom/locators.h	Sun Dec 20 15:43:13 2009
@@ -0,0 +1,7 @@
+/*	$NetBSD: locators.h,v 1.1 2009/12/20 15:43:13 pooka Exp $	*/
+
+/* locators borrowed from config.  redo properly some day */
+
+#define UCOMBUSCF_PORTNO 0
+#define UCOMBUSCF_PORTNO_DEFAULT -1
+#define UCOMBUSCF_NLOCS 1
Index: src/sys/rump/dev/wip/libucom/shlib_version
diff -u /dev/null src/sys/rump/dev/wip/libucom/shlib_version:1.1
--- /dev/null	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/libucom/shlib_version	Sun Dec 20 15:43:13 2009
@@ -0,0 +1,4 @@
+#	$NetBSD: shlib_version,v 1.1 2009/12/20 15:43:13 pooka Exp $
+#
+major=0
+minor=0
Index: src/sys/rump/dev/wip/libucom/ucom.h
diff -u /dev/null src/sys/rump/dev/wip/libucom/ucom.h:1.1
--- /dev/null	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/libucom/ucom.h	Sun Dec 20 15:43:13 2009
@@ -0,0 +1,3 @@
+/*	$NetBSD: ucom.h,v 1.1 2009/12/20 15:43:13 pooka Exp $	*/
+
+#define NUCOM 1
Index: src/sys/rump/dev/wip/libucom/ucom_at_usb.c
diff -u /dev/null src/sys/rump/dev/wip/libucom/ucom_at_usb.c:1.1
--- /dev/null	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/libucom/ucom_at_usb.c	Sun Dec 20 15:43:13 2009
@@ -0,0 +1,445 @@
+/*	$NetBSD: ucom_at_usb.c,v 1.1 2009/12/20 15:43:13 pooka Exp $	*/
+
+#include sys/param.h
+#include sys/types.h
+#include sys/conf.h
+#include sys/device.h
+#include sys/kmem.h
+
+/*
+ * MACHINE GENERATED: DO NOT EDIT
+ *
+ * ioconf.c, from TESTI_ucom
+ */
+
+#include sys/param.h
+#include sys/conf.h
+#include sys/device.h
+#include sys/mount.h
+
+static const struct cfiattrdata gpibdevcf_iattrdata = {
+	gpibdev, 1,
+	{
+		{ address, -1, -1 },
+	}
+};
+static const struct cfiattrdata acpibuscf_iattrdata = {
+	acpibus, 0, {
+		{ NULL, NULL, 0 },
+	}
+};
+static const struct cfiattrdata caccf_iattrdata = {
+	cac, 1,
+	{
+		{ unit, -1, -1 },
+	}
+};
+static const struct cfiattrdata spicf_iattrdata = {
+	spi, 1,
+	{
+		{ slave, NULL, 0 },
+	}
+};
+static const struct cfiattrdata radiodevcf_iattrdata = {
+	radiodev, 0, {
+		{ NULL, NULL, 0 },
+	}
+};
+static const struct cfiattrdata mlxcf_iattrdata = {
+	mlx, 1,
+	{
+		{ unit, -1, -1 },
+	}
+};
+static const struct cfiattrdata ucombuscf_iattrdata = {
+	ucombus, 1,
+	{
+		{ portno, -1, -1 },
+	}
+};
+static const struct cfiattrdata videobuscf_iattrdata = {
+	videobus, 0, {
+		{ NULL, NULL, 0 },
+	}
+};
+static const struct cfiattrdata isabuscf_iattrdata = {
+	isabus, 0, {
+		{ NULL, NULL, 0 },
+	}
+};
+static const struct cfiattrdata i2cbuscf_iattrdata = {
+	i2cbus, 0, {
+		{ NULL, NULL, 0 },
+	}
+};
+static const struct cfiattrdata ata_hlcf_iattrdata = {
+	ata_hl, 1,
+	{
+		{ drive, -1, -1 },
+	}
+};
+static const struct cfiattrdata depcacf_iattrdata = {
+	depca, 0, {
+		{ NULL, NULL, 0 },
+	}
+};
+static const struct cfiattrdata ppbuscf_iattrdata = {
+	ppbus, 0, {
+		{ NULL, NULL, 0 },
+	}
+};
+static const struct 

CVS commit: src/sys/rump/dev/wip

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 15:43:57 UTC 2009

Modified Files:
src/sys/rump/dev/wip: Makefile

Log Message:
+libulpt


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/dev/wip/Makefile

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/dev/wip/Makefile
diff -u src/sys/rump/dev/wip/Makefile:1.2 src/sys/rump/dev/wip/Makefile:1.3
--- src/sys/rump/dev/wip/Makefile:1.2	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/Makefile	Sun Dec 20 15:43:57 2009
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.2 2009/12/20 15:43:13 pooka Exp $
+#	$NetBSD: Makefile,v 1.3 2009/12/20 15:43:57 pooka Exp $
 #
 
-SUBDIR=	libnet80211 librumpusbhc libucom libumass libusb libusbrum
+SUBDIR=	libnet80211 librumpusbhc libucom libumass libulpt libusb libusbrum
 
 .include bsd.subdir.mk



CVS commit: src/distrib/notes/common

2009-12-20 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Sun Dec 20 16:59:39 UTC 2009

Modified Files:
src/distrib/notes/common: main

Log Message:
Add myself.


To generate a diff of this commit:
cvs rdiff -u -r1.453 -r1.454 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.453 src/distrib/notes/common/main:1.454
--- src/distrib/notes/common/main:1.453	Sat Dec  5 16:29:10 2009
+++ src/distrib/notes/common/main	Sun Dec 20 16:59:39 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: main,v 1.453 2009/12/05 16:29:10 pooka Exp $
+.\	$NetBSD: main,v 1.454 2009/12/20 16:59:39 jruoho Exp $
 .\
 .\ Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -1327,6 +1327,7 @@
 .It Ta Hans Rosenfeld Ta Mt h...@netbsd.org
 .It Ta Gordon Ross Ta Mt g...@netbsd.org
 .It Ta Steve Rumble Ta Mt rum...@netbsd.org
+.It Ta Jukka Ruohonen Ta Mt jru...@netbsd.org
 .It Ta Ilpo Ruotsalainen Ta Mt lonew...@netbsd.org
 .It Ta Heiko W. Rupp Ta Mt h...@netbsd.org
 .It Ta Blair J. Sadewitz Ta Mt b...@netbsd.org



CVS commit: src/sbin/fdisk

2009-12-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Dec 20 17:32:09 UTC 2009

Modified Files:
src/sbin/fdisk: fdisk.c

Log Message:
Add a large comment about disk geometries.
Rename (with #defines) the variables use for aligning partitions to
separate them from the bios geometry.
All in advance of allowing other partition alignments (eg 2048 sectors).


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sbin/fdisk/fdisk.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/fdisk/fdisk.c
diff -u src/sbin/fdisk/fdisk.c:1.126 src/sbin/fdisk/fdisk.c:1.127
--- src/sbin/fdisk/fdisk.c:1.126	Thu Dec 17 14:27:49 2009
+++ src/sbin/fdisk/fdisk.c	Sun Dec 20 17:32:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdisk.c,v 1.126 2009/12/17 14:27:49 pooka Exp $ */
+/*	$NetBSD: fdisk.c,v 1.127 2009/12/20 17:32:09 dsl Exp $ */
 
 /*
  * Mach Operating System
@@ -39,7 +39,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: fdisk.c,v 1.126 2009/12/17 14:27:49 pooka Exp $);
+__RCSID($NetBSD: fdisk.c,v 1.127 2009/12/20 17:32:09 dsl Exp $);
 #endif /* not lint */
 
 #define MBRPTYPENAMES
@@ -120,9 +120,6 @@
 
 #define GPT_TYPE(offs) ((offs) == GPT_HDR_BLKNO ?  primary : secondary)
 
-#define LBUF 100
-static char lbuf[LBUF];
-
 #ifndef PRIdaddr
 #define PRIdaddr PRId64
 #endif
@@ -131,17 +128,6 @@
 #define _PATH_DEFDISK	/dev/rwd0d
 #endif
 
-const char *disk = _PATH_DEFDISK;
-
-struct disklabel disklabel;		/* disk parameters */
-
-unsigned int cylinders, sectors, heads;
-daddr_t disksectors;
-#define cylindersectors (heads * sectors)
-
-struct mbr_sector mboot;
-
-
 struct {
 	struct mbr_sector *ptn;		/* array of pbrs */
 	daddr_t		base;		/* first sector of ext. ptn */
@@ -151,6 +137,15 @@
 	int		is_corrupt;	/* 1 if extended chain illegal */
 } ext;
 
+#define LBUF 100
+static char lbuf[LBUF];
+
+const char *disk = _PATH_DEFDISK;
+
+struct disklabel disklabel;		/* disk parameters */
+
+struct mbr_sector mboot;
+
 const char *boot_dir = DEFAULT_BOOTDIR;
 char *boot_path = 0;			/* name of file we actually opened */
 
@@ -162,6 +157,45 @@
 #define OPTIONS			0123FSafiluvs:b:c:E:r:w:
 #endif
 
+/*
+ * Disk geometry and partition alignment.
+ *
+ * Modern disks do not have a fixed geomery and will always give a 'faked'
+ * geometry that matches the ATA standard - max 16 heads and 256 sec/track.
+ * The ATA geometry allows access to 2^28 sectors (as does LBA mode).
+ *
+ * The BIOS calls originally used an 8bit register for cylinder, head and
+ * sector. Later 2 bits were stolen from the sector number and added to
+ * cylinder number. The BIOS will translate this faked geometry either to
+ * the geometry reported by the disk, or do LBA reads (possibly LBA48).
+ * BIOS CHS reads have all sorts of limits, but 2^24 is absolute.
+ * For historic reasons the BIOS geometry is the called the dos geometry!
+ *
+ * If you know the disks real geometry it is usually worth aligning
+ * disk partitions to cylinder boundaries (certainly traditional!).
+ * For 'mbr' disks this has always been done with the BIOS geometry.
+ * The first track (typically 63 sectors) is reserved because the first
+ * sector is used for boot code. Similarly the data partition in an
+ * extended partition will start one track in. If an extended partition
+ * starts at the beginning of the disk you lose 2 tracks.
+ *
+ * However non-magnetic media in particular has physical sectors that are
+ * not the same size as those reported, so has to do read modify write
+ * sequences for misaligned transfers. The alignment of partitions to
+ * cylinder boundaries makes this happen all the time.
+ *
+ * It is thus sensible to align partitions on a sensible sector boundary.
+ * For instance 1MB (2048 sectors).
+ * Common code can do this by using a geometry with 1 head and 2048
+ * sectors per track.
+ */
+
+/* Disks reported geometry and overall size from device driver */
+unsigned int cylinders, sectors, heads;
+daddr_t disksectors;
+#define cylindersectors (heads * sectors)
+
+/* Geometry from the BIOS */
 unsigned int dos_cylinders;
 unsigned int dos_heads;
 unsigned int dos_sectors;
@@ -180,6 +214,10 @@
 #define	MAXSECTOR	63
 int partition = -1;
 
+/* Alignment of partition, and offset if first sector unusable */
+#define	ptn_alignment	dos_cylindersectors
+#define	ptn_offset	dos_sectors
+
 int fd = -1, wfd = -1, *rfd = fd;
 char *disk_file = NULL;
 char *disk_type = NULL;
@@ -745,8 +783,8 @@
 	indent, , start, size);
 	if (size != 0) {
 		printf( (%u MB, Cyls , SEC_TO_MB(size));
-		if (v_flag == 0  le32toh(partp-mbrp_start) == dos_sectors)
-			pr_cyls(start - dos_sectors, 0);
+		if (v_flag == 0  le32toh(partp-mbrp_start) == ptn_offset)
+			pr_cyls(start - ptn_offset, 0);
 		else
 			pr_cyls(start, 0);
 		printf(-);
@@ -1676,8 +1714,8 @@
 		partp = ext.ptn[part - 1].mbr_parts[1];
 		ext.ptn[part].mbr_parts[1] = *partp;
 		/* and prev onto us */
-		

CVS commit: src/sys/kern

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 19:06:45 UTC 2009

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

Log Message:
Add a pointing to an explanation of why we have #ifdef pmax stuff in here.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/kern/tty_pty.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/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.119 src/sys/kern/tty_pty.c:1.120
--- src/sys/kern/tty_pty.c:1.119	Wed Oct 14 19:25:39 2009
+++ src/sys/kern/tty_pty.c	Sun Dec 20 19:06:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.119 2009/10/14 19:25:39 dsl Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.120 2009/12/20 19:06:44 pooka Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tty_pty.c,v 1.119 2009/10/14 19:25:39 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: tty_pty.c,v 1.120 2009/12/20 19:06:44 pooka Exp $);
 
 #include opt_ptm.h
 
@@ -119,6 +119,7 @@
 };
 
 #if defined(pmax)
+/* see arch/pmax/conf/majors.pmax */
 const struct cdevsw ptc_ultrix_cdevsw = {
 	ptcopen, ptcclose, ptcread, ptcwrite, ptyioctl,
 	nullstop, ptytty, ptcpoll, nommap, ptckqfilter, D_TTY



CVS commit: src/external/bsd/libelf/dist

2009-12-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Dec 20 19:38:13 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf.c

Log Message:
PRIVATE_VERSION(arch) isn't ever used, so don't try to setup this member
of _libelf{}.  ELF??_MACHDEP_ID may not be defined if ELFSIZE wasn't
defined before including this file.

this fixes a build error on mips platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/libelf.c

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

Modified files:

Index: src/external/bsd/libelf/dist/libelf.c
diff -u src/external/bsd/libelf/dist/libelf.c:1.3 src/external/bsd/libelf/dist/libelf.c:1.4
--- src/external/bsd/libelf/dist/libelf.c:1.3	Sat Dec 19 07:52:59 2009
+++ src/external/bsd/libelf/dist/libelf.c	Sun Dec 20 19:38:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $	*/
+/*	$NetBSD: libelf.c,v 1.4 2009/12/20 19:38:13 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $);
+__RCSID($NetBSD: libelf.c,v 1.4 2009/12/20 19:38:13 mrg Exp $);
 
 #include sys/param.h
 
@@ -43,18 +43,16 @@
 
 #if defined(__NetBSD__)
 # if ARCH_ELFSIZE == 64
-#  define ELF_ARCH		ELF64_MACHDEP_ID
 #  define ELF_TARG_DATA		ELF64_MACHDEP_ENDIANNESS
 #  define ELF_TARG_CLASS	ELFCLASS64
 # else
-#  define ELF_ARCH		ELF32_MACHDEP_ID
 #  define ELF_TARG_DATA		ELF32_MACHDEP_ENDIANNESS
 #  define ELF_TARG_CLASS	ELFCLASS32
 # endif /* ARCH_ELFSIZE */
 #endif /* __NetBSD__ */
 
 struct _libelf_globals _libelf = {
-	.libelf_arch		= ELF_ARCH,
+	.libelf_arch		= 0 /* unused - ELF_ARCH */,
 	.libelf_byteorder	= ELF_TARG_DATA,
 	.libelf_class		= ELF_TARG_CLASS,
 	.libelf_error		= 0,



CVS commit: src/sys/rump/dev/wip/libucom

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 19:44:21 UTC 2009

Modified Files:
src/sys/rump/dev/wip/libucom: Makefile ucom_at_usb.c

Log Message:
Include tty driver here for now to make this usable.  Will disappear
from here later when I figure out the proper place.
(I'd commit it as a separate component, but I can't figure out how
to classify it, since it's logically none of vfs/net/dev)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/dev/wip/libucom/Makefile \
src/sys/rump/dev/wip/libucom/ucom_at_usb.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/dev/wip/libucom/Makefile
diff -u src/sys/rump/dev/wip/libucom/Makefile:1.1 src/sys/rump/dev/wip/libucom/Makefile:1.2
--- src/sys/rump/dev/wip/libucom/Makefile:1.1	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/libucom/Makefile	Sun Dec 20 19:44:21 2009
@@ -1,13 +1,14 @@
-#	$NetBSD: Makefile,v 1.1 2009/12/20 15:43:13 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2009/12/20 19:44:21 pooka Exp $
 #
 
-.PATH:	${.CURDIR}/../../../../dev/usb
+.PATH:	${.CURDIR}/../../../../dev/usb ${.CURDIR}/../../../../kern
 
 LIB=	rumpdev_ucom
 
 SRCS=	ucom.c uplcom.c
 
 SRCS+=	ucom_at_usb.c
+SRCS+=	tty.c tty_conf.c tty_tty.c tty_subr.c
 
 CFLAGS+=	-Wno-pointer-sign
 CPPFLAGS+=	-I${RUMPTOP}/librump/rumpvfs
Index: src/sys/rump/dev/wip/libucom/ucom_at_usb.c
diff -u src/sys/rump/dev/wip/libucom/ucom_at_usb.c:1.1 src/sys/rump/dev/wip/libucom/ucom_at_usb.c:1.2
--- src/sys/rump/dev/wip/libucom/ucom_at_usb.c:1.1	Sun Dec 20 15:43:13 2009
+++ src/sys/rump/dev/wip/libucom/ucom_at_usb.c	Sun Dec 20 19:44:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom_at_usb.c,v 1.1 2009/12/20 15:43:13 pooka Exp $	*/
+/*	$NetBSD: ucom_at_usb.c,v 1.2 2009/12/20 19:44:21 pooka Exp $	*/
 
 #include sys/param.h
 #include sys/types.h
@@ -412,6 +412,8 @@
 		panic(\%s\ failed, #call);\
 } while (/*CONSTCOND*/0)
 
+void tty_init(void);
+
 void
 rump_device_configuration(void)
 {
@@ -442,4 +444,6 @@
 	cmaj, 0, 1));
 	FLAWLESSCALL(rump_vfs_makedevnodes(S_IFCHR, /dev/dtyU, '0',
 	cmaj, 0x8, 1));
+
+	tty_init();
 }



CVS commit: src/share/examples/rump/tipsy

2009-12-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Dec 20 19:50:29 UTC 2009

Added Files:
src/share/examples/rump/tipsy: Makefile tipsy.c

Log Message:
Add a simple terminal program which uses a rump kernel for a u...@usb
terminal and host terminal stdin/stdout for human interaction.
Tipsy just simply shovels bits between the two.  I can use my
JavaStation Krups (*) serial console with this ... without having
to worry abort those pesky usb drivers crashing my desktop kernel.

*) strictly speaking it's uwe's ;)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/examples/rump/tipsy/Makefile \
src/share/examples/rump/tipsy/tipsy.c

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

Added files:

Index: src/share/examples/rump/tipsy/Makefile
diff -u /dev/null src/share/examples/rump/tipsy/Makefile:1.1
--- /dev/null	Sun Dec 20 19:50:29 2009
+++ src/share/examples/rump/tipsy/Makefile	Sun Dec 20 19:50:29 2009
@@ -0,0 +1,15 @@
+#	$NetBSD: Makefile,v 1.1 2009/12/20 19:50:29 pooka Exp $
+#
+
+PROG=	tipsy
+
+LDADD+=	-lrumpvfs
+LDADD+=	-lrumpdev_usb -lrumpdev_usbhc -lrumpdev_ucom -lrumpdev
+LDADD+=	-lrump
+LDADD+=	-lrumpuser -lpthread
+
+DBG=	-g
+NOMAN=	
+WARNS=	4
+
+.include bsd.prog.mk
Index: src/share/examples/rump/tipsy/tipsy.c
diff -u /dev/null src/share/examples/rump/tipsy/tipsy.c:1.1
--- /dev/null	Sun Dec 20 19:50:29 2009
+++ src/share/examples/rump/tipsy/tipsy.c	Sun Dec 20 19:50:29 2009
@@ -0,0 +1,151 @@
+/*	$NetBSD: tipsy.c,v 1.1 2009/12/20 19:50:29 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Experimental proof-of-concept program:
+ *
+ * tip-on-booze.  Uses rump kernel for ucom driver + underlying
+ * hardware.  Just shovels bits back and forth between the user
+ * terminal and the ucom device.
+ *
+ * Seems to drop an occasional character for output here and there.
+ * Haven't pinpointed the problem yet.  It happens commonly for certain
+ * patterns such as ctrl-U followed by immediate typing.  Tipsy is quite
+ * sober despite this feature.
+ */
+
+#include sys/types.h
+#include sys/ioctl.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include err.h
+#include errno.h
+#include fcntl.h
+#include pthread.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+#include termios.h
+
+/*
+ * We use a shovel thread to get the bits from the rump kernel and
+ * print them on the terminal.  The reason for a thread instead of
+ * polling is that we currently have no way to poll two fd's when
+ * they are in different kernels (stdin in the host, ucom in rump).
+ */
+static void *
+shovel(void *arg)
+{
+	char buf[64];
+	ssize_t n;
+	int fd = (int)(intptr_t)arg;
+
+	for (;;) {
+		n = rump_sys_read(fd, buf, sizeof(buf));
+		if (__predict_false(n = 0)) {
+			if (n == 0)
+errx(1, ucom EOF);
+			if (n == -1)
+err(1, ucom read);
+		}
+		if (write(STDOUT_FILENO, buf, n) != n)
+			err(1, write to console);
+	}
+}
+
+int
+main(int argc, char *argv[])
+{
+	pthread_t pt;
+struct termios tios;
+	int probeonly = 0;
+	int com;
+
+	if (argc  1) {
+		if (argc == 2  strcmp(argv[1], probe) == 0) {
+			probeonly = 1;
+		} else {
+			fprintf(stderr, mind the usage\n);
+			exit(1);
+		}
+	}
+
+	if (probeonly)
+		rump_boot_sethowto(RUMP_AB_VERBOSE);
+	rump_init();
+	if (probeonly)
+		exit(0);
+
+	com = rump_sys_open(/dev/dtyU0, O_RDWR);
+	if (com == -1)
+		err(1, rump ucom open failed);
+
+	/*
+	 * Setup the com port.  You might need to tweak this.
+	 */
+	if (rump_sys_ioctl(com, TIOCGETA, tios) == -1)
+		err(1, rump get term);
+	tios.c_cflag = ~(CSIZE|PARENB);
+	

CVS commit: src/distrib/mipsco/instkernel

2009-12-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Dec 20 19:53:36 UTC 2009

Modified Files:
src/distrib/mipsco/instkernel: Makefile

Log Message:
create the ecoff copy of the install kernel so the prom can boot it.
from PR 39915.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/distrib/mipsco/instkernel/Makefile

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

Modified files:

Index: src/distrib/mipsco/instkernel/Makefile
diff -u src/distrib/mipsco/instkernel/Makefile:1.15 src/distrib/mipsco/instkernel/Makefile:1.16
--- src/distrib/mipsco/instkernel/Makefile:1.15	Wed Dec 11 15:52:47 2002
+++ src/distrib/mipsco/instkernel/Makefile	Sun Dec 20 19:53:36 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2002/12/11 15:52:47 lukem Exp $
+#	$NetBSD: Makefile,v 1.16 2009/12/20 19:53:36 mrg Exp $
 
 .include bsd.own.mk
 .include ${NETBSDSRCDIR}/distrib/common/Makefile.distrib
@@ -24,10 +24,8 @@
 MDSETTARGETS=		RAMDISK ${RAMDISK} netbsd-INSTALL
 MDSET_RELEASEDIR=	binary/kernel
 
-.if defined(ECOFF_KERNEL)
 MDSET_SUFFIXES.netbsd-INSTALL=	ecoff create-ecoff
 create-ecoff=			${ELF2ECOFF} ${.TARGET:R} ${.TARGET}
-.endif # ECOFF_KERNEL
 
 IMAGE_RELEASEDIR=	installation/diskimage
 



CVS commit: src/sys/kern

2009-12-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Dec 20 20:42:24 UTC 2009

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

Log Message:
remove dated and wrong comments about curlwp being NULL.
_kernel_{,un}lock() always assume it is valid now.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/kern/kern_lock.c

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

Modified files:

Index: src/sys/kern/kern_lock.c
diff -u src/sys/kern/kern_lock.c:1.149 src/sys/kern/kern_lock.c:1.150
--- src/sys/kern/kern_lock.c:1.149	Fri Jul 17 22:17:37 2009
+++ src/sys/kern/kern_lock.c	Sun Dec 20 20:42:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lock.c,v 1.149 2009/07/17 22:17:37 dyoung Exp $	*/
+/*	$NetBSD: kern_lock.c,v 1.150 2009/12/20 20:42:23 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_lock.c,v 1.149 2009/07/17 22:17:37 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_lock.c,v 1.150 2009/12/20 20:42:23 mrg Exp $);
 
 #include sys/param.h
 #include sys/proc.h
@@ -149,8 +149,7 @@
 }
 
 /*
- * Acquire 'nlocks' holds on the kernel lock.  If 'l' is non-null, the
- * acquisition is from process context.
+ * Acquire 'nlocks' holds on the kernel lock.
  */
 void
 _kernel_lock(int nlocks)
@@ -257,7 +256,7 @@
 
 /*
  * Release 'nlocks' holds on the kernel lock.  If 'nlocks' is zero, release
- * all holds.  If 'l' is non-null, the release is from process context.
+ * all holds.
  */
 void
 _kernel_unlock(int nlocks, int *countp)



CVS commit: src/sys/kern

2009-12-20 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Dec 20 23:00:59 UTC 2009

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

Log Message:
Add comment about locking.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/kern/sys_select.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/sys_select.c
diff -u src/sys/kern/sys_select.c:1.20 src/sys/kern/sys_select.c:1.21
--- src/sys/kern/sys_select.c:1.20	Sat Dec 12 17:47:05 2009
+++ src/sys/kern/sys_select.c	Sun Dec 20 23:00:59 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_select.c,v 1.20 2009/12/12 17:47:05 dsl Exp $	*/
+/*	$NetBSD: sys_select.c,v 1.21 2009/12/20 23:00:59 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -66,11 +66,25 @@
  */
 
 /*
- * System calls relating to files.
+ * System calls of synchronous I/O multiplexing subsystem.
+ *
+ * Locking
+ *
+ * Two locks are used: object-lock and selcpu_t::sc_lock.
+ *
+ * The object-lock might be a device driver or another subsystem, e.g.
+ * socket or pipe.  This lock is not exported, and thus invisible to this
+ * subsystem.  Mainly, synchronisation between selrecord() and selnotify()
+ * routines depends on this lock, as it will be described in the comments.
+ *
+ * Lock order
+ *
+ *	object-lock -
+ *		selcpu_t::sc_lock
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sys_select.c,v 1.20 2009/12/12 17:47:05 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: sys_select.c,v 1.21 2009/12/20 23:00:59 rmind Exp $);
 
 #include sys/param.h
 #include sys/systm.h



CVS commit: src/external/bsd/libelf/dist

2009-12-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec 20 23:23:46 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: _libelf.h elf_begin.c elf_data.c
elf_scn.c libelf.c libelf_ehdr.c libelf_phdr.c libelf_xlate.c

Log Message:
- _libelf_globals::libelf_arch and _libelf_globals::libelf_class are
  completely unused.  Remove them.
- _libelf_globals::libelf_byteorder is really all about the byte order of
  the host running libelf, so replace it with a _libelf_host_byteorder()
  internal function that computes the host byte order in a very portable
  way (doesn't rely on BSD-specific header files).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/_libelf.h \
src/external/bsd/libelf/dist/elf_scn.c \
src/external/bsd/libelf/dist/libelf_ehdr.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf_begin.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/elf_data.c \
src/external/bsd/libelf/dist/libelf_phdr.c \
src/external/bsd/libelf/dist/libelf_xlate.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libelf/dist/libelf.c

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

Modified files:

Index: src/external/bsd/libelf/dist/_libelf.h
diff -u src/external/bsd/libelf/dist/_libelf.h:1.3 src/external/bsd/libelf/dist/_libelf.h:1.4
--- src/external/bsd/libelf/dist/_libelf.h:1.3	Sat Dec 19 07:47:22 2009
+++ src/external/bsd/libelf/dist/_libelf.h	Sun Dec 20 23:23:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: _libelf.h,v 1.3 2009/12/19 07:47:22 thorpej Exp $	*/
+/*	$NetBSD: _libelf.h,v 1.4 2009/12/20 23:23:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -44,9 +44,6 @@
 #define LIBELF_MSG_SIZE	256
 
 struct _libelf_globals {
-	int		libelf_arch;
-	unsigned int	libelf_byteorder;
-	int		libelf_class;
 	int		libelf_error;
 	int		libelf_fillchar;
 	unsigned int	libelf_version;
@@ -161,6 +158,8 @@
  * Prototypes
  */
 
+unsigned int _libelf_host_byteorder(void);
+
 Elf_Data *_libelf_allocate_data(Elf_Scn *_s);
 Elf	*_libelf_allocate_elf(void);
 Elf_Scn	*_libelf_allocate_scn(Elf *_e, size_t _ndx);
Index: src/external/bsd/libelf/dist/elf_scn.c
diff -u src/external/bsd/libelf/dist/elf_scn.c:1.3 src/external/bsd/libelf/dist/elf_scn.c:1.4
--- src/external/bsd/libelf/dist/elf_scn.c:1.3	Sat Dec 19 07:44:27 2009
+++ src/external/bsd/libelf/dist/elf_scn.c	Sun Dec 20 23:23:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_scn.c,v 1.3 2009/12/19 07:44:27 thorpej Exp $	*/
+/*	$NetBSD: elf_scn.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/elf_scn.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: elf_scn.c,v 1.3 2009/12/19 07:44:27 thorpej Exp $);
+__RCSID($NetBSD: elf_scn.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $);
 
 #include assert.h
 #include errno.h
@@ -85,7 +85,7 @@
 
 	xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec);
 
-	swapbytes = e-e_byteorder != LIBELF_PRIVATE(byteorder);
+	swapbytes = e-e_byteorder != _libelf_host_byteorder();
 	if (shoff  SSIZE_MAX) {
 		LIBELF_SET_ERROR(HEADER, 0);
 		return (0);
Index: src/external/bsd/libelf/dist/libelf_ehdr.c
diff -u src/external/bsd/libelf/dist/libelf_ehdr.c:1.3 src/external/bsd/libelf/dist/libelf_ehdr.c:1.4
--- src/external/bsd/libelf/dist/libelf_ehdr.c:1.3	Sat Dec 19 09:00:56 2009
+++ src/external/bsd/libelf/dist/libelf_ehdr.c	Sun Dec 20 23:23:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_ehdr.c,v 1.3 2009/12/19 09:00:56 thorpej Exp $	*/
+/*	$NetBSD: libelf_ehdr.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_ehdr.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_ehdr.c,v 1.3 2009/12/19 09:00:56 thorpej Exp $);
+__RCSID($NetBSD: libelf_ehdr.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $);
 
 #include assert.h
 #include gelf.h
@@ -73,7 +73,7 @@
 
 	xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec);
 	(*xlator)((void *) scn-s_shdr, e-e_rawfile + (ssize_t)shoff,
-	(size_t) 1, e-e_byteorder != LIBELF_PRIVATE(byteorder));
+	(size_t) 1, e-e_byteorder != _libelf_host_byteorder());
 
 #define	GET_SHDR_MEMBER(M) ((ec == ELFCLASS32) ? scn-s_shdr.s_shdr32.M : \
 		scn-s_shdr.s_shdr64.M)
@@ -182,7 +182,7 @@
 
 	xlator = _libelf_get_translator(ELF_T_EHDR, ELF_TOMEMORY, ec);
 	(*xlator)(ehdr, e-e_rawfile, (size_t) 1,
-	e-e_byteorder != LIBELF_PRIVATE(byteorder));
+	e-e_byteorder != _libelf_host_byteorder());
 
 	/*
 	 * If extended numbering is being used, read the correct

Index: src/external/bsd/libelf/dist/elf_begin.c
diff -u src/external/bsd/libelf/dist/elf_begin.c:1.2 src/external/bsd/libelf/dist/elf_begin.c:1.3
--- src/external/bsd/libelf/dist/elf_begin.c:1.2	Sat Dec 19 06:22:25 2009
+++ 

CVS commit: src/usr.sbin/nfsd

2009-12-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec 21 05:06:55 UTC 2009

Modified Files:
src/usr.sbin/nfsd: nfsd.c

Log Message:
PR/42486: Ed Ravin nfsd sometimes exits prematurely during port-scan fix
from freebsd bin 61084 applied (preserving errno properly). The accept
code should be merged.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/nfsd/nfsd.c

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

Modified files:

Index: src/usr.sbin/nfsd/nfsd.c
diff -u src/usr.sbin/nfsd/nfsd.c:1.56 src/usr.sbin/nfsd/nfsd.c:1.57
--- src/usr.sbin/nfsd/nfsd.c:1.56	Fri Nov 21 02:48:35 2008
+++ src/usr.sbin/nfsd/nfsd.c	Mon Dec 21 00:06:55 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsd.c,v 1.56 2008/11/21 07:48:35 pooka Exp $	*/
+/*	$NetBSD: nfsd.c,v 1.57 2009/12/21 05:06:55 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = @(#)nfsd.c	8.9 (Berkeley) 3/29/95;
 #else
-__RCSID($NetBSD: nfsd.c,v 1.56 2008/11/21 07:48:35 pooka Exp $);
+__RCSID($NetBSD: nfsd.c,v 1.57 2009/12/21 05:06:55 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -147,7 +147,7 @@
 	struct sockaddr_in6 inet6peer;
 	struct pollfd set[4];
 	socklen_t len;
-	int ch, cltpflag, connect_type_cnt, i, maxsock, msgsock;
+	int ch, cltpflag, connect_type_cnt, i, maxsock, msgsock, serrno;
 	int nfsdcnt, on = 1, reregister, sock, tcpflag, tcpsock;
 	int tcp6sock, ip6flag;
 	int tp4cnt, tp4flag, tpipcnt, tpipflag, udpflag, ecode, s;
@@ -486,7 +486,10 @@
 			len = sizeof(inetpeer);
 			if ((msgsock = accept(tcpsock,
 			(struct sockaddr *)inetpeer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			memset(inetpeer.sin_zero, 0, sizeof(inetpeer.sin_zero));
@@ -505,7 +508,10 @@
 			len = sizeof(inet6peer);
 			if ((msgsock = accept(tcp6sock,
 			(struct sockaddr *)inet6peer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			if (setsockopt(msgsock, SOL_SOCKET,
@@ -524,7 +530,10 @@
 			len = sizeof(isopeer);
 			if ((msgsock = accept(tp4sock,
 			(struct sockaddr *)isopeer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			if (setsockopt(msgsock, SOL_SOCKET,
@@ -542,7 +551,10 @@
 			len = sizeof(inetpeer);
 			if ((msgsock = accept(tpipsock,
 			(struct sockaddr *)inetpeer, len))  0) {
+serrno = errno;
 syslog(LOG_ERR, accept failed: %m);
+if (serrno == EINTR || serrno == ECONNABORTED)
+	continue;
 exit(1);
 			}
 			if (setsockopt(msgsock, SOL_SOCKET,