Date: Sun, 13 May 2007 19:12:25 +0200 (CEST) From: Dan Lukes <dan@obluda.cz> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/112634: tty's driver method t_ioctl() never called Message-ID: <200705131712.l4DHCPmg060154@kulesh.obluda.cz> Resent-Message-ID: <200705131720.l4DHK37r013660@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705131712.l4DHCPmg060154>