How can I write to TTY from a kernel module?

前端 未结 1 1241
渐次进展
渐次进展 2021-01-13 00:32

First post to SO, so I\'ll try to make the question right.

I\'m making a simple Linux kernel module with the goal of echoing data back to the TTY shell from where th

1条回答
  •  有刺的猬
    2021-01-13 01:28

    use tty = get_current_tty(); instead of tty = current->signal->tty;

    that's it

    you need to lock the tty before accessing it and get_current_tty does it internally

    NOTE: get_current_tty is under EXPORT_SYMBOL_GPL, hence your module or code

    0 讨论(0)
提交回复
热议问题