From owner-freebsd-bugs@FreeBSD.ORG Sun May 13 17:20:03 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7C02916A400 for ; Sun, 13 May 2007 17:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 58A6513C4C4 for ; Sun, 13 May 2007 17:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l4DHK3O1013661 for ; Sun, 13 May 2007 17:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l4DHK37r013660; Sun, 13 May 2007 17:20:03 GMT (envelope-from gnats) Resent-Date: Sun, 13 May 2007 17:20:03 GMT Resent-Message-Id: <200705131720.l4DHK37r013660@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dan Lukes Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0152916A402 for ; Sun, 13 May 2007 17:12:31 +0000 (UTC) (envelope-from dan@kulesh.obluda.cz) Received: from smtp1.kolej.mff.cuni.cz (smtp1.kolej.mff.cuni.cz [195.113.24.4]) by mx1.freebsd.org (Postfix) with ESMTP id 9DB1B13C43E for ; Sun, 13 May 2007 17:12:30 +0000 (UTC) (envelope-from dan@kulesh.obluda.cz) Received: from kulesh.obluda.cz (openvpn.ms.mff.cuni.cz [195.113.20.87]) by smtp1.kolej.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l4DHCQuI059234 for ; Sun, 13 May 2007 19:12:28 +0200 (CEST) (envelope-from dan@kulesh.obluda.cz) Received: from kulesh.obluda.cz (localhost. [127.0.0.1]) by kulesh.obluda.cz (8.13.8/8.13.8) with ESMTP id l4DHCQaQ060155 for ; Sun, 13 May 2007 19:12:26 +0200 (CEST) (envelope-from dan@kulesh.obluda.cz) Received: (from root@localhost) by kulesh.obluda.cz (8.14.1/8.13.8/Submit) id l4DHCPmg060154; Sun, 13 May 2007 19:12:25 +0200 (CEST) (envelope-from dan) Message-Id: <200705131712.l4DHCPmg060154@kulesh.obluda.cz> Date: Sun, 13 May 2007 19:12:25 +0200 (CEST) From: Dan Lukes To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/112634: tty's driver method t_ioctl() never called X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Dan Lukes List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 May 2007 17:20:03 -0000 >Number: 112634 >Category: kern >Synopsis: tty's driver method t_ioctl() never called >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 13 17:20:02 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Dan Lukes >Release: FreeBSD 6.2-STABLE i386 >Organization: Obludarium >Environment: System: FreeBSD kulesh.obluda.cz 6.2-STABLE FreeBSD 6.2-STABLE #0: Wed Apr 11 12:30:28 CEST 2007 dan@kulesh.obluda.cz:/usr/obj/usr/src/sys/KULESH i386 src/sys/kern/tty.c,v 1.250.2.4 2006/12/21 16:24:22 >Description: On Wed Jun 30 21:38:08 2004 UTC (2 years, 10 months ago) phk commited into tty.h new optional tty's driver supplied method - t_ioctl() with the comment: ==== Add t_ioctl (more about this later). ==== Unfortunately, the "later" still not arrived. As far as I know, the t_ioctl() is not called by current code. Even I run the grep for entire sys tree, the t_ioctl() seems to be really ignored. To be more interesting, there are two system drivers implementing this driver method - digi and ucom (ucom doesn't use callback for self it pass the call to underlying drivers where only umodem tried to use it). The ioctls implemented in digi and umodem seems to be umimportant and other drivers doesn't implement the method at all, so nobody complained until now. >How-To-Repeat: Wrote own tty driver with t_ioctl function. Use a printf when called. You will never see the output. >Fix: 1. Call t_ioctl (unless not set) in apropriate place (tty.c diff) The driver routine need to return ENOIOCTL for IOCTL's not processed within it (the same behavior as ttyld_ioctl() and ttioctl()). 2. as side efect of [1] the umodem.c, ucom.c and digi.c ioctl routines need to be patched (those routines has been never called until [1] fix) - - routines need to return ENOIOCTL for unhandled IOCTLs instead of ENOTTY (umodem.c, ucom.c & digi.c diff). --- sys/kern/tty.c.ORIG Fri Jan 12 03:54:46 2007 +++ sys/kern/tty.c Sun May 13 17:01:47 2007 @@ -3255,7 +3255,9 @@ dt->c_ospeed = tp->t_ospeed; } - error = ttyld_ioctl(tp, cmd, data, flag, td); + error=(tp->t_ioctl != NULL)?tp->t_ioctl(tp, cmd, data, flag, td):ENOIOCTL; + if (error == ENOIOCTL) + error = ttyld_ioctl(tp, cmd, data, flag, td); if (error == ENOIOCTL) error = ttioctl(tp, cmd, data, flag); ttyldoptim(tp); --- sys/dev/usb/ucom.c.ORIG Tue Apr 12 02:26:40 2005 +++ sys/dev/usb/ucom.c Sun May 13 18:11:44 2007 @@ -336,7 +336,7 @@ DPRINTF(("ucomioctl: cmd = 0x%08lx\n", cmd)); - error = ENOTTY; + error = ENOIOCTL; if (sc->sc_callback->ucom_ioctl != NULL) error = sc->sc_callback->ucom_ioctl(sc->sc_parent, sc->sc_portno, --- sys/dev/usb/umodem.c.ORIG Sun Jul 16 19:47:02 2006 +++ sys/dev/usb/umodem.c Sun May 13 17:56:41 2007 @@ -650,12 +650,13 @@ case USB_SET_CM_OVER_DATA: if (*(int *)data != sc->sc_cm_over_data) { /* XXX change it */ + error = EOPNOTSUPP; /* until implemented */ } break; default: DPRINTF(("umodemioctl: unknown\n")); - error = ENOTTY; + error = ENOIOCTL; break; } --- sys/dev/digi/digi.c.ORIG Fri Feb 23 18:17:46 2007 +++ sys/dev/digi/digi.c Sun May 13 18:00:01 2007 @@ -951,7 +951,7 @@ port->send_ring = (u_char)*(int *)data; break; default: - return (ENOTTY); + return (ENOIOCTL); } return (0); } >Release-Note: >Audit-Trail: >Unformatted: