[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tty layer concepts and documentation (snp device for linux)



Hi:

Lets get organized ;) :

My objective:
=============
I'm planing to port FreeBSD's snp device to Linux 
(http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/snp/snp.c). It snoops 
a tty (http://www.svbug.com/cgi-bin/man.cgi?comd=8+watch)

My Questions:
=============
1. The only information I was able to find regarding tty layer is:

http://www.linuxdevices.com/articles/AT3711365653.html

  It only explains how to code a tty driver, but it says nothing about 
tty layer design and structure.

    Is there any further information aviable?

2. After reading FreeBSD snp driver sources (see link above) I realised 
It works by replacing target tty-device line discipline with its own one.

    Ive been reading through "drivers/char/tty_io.c" and 
"drivers/char/n_tty.c" but I just cant understand how the tty driver and 
line disciplines are supposed to work together. Of course, I'm missing 
the concept of line discipline.

    Can someone please how does a line discipline work?
    Wouldnt that approach (replacing the line discipline) work only with 
certain tty devices?

3. Even If I manage to code a line discipline doing what I want.....

    The max number of line disciplines (NR_LDISCS (tty.h)) and the 
number assigned to each one (N_TTY ... (termios.h)) is hardcoded.

    How could I register the discipline without having to patch the kernel?
    Is there any known trick for doing that?


Thanks in Advance:

Alfonso Acosta




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/