From owner-p4-projects@FreeBSD.ORG Fri Aug 29 12:00:32 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CBE3810656F9; Fri, 29 Aug 2008 12:00:32 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F96510658B4 for ; Fri, 29 Aug 2008 12:00:32 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7D08F8FC1C for ; Fri, 29 Aug 2008 12:00:32 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7TC0W0a008890 for ; Fri, 29 Aug 2008 12:00:32 GMT (envelope-from ed@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7TC0Wii008888 for perforce@freebsd.org; Fri, 29 Aug 2008 12:00:32 GMT (envelope-from ed@FreeBSD.org) Date: Fri, 29 Aug 2008 12:00:32 GMT Message-Id: <200808291200.m7TC0Wii008888@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ed@FreeBSD.org using -f From: Ed Schouten To: Perforce Change Reviews Cc: Subject: PERFORCE change 148790 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Aug 2008 12:00:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=148790 Change 148790 by ed@ed_dull on 2008/08/29 12:00:08 Change the hooks approach we use in ttydisc_getc_uio(). It's much smarter to call ttydisc_getc() here. We'll likely get more hooks in the future to get Netgraph working again, so if we just make it call ttydisc_getc(), we only need to add those hooks at a single location. Affected files ... .. //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#16 edit Differences ... ==== //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#16 (text+ko) ==== @@ -1121,21 +1121,17 @@ /* * When a TTY hook is attached, we cannot perform unbuffered - * copying to userspace. We just simulate it by copying data to - * a shadow buffer. + * copying to userspace. Just call ttydisc_getc() and + * temporarily store data in a shadow buffer. */ if (ttyhook_hashook(tp, getc_capture)) { while (uio->uio_resid > 0) { /* Read to shadow buffer. */ - len = ttyoutq_read(&tp->t_outq, buf, + len = ttydisc_getc(tp, buf, MIN(uio->uio_resid, sizeof buf)); if (len == 0) break; - /* Process with hook. Handle sudden removal. */ - if (ttyhook_hashook(tp, getc_capture)) - tp->t_hook->th_getc_capture(tp, buf, len); - /* Copy to userspace. */ tty_unlock(tp); error = uiomove(buf, len, uio); @@ -1146,11 +1142,11 @@ } } else { error = ttyoutq_read_uio(&tp->t_outq, tp, uio); + + ttydisc_wakeup_watermark(tp); + atomic_add_long(&tty_nout, obytes - uio->uio_resid); } - ttydisc_wakeup_watermark(tp); - atomic_add_long(&tty_nout, obytes - uio->uio_resid); - return (error); }