Linux Kernel
3.7.1
|
#include <linux/fs.h>
#include <linux/major.h>
#include <linux/termios.h>
#include <linux/workqueue.h>
#include <linux/tty_driver.h>
#include <linux/tty_ldisc.h>
#include <linux/mutex.h>
#include <linux/tty_flags.h>
#include <uapi/linux/tty.h>
Go to the source code of this file.
Data Structures | |
struct | tty_buffer |
struct | tty_bufhead |
struct | tty_port_operations |
struct | tty_port |
struct | tty_struct |
struct | tty_file_private |
Macros | |
#define | NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ |
#define | NR_UNIX98_PTY_RESERVE 1024 /* Default reserve for main devpts */ |
#define | NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ |
#define | __DISABLED_CHAR '\0' |
#define | TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) |
#define | TTY_NORMAL 0 |
#define | TTY_BREAK 1 |
#define | TTY_FRAME 2 |
#define | TTY_PARITY 3 |
#define | TTY_OVERRUN 4 |
#define | INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR]) |
#define | QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT]) |
#define | ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE]) |
#define | KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL]) |
#define | EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF]) |
#define | TIME_CHAR(tty) ((tty)->termios.c_cc[VTIME]) |
#define | MIN_CHAR(tty) ((tty)->termios.c_cc[VMIN]) |
#define | SWTC_CHAR(tty) ((tty)->termios.c_cc[VSWTC]) |
#define | START_CHAR(tty) ((tty)->termios.c_cc[VSTART]) |
#define | STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP]) |
#define | SUSP_CHAR(tty) ((tty)->termios.c_cc[VSUSP]) |
#define | EOL_CHAR(tty) ((tty)->termios.c_cc[VEOL]) |
#define | REPRINT_CHAR(tty) ((tty)->termios.c_cc[VREPRINT]) |
#define | DISCARD_CHAR(tty) ((tty)->termios.c_cc[VDISCARD]) |
#define | WERASE_CHAR(tty) ((tty)->termios.c_cc[VWERASE]) |
#define | LNEXT_CHAR(tty) ((tty)->termios.c_cc[VLNEXT]) |
#define | EOL2_CHAR(tty) ((tty)->termios.c_cc[VEOL2]) |
#define | _I_FLAG(tty, f) ((tty)->termios.c_iflag & (f)) |
#define | _O_FLAG(tty, f) ((tty)->termios.c_oflag & (f)) |
#define | _C_FLAG(tty, f) ((tty)->termios.c_cflag & (f)) |
#define | _L_FLAG(tty, f) ((tty)->termios.c_lflag & (f)) |
#define | I_IGNBRK(tty) _I_FLAG((tty), IGNBRK) |
#define | I_BRKINT(tty) _I_FLAG((tty), BRKINT) |
#define | I_IGNPAR(tty) _I_FLAG((tty), IGNPAR) |
#define | I_PARMRK(tty) _I_FLAG((tty), PARMRK) |
#define | I_INPCK(tty) _I_FLAG((tty), INPCK) |
#define | I_ISTRIP(tty) _I_FLAG((tty), ISTRIP) |
#define | I_INLCR(tty) _I_FLAG((tty), INLCR) |
#define | I_IGNCR(tty) _I_FLAG((tty), IGNCR) |
#define | I_ICRNL(tty) _I_FLAG((tty), ICRNL) |
#define | I_IUCLC(tty) _I_FLAG((tty), IUCLC) |
#define | I_IXON(tty) _I_FLAG((tty), IXON) |
#define | I_IXANY(tty) _I_FLAG((tty), IXANY) |
#define | I_IXOFF(tty) _I_FLAG((tty), IXOFF) |
#define | I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL) |
#define | I_IUTF8(tty) _I_FLAG((tty), IUTF8) |
#define | O_OPOST(tty) _O_FLAG((tty), OPOST) |
#define | O_OLCUC(tty) _O_FLAG((tty), OLCUC) |
#define | O_ONLCR(tty) _O_FLAG((tty), ONLCR) |
#define | O_OCRNL(tty) _O_FLAG((tty), OCRNL) |
#define | O_ONOCR(tty) _O_FLAG((tty), ONOCR) |
#define | O_ONLRET(tty) _O_FLAG((tty), ONLRET) |
#define | O_OFILL(tty) _O_FLAG((tty), OFILL) |
#define | O_OFDEL(tty) _O_FLAG((tty), OFDEL) |
#define | O_NLDLY(tty) _O_FLAG((tty), NLDLY) |
#define | O_CRDLY(tty) _O_FLAG((tty), CRDLY) |
#define | O_TABDLY(tty) _O_FLAG((tty), TABDLY) |
#define | O_BSDLY(tty) _O_FLAG((tty), BSDLY) |
#define | O_VTDLY(tty) _O_FLAG((tty), VTDLY) |
#define | O_FFDLY(tty) _O_FLAG((tty), FFDLY) |
#define | C_BAUD(tty) _C_FLAG((tty), CBAUD) |
#define | C_CSIZE(tty) _C_FLAG((tty), CSIZE) |
#define | C_CSTOPB(tty) _C_FLAG((tty), CSTOPB) |
#define | C_CREAD(tty) _C_FLAG((tty), CREAD) |
#define | C_PARENB(tty) _C_FLAG((tty), PARENB) |
#define | C_PARODD(tty) _C_FLAG((tty), PARODD) |
#define | C_HUPCL(tty) _C_FLAG((tty), HUPCL) |
#define | C_CLOCAL(tty) _C_FLAG((tty), CLOCAL) |
#define | C_CIBAUD(tty) _C_FLAG((tty), CIBAUD) |
#define | C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS) |
#define | L_ISIG(tty) _L_FLAG((tty), ISIG) |
#define | L_ICANON(tty) _L_FLAG((tty), ICANON) |
#define | L_XCASE(tty) _L_FLAG((tty), XCASE) |
#define | L_ECHO(tty) _L_FLAG((tty), ECHO) |
#define | L_ECHOE(tty) _L_FLAG((tty), ECHOE) |
#define | L_ECHOK(tty) _L_FLAG((tty), ECHOK) |
#define | L_ECHONL(tty) _L_FLAG((tty), ECHONL) |
#define | L_NOFLSH(tty) _L_FLAG((tty), NOFLSH) |
#define | L_TOSTOP(tty) _L_FLAG((tty), TOSTOP) |
#define | L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL) |
#define | L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT) |
#define | L_ECHOKE(tty) _L_FLAG((tty), ECHOKE) |
#define | L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) |
#define | L_PENDIN(tty) _L_FLAG((tty), PENDIN) |
#define | L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) |
#define | L_EXTPROC(tty) _L_FLAG((tty), EXTPROC) |
#define | N_TTY_BUF_SIZE 4096 |
#define | TTY_MAGIC 0x5401 |
#define | TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ |
#define | TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */ |
#define | TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ |
#define | TTY_EXCLUSIVE 3 /* Exclusive open mode */ |
#define | TTY_DEBUG 4 /* Debugging */ |
#define | TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ |
#define | TTY_PUSH 6 /* n_tty private */ |
#define | TTY_CLOSING 7 /* ->close() in progress */ |
#define | TTY_LDISC 9 /* Line discipline attached */ |
#define | TTY_LDISC_CHANGING 10 /* Line discipline changing */ |
#define | TTY_LDISC_OPEN 11 /* Line discipline is open */ |
#define | TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ |
#define | TTY_HW_COOK_IN 15 /* Hardware can do input cooking */ |
#define | TTY_PTY_LOCK 16 /* pty private */ |
#define | TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ |
#define | TTY_HUPPED 18 /* Post driver->hangup() */ |
#define | TTY_FLUSHING 19 /* Flushing to ldisc in progress */ |
#define | TTY_FLUSHPENDING 20 /* Queued buffer flush pending */ |
#define | TTY_HUPPING 21 /* ->hangup() in progress */ |
#define | TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) |
#define | tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) |
#define | wait_event_interruptible_tty(tty, wq, condition) |
#define | __wait_event_interruptible_tty(tty, wq, condition, ret) |
Variables | |
struct ktermios | tty_std_termios |
struct class * | tty_class |
struct file_operations | tty_ldiscs_proc_fops |
struct mutex | tty_mutex |
spinlock_t | tty_files_lock |
struct tty_ldisc_ops | tty_ldisc_N_TTY |
#define __wait_event_interruptible_tty | ( | tty, | |
wq, | |||
condition, | |||
ret | |||
) |
#define _C_FLAG | ( | tty, | |
f | |||
) | ((tty)->termios.c_cflag & (f)) |
#define _I_FLAG | ( | tty, | |
f | |||
) | ((tty)->termios.c_iflag & (f)) |
#define _L_FLAG | ( | tty, | |
f | |||
) | ((tty)->termios.c_lflag & (f)) |
#define _O_FLAG | ( | tty, | |
f | |||
) | ((tty)->termios.c_oflag & (f)) |
#define DISCARD_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VDISCARD]) |
#define EOF_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VEOF]) |
#define EOL2_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VEOL2]) |
#define EOL_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VEOL]) |
#define ERASE_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VERASE]) |
#define INTR_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VINTR]) |
#define KILL_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VKILL]) |
#define LNEXT_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VLNEXT]) |
#define MIN_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VMIN]) |
#define QUIT_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VQUIT]) |
#define REPRINT_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VREPRINT]) |
#define START_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VSTART]) |
#define STOP_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VSTOP]) |
#define SUSP_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VSUSP]) |
#define SWTC_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VSWTC]) |
#define TIME_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VTIME]) |
#define TTY_BUFFER_PAGE (((PAGE_SIZE - sizeof(struct tty_buffer)) / 2) & ~0xFF) |
#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */ |
#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ |
#define tty_is_writelocked | ( | tty | ) | (mutex_is_locked(&tty->atomic_write_lock)) |
#define TTY_WRITE_FLUSH | ( | tty | ) | tty_write_flush((tty)) |
#define wait_event_interruptible_tty | ( | tty, | |
wq, | |||
condition | |||
) |
#define WERASE_CHAR | ( | tty | ) | ((tty)->termios.c_cc[VWERASE]) |
void __do_SAK | ( | struct tty_struct * | tty | ) |
|
read |
Definition at line 145 of file early_serial_console.c.
void deinitialize_tty_struct | ( | struct tty_struct * | tty | ) |
disassociate_ctty - disconnect controlling tty : true if exiting so need to "hang up" the session
This function is typically called only by the session leader, when it wants to disassociate itself from its controlling tty.
It performs the following functions: (1) Sends a SIGHUP and SIGCONT to the foreground process group (2) Clears the tty from being controlling the session (3) Clears the controlling tty for all processes in the session group.
The argument on_exit is set to 1 if called when a process is exiting; it is 0 if called by the ioctl TIOCNOTTY.
Locking: BTM is taken for hysterical raisins, and held when called from no_tty(). tty_mutex is taken to protect tty ->siglock is taken to protect ->signal/->sighand tasklist_lock is taken to walk process list for sessions ->siglock is taken to protect ->signal/->sighand
void do_SAK | ( | struct tty_struct * | tty | ) |
void free_tty_struct | ( | struct tty_struct * | tty | ) |
|
read |
void initialize_tty_struct | ( | struct tty_struct * | tty, |
struct tty_driver * | driver, | ||
int | idx | ||
) |
long n_tty_compat_ioctl_helper | ( | struct tty_struct * | tty, |
struct file * | file, | ||
unsigned int | cmd, | ||
unsigned long | arg | ||
) |
void n_tty_inherit_ops | ( | struct tty_ldisc_ops * | ops | ) |
n_tty_inherit_ops - inherit N_TTY methods : struct tty_ldisc_ops where to save N_TTY methods
Used by a generic struct tty_ldisc_ops to easily inherit N_TTY methods.
int n_tty_ioctl_helper | ( | struct tty_struct * | tty, |
struct file * | file, | ||
unsigned int | cmd, | ||
unsigned long | arg | ||
) |
Definition at line 1118 of file tty_ioctl.c.
int pcxe_open | ( | struct tty_struct * | tty, |
struct file * | filp | ||
) |
void proc_clear_tty | ( | struct task_struct * | p | ) |
void start_tty | ( | struct tty_struct * | tty | ) |
start_tty - propagate flow control : tty to start
Start a tty that has been stopped if at all possible. Perform any necessary wakeups and propagate the TIOCPKT status. If this is the tty was previous stopped and is being started then the driver start method is invoked and the line discipline woken.
Locking: ctrl_lock
void stop_tty | ( | struct tty_struct * | tty | ) |
stop_tty - propagate flow control : tty to stop
Perform flow control to the driver. For PTY/TTY pairs we must also propagate the TIOCKPKT status. May be called on an already stopped device and will not re-call the driver method.
This functionality is used by both the line disciplines for halting incoming flow and by the driver. It may therefore be called from any context, may be under the tty atomic_write_lock but not always.
Locking: Uses the tty control lock internally
void tty_add_file | ( | struct tty_struct * | tty, |
struct file * | file | ||
) |
void tty_buffer_flush | ( | struct tty_struct * | tty | ) |
tty_buffer_flush - flush full tty buffers : tty to flush
flush all the buffers containing receive data. If the buffer is being processed by flush_to_ldisc then we defer the processing to that function
Locking: none
Definition at line 135 of file tty_buffer.c.
void tty_buffer_free_all | ( | struct tty_struct * | tty | ) |
tty_buffer_free_all - free buffers used by a tty : tty to free from
Remove all the buffers pending on a tty whether queued with data or in the free ring. Must be called when the tty is no longer in use
Locking: none
Definition at line 30 of file tty_buffer.c.
void tty_buffer_init | ( | struct tty_struct * | tty | ) |
tty_buffer_init - prepare a tty buffer structure : tty to initialise
Set up the initial state of the buffer management for a tty device. Must be called before the other tty buffer functions are used.
Locking: none
Definition at line 558 of file tty_buffer.c.
int tty_chars_in_buffer | ( | struct tty_struct * | tty | ) |
tty_chars_in_buffer - characters pending : terminal
Return the number of bytes of data in the device private output queue. If no private method is supplied there is assumed to be no queue on the device.
Definition at line 49 of file tty_ioctl.c.
int tty_check_change | ( | struct tty_struct * | tty | ) |
void tty_default_fops | ( | struct file_operations * | fops | ) |
dev_t tty_devnum | ( | struct tty_struct * | tty | ) |
int tty_do_resize | ( | struct tty_struct * | tty, |
struct winsize * | ws | ||
) |
void tty_driver_flush_buffer | ( | struct tty_struct * | tty | ) |
tty_driver_flush_buffer - discard internal buffer : terminal
Discard the internal output buffer for this device. If no method is provided then either the buffer cannot be hardware flushed or there is no buffer driver side.
Definition at line 85 of file tty_ioctl.c.
void tty_driver_remove_tty | ( | struct tty_driver * | driver, |
struct tty_struct * | tty | ||
) |
void tty_encode_baud_rate | ( | struct tty_struct * | tty, |
speed_t | ibaud, | ||
speed_t | obaud | ||
) |
void tty_flip_buffer_push | ( | struct tty_struct * | tty | ) |
tty_flip_buffer_push - terminal : tty to push
Queue a push of the terminal flip buffers to the line discipline. This function must not be called from IRQ context if tty->low_latency is set.
In the event of the queue being busy for flipping the work will be held off and retried later.
Locking: tty buffer lock. Driver locks in low latency mode.
Definition at line 533 of file tty_buffer.c.
void tty_flush_to_ldisc | ( | struct tty_struct * | tty | ) |
tty_flush_to_ldisc : tty to push
Push the terminal flip buffers to the line discipline.
Must not be called from IRQ context.
Definition at line 515 of file tty_buffer.c.
void tty_free_termios | ( | struct tty_struct * | tty | ) |
speed_t tty_get_baud_rate | ( | struct tty_struct * | tty | ) |
|
read |
void tty_hangup | ( | struct tty_struct * | tty | ) |
|
read |
tty_init_dev - initialise a tty device : tty driver we are opening a device on : device index : returned tty structure
Prepare a tty device. This may not be a "new" clean device but could also be an active device. The pty drivers require special handling because of this.
Locking: The function is called under the tty_mutex, which protects us from the tty struct or driver itself going away.
On exit the tty device has the line discipline attached and a reference count of 1. If a pair was created for pty/tty use and the other was a pty master then it too has a reference count of 1.
WSH 06/09/97: Rewritten to remove races and properly clean up after a failed open. The new code protects the open with a mutex, so it's really quite straightforward. The mutex locking can probably be relaxed for the (most common) case of reopening a tty.
int tty_init_termios | ( | struct tty_struct * | tty | ) |
void tty_kref_put | ( | struct tty_struct * | tty | ) |
Definition at line 980 of file tty_ldisc.c.
void tty_ldisc_deinit | ( | struct tty_struct * | tty | ) |
tty_ldisc_init - ldisc cleanup for new tty : tty that was allocated recently
The tty structure must not becompletely set up (tty_ldisc_setup) when this call is made.
Definition at line 974 of file tty_ldisc.c.
tty_ldisc_deref - free a tty ldisc reference : reference to free up
Undoes the effect of tty_ldisc_ref or tty_ldisc_ref_wait. May be called in IRQ context.
Locking: takes tty_ldisc_lock
Definition at line 351 of file tty_ldisc.c.
void tty_ldisc_enable | ( | struct tty_struct * | tty | ) |
tty_ldisc_enable - allow ldisc use : terminal to activate ldisc on
Set the TTY_LDISC flag when the line discipline can be called again. Do necessary wakeups for existing sleepers. Clear the LDISC changing flag to indicate any ldisc change is now over.
Note: nobody should set the TTY_LDISC bit except via this function. Clearing directly is allowed.
Definition at line 374 of file tty_ldisc.c.
void tty_ldisc_flush | ( | struct tty_struct * | tty | ) |
tty_ldisc_flush - flush line discipline queue : tty
Flush the line discipline queue (if any) for this tty. If there is no line discipline active this is a no-op.
Definition at line 389 of file tty_ldisc.c.
void tty_ldisc_hangup | ( | struct tty_struct * | tty | ) |
tty_ldisc_hangup - hangup ldisc reset : tty being hung up
Some tty devices reset their termios when they receive a hangup event. In that situation we must also switch back to N_TTY properly before we reset the termios data.
Locking: We can take the ldisc mutex as the rest of the code is careful to allow for this.
In the pty pair case this occurs in the close() path of the tty itself so we must be careful about locking rules.
Definition at line 775 of file tty_ldisc.c.
void tty_ldisc_init | ( | struct tty_struct * | tty | ) |
tty_ldisc_init - ldisc setup for new tty : tty being allocated
Set up the line discipline objects for a newly allocated tty. Note that the tty structure is not completely set up when this call is made.
Definition at line 959 of file tty_ldisc.c.
|
read |
tty_ldisc_ref - get the tty ldisc : tty device
Dereference the line discipline for the terminal and take a reference to it. If the line discipline is in flux then return NULL. Can be called from IRQ and timer functions.
Locking: called functions take tty_ldisc_lock
Definition at line 335 of file tty_ldisc.c.
|
read |
tty_ldisc_ref_wait - wait for the tty ldisc : tty device
Dereference the line discipline for the terminal and take a reference to it. If the line discipline is in flux then wait patiently until it changes.
Note: Must not be called from an IRQ/timer context. The caller must also be careful not to hold other locks that will deadlock against a discipline change, such as an existing ldisc reference (which we check for)
Locking: call functions take tty_ldisc_lock
Definition at line 314 of file tty_ldisc.c.
void tty_ldisc_release | ( | struct tty_struct * | tty, |
struct tty_struct * | o_tty | ||
) |
tty_ldisc_release - release line discipline : tty being shut down : pair tty for pty/tty pairs
Called during the final close of a tty/pty pair in order to shut down the line discpline layer. On exit the ldisc assigned is N_TTY and the ldisc has not been opened.
Definition at line 924 of file tty_ldisc.c.
int tty_ldisc_setup | ( | struct tty_struct * | tty, |
struct tty_struct * | o_tty | ||
) |
tty_ldisc_setup - open line discipline : tty being shut down : pair tty for pty/tty pairs
Called during the initial open of a tty/pty pair in order to set up the line disciplines and bind them to the tty. This has no locking issues as the device isn't yet active.
Definition at line 877 of file tty_ldisc.c.
void __lockfunc tty_lock | ( | struct tty_struct * | tty | ) |
Definition at line 30 of file tty_mutex.c.
void __lockfunc tty_lock_pair | ( | struct tty_struct * | tty, |
struct tty_struct * | tty2 | ||
) |
Definition at line 52 of file tty_mutex.c.
int tty_mode_ioctl | ( | struct tty_struct * | tty, |
struct file * | file, | ||
unsigned int | cmd, | ||
unsigned long | arg | ||
) |
Definition at line 946 of file tty_ioctl.c.
char* tty_name | ( | struct tty_struct * | tty, |
char * | buf | ||
) |
|
read |
|
read |
int tty_perform_flush | ( | struct tty_struct * | tty, |
unsigned long | arg | ||
) |
Definition at line 1089 of file tty_ioctl.c.
Definition at line 100 of file tty_port.c.
int tty_port_block_til_ready | ( | struct tty_port * | port, |
struct tty_struct * | tty, | ||
struct file * | filp | ||
) |
tty_port_block_til_ready - Waiting logic for tty open : the tty port being opened : the tty device being bound : the file pointer of the opener
Implement the core POSIX/SuS tty behaviour when opening a tty device. Handles:
The passed tty_port must implement the carrier_raised method if it can do carrier detect and the dtr_rts method if it supports software management of these lines. Note that the dtr/rts raise is done each iteration as a hangup may have previously dropped them while we wait.
Definition at line 288 of file tty_port.c.
tty_port_carrier_raised - carrier raised check : tty port
Wrapper for the carrier detect logic. For the moment this is used to hide some internal details. This will eventually become entirely internal to the tty port.
Definition at line 228 of file tty_port.c.
Definition at line 468 of file tty_port.c.
void tty_port_close_end | ( | struct tty_port * | port, |
struct tty_struct * | tty | ||
) |
Definition at line 446 of file tty_port.c.
Definition at line 382 of file tty_port.c.
Definition at line 113 of file tty_port.c.
tty_port_hangup - hangup helper : tty port
Perform port level tty hangup flag and count changes. Drop the tty reference.
Definition at line 200 of file tty_port.c.
Definition at line 21 of file tty_port.c.
int tty_port_install | ( | struct tty_port * | port, |
struct tty_driver * | driver, | ||
struct tty_struct * | tty | ||
) |
tty_port_install - generic tty->ops->install handler : tty_port of the device : tty_driver for this device : tty to be installed
It is the same as tty_standard_install except the provided is linked to a concrete tty specified by . Use this or tty_port_register_device (or both). Call tty_port_link_device as a last resort.
Definition at line 490 of file tty_port.c.
void tty_port_link_device | ( | struct tty_port * | port, |
struct tty_driver * | driver, | ||
unsigned | index | ||
) |
tty_port_link_device - link tty and tty_port : tty_port of the device : tty_driver for this device : index of the tty
Provide the tty layer wit ha link from a tty (specified by ) to a tty_port (). Use this only if neither tty_port_register_device nor tty_port_install is used in the driver. If used, this has to be called before tty_register_driver.
Definition at line 47 of file tty_port.c.
tty_port_lower_dtr_rts - Lower DTR/RTS : tty port
Wrapper for the DTR/RTS raise logic. For the moment this is used to hide some internal details. This will eventually become entirely internal to the tty port.
Definition at line 261 of file tty_port.c.
Definition at line 498 of file tty_port.c.
Definition at line 135 of file tty_port.c.
tty_port_raise_dtr_rts - Raise DTR/RTS : tty port
Wrapper for the DTR/RTS raise logic. For the moment this is used to hide some internal details. This will eventually become entirely internal to the tty port.
Definition at line 245 of file tty_port.c.
|
read |
tty_port_register_device - register tty device : tty_port of the device : tty_driver for this device : index of the tty : parent if exists, otherwise NULL
It is the same as tty_register_device except the provided is linked to a concrete tty specified by . Use this or tty_port_install (or both). Call tty_port_link_device as a last resort.
Definition at line 67 of file tty_port.c.
|
read |
tty_port_register_device_attr - register tty device : tty_port of the device : tty_driver for this device : index of the tty : parent if exists, otherwise NULL : Driver data to be set to device. : Attribute group to be set on device.
It is the same as tty_register_device_attr except the provided is linked to a concrete tty specified by . Use this or tty_port_install (or both). Call tty_port_link_device as a last resort.
Definition at line 89 of file tty_port.c.
|
read |
tty_port_tty_get - get a tty reference : tty port
Return a refcount protected tty instance or NULL if the port is not associated with a tty (eg due to close or hangup)
Definition at line 150 of file tty_port.c.
void tty_port_tty_set | ( | struct tty_port * | port, |
struct tty_struct * | tty | ||
) |
tty_port_tty_set - set the tty of a port : tty port : the tty
Associate the port and tty pair. Manages any internal refcounts. Pass NULL to deassociate a port
Definition at line 171 of file tty_port.c.
int tty_put_char | ( | struct tty_struct * | tty, |
unsigned char | ch | ||
) |
tty_put_char - write one character to a tty : tty : character
Write one byte to the tty using the provided put_char method if present. Returns the number of characters successfully output.
Note: the specific put_char operation in the driver layer may go away soon. Don't call it directly, use this method
int tty_read_raw_data | ( | struct tty_struct * | tty, |
unsigned char * | bufp, | ||
int | buflen | ||
) |
|
read |
tty_register_device - register a tty device : the tty driver that describes the tty device : the index in the tty driver for this tty device : a struct device that is associated with this tty device. This field is optional, if there is no known struct device for this tty device it can be set to NULL safely.
Returns a pointer to the struct device for this tty device (or ERR_PTR(-EFOO) on error).
This call is required to be made to register an individual tty device if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If that bit is not set, this function should not be called by a tty driver.
Locking: ??
|
read |
tty_register_device_attr - register a tty device : the tty driver that describes the tty device : the index in the tty driver for this tty device : a struct device that is associated with this tty device. This field is optional, if there is no known struct device for this tty device it can be set to NULL safely. : Driver data to be set to device. : Attribute group to be set on device.
Returns a pointer to the struct device for this tty device (or ERR_PTR(-EFOO) on error).
This call is required to be made to register an individual tty device if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If that bit is not set, this function should not be called by a tty driver.
Locking: ??
int tty_register_driver | ( | struct tty_driver * | driver | ) |
int tty_register_ldisc | ( | int | disc, |
struct tty_ldisc_ops * | new_ldisc | ||
) |
tty_register_ldisc - install a line discipline : ldisc number : pointer to the ldisc object
Installs a new line discipline into the kernel. The discipline is set up as unreferenced and then made available to the kernel from this point onwards.
Locking: takes tty_ldisc_lock to guard against ldisc races
Definition at line 83 of file tty_ldisc.c.
tty_release - vfs callback for close : inode of tty : file pointer for handle to tty
Called the last time each file handle is closed that references this tty. There may however be several such references.
Locking: Takes bkl. See tty_release_dev
Even releasing the tty structures is a tricky business.. We have to be very careful that the structures are all released at the same time, as interrupts might otherwise get the wrong pointers.
WSH 09/09/97: rewritten to avoid some nasty race conditions that could lead to double frees or releasing memory still in use.
int tty_set_ldisc | ( | struct tty_struct * | tty, |
int | ldisc | ||
) |
tty_set_ldisc - set line discipline : the terminal to set : the line discipline
Set the discipline of a tty line. Must be called from a process context. The ldisc change logic has to protect itself against any overlapping ldisc change (including on the other end of pty pairs), the close of one side of a tty/pty pair, and eventually hangup.
Locking: takes tty_ldisc_lock, termios_mutex
Definition at line 560 of file tty_ldisc.c.
int tty_set_termios | ( | struct tty_struct * | tty, |
struct ktermios * | new_termios | ||
) |
tty_set_termios - update termios values : tty to update : desired new value
Perform updates to the termios values set on this terminal. There is a bit of layering violation here with n_tty in terms of the internal knowledge of this function.
Locking: termios_mutex
Definition at line 498 of file tty_ioctl.c.
int tty_signal | ( | int | sig, |
struct tty_struct * | tty | ||
) |
int tty_standard_install | ( | struct tty_driver * | driver, |
struct tty_struct * | tty | ||
) |
tty_termios_baud_rate : termios structure
Convert termios baud rate data into a speed. This should be called with the termios lock held if this termios is a terminal termios structure. May change the termios data. Device drivers can call this function but should use ->c_[io]speed directly as they are updated.
Locking: none
Definition at line 241 of file tty_ioctl.c.
tty_termios_copy_hw - copy hardware settings : New termios : Old termios
Propagate the hardware specific terminal setting bits from the old termios structure to the new one. This is used in cases where the hardware does not support reconfiguration or as a helper in some cases where only minimal reconfiguration is supported
Definition at line 456 of file tty_ioctl.c.
tty_termios_encode_baud_rate : ktermios structure holding user requested state : input speed : output speed
Encode the speeds set into the passed termios structure. This is used as a library helper for drivers so that they can report back the actual speed selected when it differs from the speed requested
For maximal back compatibility with legacy SYS5/POSIX *nix behaviour we need to carefully set the bits when the user does not get the desired speed. We allow small margins and preserve as much of possible of the input intent to keep compatibility.
Locking: Caller should hold termios lock. This is already held when calling this function from the driver termios handler.
The ifdefs deal with platforms whose owners have yet to update them and will all go away once this is done.
Definition at line 325 of file tty_ioctl.c.
tty_termios_hw_change - check for setting change : termios : termios to compare
Check if any of the bits that affect a dumb device have changed between the two termios structures, or a speed change is needed.
Definition at line 476 of file tty_ioctl.c.
tty_termios_input_baud_rate : termios structure
Convert termios baud rate data into a speed. This should be called with the termios lock held if this termios is a terminal termios structure. May change the termios data. Device drivers can call this function but should use ->c_[io]speed directly as they are updated.
Locking: none
Definition at line 276 of file tty_ioctl.c.
void tty_throttle | ( | struct tty_struct * | tty | ) |
tty_throttle - flow control : terminal
Indicate that a tty should stop transmitting data down the stack. Takes the termios mutex to protect against parallel throttle/unthrottle and also to ensure the driver can consistently reference its own termios data at this point when implementing software flow control.
Definition at line 102 of file tty_ioctl.c.
void __lockfunc tty_unlock | ( | struct tty_struct * | tty | ) |
Definition at line 36 of file tty_mutex.c.
void __lockfunc tty_unlock_pair | ( | struct tty_struct * | tty, |
struct tty_struct * | tty2 | ||
) |
Definition at line 66 of file tty_mutex.c.
void tty_unregister_device | ( | struct tty_driver * | driver, |
unsigned | index | ||
) |
int tty_unregister_driver | ( | struct tty_driver * | driver | ) |
tty_unregister_ldisc - unload a line discipline : ldisc number : pointer to the ldisc object
Remove a line discipline from the kernel providing it is not currently in use.
Locking: takes tty_ldisc_lock to guard against ldisc races
Definition at line 113 of file tty_ldisc.c.
void tty_unthrottle | ( | struct tty_struct * | tty | ) |
tty_unthrottle - flow control : terminal
Indicate that a tty may continue transmitting data down the stack. Takes the termios mutex to protect against parallel throttle/unthrottle and also to ensure the driver can consistently reference its own termios data at this point when implementing software flow control.
Drivers should however remember that the stack can issue a throttle, then change flow control method, then unthrottle.
Definition at line 126 of file tty_ioctl.c.
void tty_vhangup | ( | struct tty_struct * | tty | ) |
void tty_vhangup_locked | ( | struct tty_struct * | tty | ) |
void tty_wait_until_sent | ( | struct tty_struct * | tty, |
long | timeout | ||
) |
tty_wait_until_sent - wait for I/O to finish : tty we are waiting for : how long we will wait
Wait for characters pending in a tty driver to hit the wire, or for a timeout to occur (eg due to flow control)
Locking: none
Definition at line 147 of file tty_ioctl.c.
void tty_wakeup | ( | struct tty_struct * | tty | ) |
void tty_write_flush | ( | struct tty_struct * | ) |
void tty_write_message | ( | struct tty_struct * | tty, |
char * | msg | ||
) |
tty_write_message - write a message to a certain tty, not just the console. : the destination tty_struct : the message to write
This is used for messages that need to be redirected to a specific tty. We don't put it into the syslog queue right now maybe in the future if really needed.
We must still hold the BTM and test the CLOSING flag for the moment.
int tty_write_room | ( | struct tty_struct * | tty | ) |
tty_write_room - write queue space : terminal
Return the number of bytes that can be queued to this device at the present time. The result should be treated as a guarantee and the driver cannot offer a value it later shrinks by more than the number of bytes written. If no method is provided 2K is always returned and data may be lost as there will be no flow control.
Definition at line 69 of file tty_ioctl.c.
void tty_write_unlock | ( | struct tty_struct * | tty | ) |
Definition at line 653 of file vc_screen.c.
long vt_compat_ioctl | ( | struct tty_struct * | tty, |
unsigned int | cmd, | ||
unsigned long | arg | ||
) |
int vt_ioctl | ( | struct tty_struct * | tty, |
unsigned int | cmd, | ||
unsigned long | arg | ||
) |
Definition at line 291 of file vt_ioctl.c.
spinlock_t tty_files_lock |
struct tty_ldisc_ops tty_ldisc_N_TTY |
struct file_operations tty_ldiscs_proc_fops |
Definition at line 247 of file tty_ldisc.c.