tty 子系统由那些文件组成?
/*******************************************************************************/
include/linux/tty*.h
tty_flip.h
tty.h
tty_ldisc.h
tty_driver.h
/*******************************************************************************/
tty_flip.h: just function statement not including the structure definition;
/*******************************************************************************/
struct tty_ldisc {
struct tty_ldisc_ops *ops;
atomic_t users;
};
struct tty_ldisc_ops {
int magic;
char *name;
int num;
int flags;
/*
* The following routines are called from above.
*/
int (*open)(struct tty_struct *);
---
}
/*******************************************************************************/
struct tty_driver;
struct tty_operations
/*****************/
struct list_head tty_drivers;
/*******************************************************************************/
struct tty_buffer;
struct tty_bufhead;
struct tty_file_private;
struct tty_port;
struct tty_port_operations;
struct tty_struct;
/*****************/
struct class *tty_class;
struct mutex tty_mutex;
spinlock_t tty_files_lock;
const struct file_operations tty_ldiscs_proc_fops;
struct tty_ldisc_ops tty_ldisc_N_TTY;
/*******************************************************************************/
obj-y += tty_io.o n_tty.o tty_ioctl.o tty_ldisc.o \
tty_buffer.o tty_port.o tty_mutex.o
/*
* 'tty_io.c' gives an orthogonal feeling to tty's, be they consoles
* or rs-channels. It also implements echoing, cooked mode etc.
*
* Kill-line thanks to John T Kohl, who also corrected VMIN = VTIME = 0.
*
* Modified by Theodore Ts'o, 9/14/92, to dynamically allocate the
* tty_struct and tty_queue structures. Previously there was an array
* of 256 tty_struct's which was statically allocated, and the
* tty_queue structures were allocated at boot time. Both are now
* dynamically allocated only when the tty is open.
*
* Also restructured routines so that there is more of a separation
* between the high-level tty routines (tty_io.c and tty_ioctl.c) and
* the low-level tty routines (serial.c, pty.c, console.c). This
* makes for cleaner and more compact code. -TYT, 9/17/92
*
* Modified by Fred N. van Kempen, 01/29/93, to add line disciplines
* which can be dynamically activated and de-activated by the line
* discipline handling modules (like SLIP).
*
* NOTE: pay no attention to the line discipline code (yet); its
* interface is still subject to change in this version...
* -- TYT, 1/31/92
*
* Added functionality to the OPOST tty handling. No delays, but all
* other bits should be there.
* -- Nick Holloway <[email protected]>, 27th May 1993.
*
* Rewrote canonical mode and added more termios flags.
* -- [email protected] (J. Cowley), 13Jan94
*
* Reorganized FASYNC support so mouse code can share it.
* -- [email protected], 9Sep95
*
* New TIOCLINUX variants added.
* -- [email protected], 19-Nov-95
*
* Restrict vt switching via ioctl()
* -- [email protected], 5-Dec-95
*
* Move console and virtual terminal code to more appropriate files,
* implement CONFIG_VT and generalize console device interface.
* -- Marko Kohtala <[email protected]>, March 97
*
* Rewrote tty_init_dev and tty_release_dev to eliminate races.
* -- Bill Hawes <[email protected]>, June 97
*
* Added devfs support.
* -- C. Scott Ananian <[email protected]>, 13-Jan-1998
*
* Added support for a Unix98-style ptmx device.
* -- C. Scott Ananian <[email protected]>, 14-Jan-1998
*
* Reduced memory usage for older ARM systems
* -- Russell King <[email protected]>
*
* Move do_SAK() into process context. Less stack use in devfs functions.
* alloc_tty_struct() always uses kmalloc()
* -- Andrew Morton <[email protected]> 17Mar01
*/
/*
* n_tty.c --- implements the N_TTY line discipline.
*
* This code used to be in tty_io.c, but things are getting hairy
* enough that it made sense to split things off. (The N_TTY
* processing has changed so much that it's hardly recognizable,
* anyway...)
*
* Note that the open routine for N_TTY is guaranteed never to return
* an error. This is because Linux will fall back to setting a line
* to N_TTY if it can not switch to any other line discipline.
*
* Written by Theodore Ts'o, Copyright 1994.
*
* This file also contains code originally written by Linus Torvalds,
* Copyright 1991, 1992, 1993, and by Julian Cowley, Copyright 1994.
*
* This file may be redistributed under the terms of the GNU General Public
* License.
*
* Reduced memory usage for older ARM systems - Russell King.
*
* 2000/01/20 Fixed SMP locking on put_tty_queue using bits of
* the patch by Andrew J. Kroll <[email protected]>
* who actually finally proved there really was a race.
*
* 2002/03/18 Implemented n_tty_wakeup to send SIGIO POLL_OUTs to
* waiting writing processes-Sapan Bhatia <[email protected]>.
* Also fixed a bug in BLOCKING mode where n_tty_write returns
* EAGAIN
*/
/*
* Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
*
* Modified by Fred N. van Kempen, 01/29/93, to add line disciplines
* which can be dynamically activated and de-activated by the line
* discipline handling modules (like SLIP).
*/
line dis
/*
* Tty buffer allocation management
*/
* Tty port functions
/*
* The 'big tty mutex'
*
* This mutex is taken and released by tty_lock() and tty_unlock(),
* replacing the older big kernel lock.
* It can no longer be taken recursively, and does not get
* released implicitly while sleeping.
*
* Don't use in new code.
*/