From owner-freebsd-arch@FreeBSD.ORG Tue Apr 8 16:09:20 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E87E91065675 for ; Tue, 8 Apr 2008 16:09:20 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (ns2.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id B6B608FC14 for ; Tue, 8 Apr 2008 16:09:20 +0000 (UTC) (envelope-from jhein@timing.com) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id m38FUUil063127; Tue, 8 Apr 2008 09:30:30 -0600 (MDT) (envelope-from jhein@timing.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.14.2/8.14.2) with ESMTP id m38FUU0j025905; Tue, 8 Apr 2008 09:30:30 -0600 (MDT) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.2/8.14.2/Submit) id m38FUU8D025902; Tue, 8 Apr 2008 09:30:30 -0600 (MDT) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18427.36758.266944.74378@gromit.timing.com> Date: Tue, 8 Apr 2008 09:30:30 -0600 From: John E Hein To: arch@freebsd.org X-Mailer: VM 7.19 under Emacs 22.1.1 X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on Daffy.timing.com X-Virus-Status: Clean Cc: Subject: tt_ioctl X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Apr 2008 16:09:21 -0000 Back in 2005-10, phk added the tt_{open,ioctl,etc.} inline calls in sys/tty.h allowing drivers that hook into the tty layer a way to override or supplement the basic tty functions with their own flavoring. They were also connected up in kern/tty.c - well most of them. tt_ioctl remains unused. What about the following: Index: kern/tty.c =================================================================== RCS file: /base/FreeBSD-CVS/src/sys/kern/tty.c,v retrieving revision 1.275 diff -u -p -r1.275 tty.c --- kern/tty.c 19 Mar 2008 06:19:00 -0000 1.275 +++ kern/tty.c 8 Apr 2008 05:37:22 -0000 @@ -3297,7 +3297,9 @@ ttyioctl(struct cdev *dev, u_long cmd, c dt->c_ospeed = tp->t_ospeed; } - error = ttyld_ioctl(tp, cmd, data, flag, td); + error = tt_ioctl(tp, cmd, data, flag, td); + if (error == ENOIOCTL) + error = ttyld_ioctl(tp, cmd, data, flag); if (error == ENOIOCTL) error = ttioctl(tp, cmd, data, flag); ttyldoptim(tp); Index: sys/tty.h =================================================================== RCS file: /base/FreeBSD-CVS/src/sys/sys/tty.h,v retrieving revision 1.102 diff -u -p -r1.102 tty.h --- sys/tty.h 16 Dec 2007 06:12:53 -0000 1.102 +++ sys/tty.h 8 Apr 2008 05:30:04 -0000 @@ -442,6 +442,8 @@ tt_ioctl(struct tty *t, u_long cmd, void int fflag, struct thread *td) { + if (t->t_ioctl == NULL) + return (ENOIOCTL); return (t->t_ioctl(t, cmd, data, fflag, td)); } One thing I'm not sure about is whether ttyld_ioctl should be called regardless of whether a driver's ioctl method is used. I opted for 'not' since it seems bogus for two different ioctl layers to handle the same cmd.