Ioctl TCSBRK in a ldisc driver

Oliver Graute oliver.graute at gmail.com
Mon May 14 03:05:27 EDT 2018


Hello list,

I try to handle some ioctl by my ldisc driver. Especially ioctl TCSBRK.
After wondering why I didn't receive TCSBRK ioctl I stumbled accros this
comments:

include/linux/tty_ldisc.h

* int  (*ioctl)(struct tty_struct * tty, struct file * file,
*               unsigned int cmd, unsigned long arg);
*
*      This function is called when the user requests an ioctl which
*      is not handled by the tty layer or the low-level tty driver.
*      It is intended for ioctls which affect line discpline
*      operation.  Note that the search order for ioctls is (1) tty
*      layer, (2) tty low-level driver, (3) line discpline.  So a
*      low-level driver can "grab" an ioctl request before the line
*      discpline has a chance to see it.

and the corresponding tty_ioctl() implementation in tty_io.c.

Am I correct that the TCSBRK is grabbed here before receiving it in any
ldisc driver code?

Is there a way to change the order without major changes in the tty_io.c
code?

I want to intercept the TCSBRK because my hardware needs some handling
here and for userspace applications it should be transparent.

Best regards,

Oliver



More information about the Kernelnewbies mailing list