From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 08:07:02 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA809106568B; Sat, 1 Nov 2008 08:07:02 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8C238FC17; Sat, 1 Nov 2008 08:07:02 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mA1872Ic002942; Sat, 1 Nov 2008 08:07:02 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mA18725C002941; Sat, 1 Nov 2008 08:07:02 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200811010807.mA18725C002941@svn.freebsd.org> From: Ed Schouten Date: Sat, 1 Nov 2008 08:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184520 - head/sys/dev/adb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2008 08:07:03 -0000 Author: ed Date: Sat Nov 1 08:07:02 2008 New Revision: 184520 URL: http://svn.freebsd.org/changeset/base/184520 Log: Allow a read() on /dev/ams[0-9] to be interrupted. Right now ams_read() uses cv_wait() to wait for new data to arrive on the mouse device. This means that when you run `cat /dev/ams0', it cannot be interrupted directly. After you press ^C, you first need to move the mouse before cat will quit. Make this function use cv_wait_sig(), which allows it to be interrupted directly. Reviewed by: nwhitehorn Modified: head/sys/dev/adb/adb_mouse.c Modified: head/sys/dev/adb/adb_mouse.c ============================================================================== --- head/sys/dev/adb/adb_mouse.c Sat Nov 1 06:57:59 2008 (r184519) +++ head/sys/dev/adb/adb_mouse.c Sat Nov 1 08:07:02 2008 (r184520) @@ -382,6 +382,7 @@ ams_read(struct cdev *dev, struct uio *u struct adb_mouse_softc *sc; size_t len; int8_t outpacket[8]; + int error; sc = CDEV_GET_SOFTC(dev); if (sc == NULL) @@ -403,7 +404,11 @@ ams_read(struct cdev *dev, struct uio *u /* Otherwise, block on new data */ - cv_wait(&sc->sc_cv,&sc->sc_mtx); + error = cv_wait_sig(&sc->sc_cv, &sc->sc_mtx); + if (error) { + mtx_unlock(&sc->sc_mtx); + return (error); + } } sc->packet[0] = 1 << 7;