I would like to write to a tty from kernel space and only have access to the major and minor device numbers for that particular tty.
I am entering the kernel via a system call that works fine, and is capable of writing to the current tty through the usage of
my_tty = current->signal->tty;
(my_tty->driver->ops->write) (my_tty,"Text message", SIZE);
The problem is occasionally I wish to write to a different tty and have (as far as I know) only access to the tty defined by current->signal->tty.
What I do have are the major and minor devices numbers for the tty I wish to address, which I pass as parameters to the syscall.
Can anyone provide a suggestion on what is available as a solution that I could research?
I am not finding anything other than the solution described above using the current tty of the calling program. Perhaps I am using incorrect search terms.
I do not have example code yet, since I have not added anything to my existing syscall. I would be happy to once I have an idea of what to work with. Maybe there are already functions to achieve this? I am simply hoping for a pointer on what to use or where to look.
You don't do this by passing major/minor numbers to your syscall.
Instead, have the userspace side open the tty it wants then pass the resulting file descriptor to your syscall. You then use the sequence { fget(); kernel_write(); fput(); }
to write to the supplied file descriptor.