⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tty.h

📁 LINUX1.0内核源代码,学习LINUX编程的一定要看。
💻 H
📖 第 1 页 / 共 2 页
字号:
#define L_IEXTEN(tty)	_L_FLAG((tty),IEXTEN)/* * Where all of the state associated with a tty is kept while the tty * is open.  Since the termios state should be kept even if the tty * has been closed --- for things like the baud rate, etc --- it is * not stored here, but rather a pointer to the real state is stored * here.  Possible the winsize structure should have the same * treatment, but (1) the default 80x24 is usually right and (2) it's * most often used by a windowing system, which will set the correct * size each time the window is created or resized anyway. * IMPORTANT: since this structure is dynamically allocated, it must * be no larger than 4096 bytes.  Changing TTY_BUF_SIZE will change * the size of this structure, and it needs to be done with care. * 						- TYT, 9/14/92 */struct tty_struct {	struct termios *termios;	int pgrp;	int session;	unsigned char stopped:1, hw_stopped:1, packet:1, lnext:1;	unsigned char char_error:3;	unsigned char erasing:1;	unsigned char ctrl_status;	short line;	int disc;	int flags;	int count;	unsigned int column;	struct winsize winsize;	int  (*open)(struct tty_struct * tty, struct file * filp);	void (*close)(struct tty_struct * tty, struct file * filp);	void (*write)(struct tty_struct * tty);	int  (*ioctl)(struct tty_struct *tty, struct file * file,		    unsigned int cmd, unsigned long arg);	void (*throttle)(struct tty_struct * tty, int status);	void (*set_termios)(struct tty_struct *tty, struct termios * old);	void (*stop)(struct tty_struct *tty);	void (*start)(struct tty_struct *tty);	void (*hangup)(struct tty_struct *tty);	struct tty_struct *link;	unsigned char *write_data_ptr;	int write_data_cnt;	void (*write_data_callback)(void * data);	void * write_data_arg;	int readq_flags[TTY_BUF_SIZE/32];	int secondary_flags[TTY_BUF_SIZE/32];	int canon_data;	unsigned long canon_head;	unsigned int canon_column;	struct tty_queue read_q;	struct tty_queue write_q;	struct tty_queue secondary;	void *disc_data;};struct tty_ldisc {	int	flags;	/*	 * The following routines are called from above.	 */	int	(*open)(struct tty_struct *);	void	(*close)(struct tty_struct *);	int	(*read)(struct tty_struct * tty, struct file * file,			unsigned char * buf, unsigned int nr);	int	(*write)(struct tty_struct * tty, struct file * file,			 unsigned char * buf, unsigned int nr);		int	(*ioctl)(struct tty_struct * tty, struct file * file,			 unsigned int cmd, unsigned long arg);	int	(*select)(struct tty_struct * tty, struct inode * inode,			  struct file * file, int sel_type,			  struct select_table_struct *wait);	/*	 * The following routines are called from below.	 */	void	(*handler)(struct tty_struct *);};#define LDISC_FLAG_DEFINED	0x00000001/* * These are the different types of thottle status which can be sent * to the low-level tty driver.  The tty_io.c layer is responsible for * notifying the low-level tty driver of the following conditions: * secondary queue full, secondary queue available, and read queue * available.  The low-level driver must send the read queue full * command to itself, if it is interested in that condition. * * Note that the low-level tty driver may elect to ignore one or both * of these conditions; normally, however, it will use ^S/^Q or some * sort of hardware flow control to regulate the input to try to avoid * overflow.  While the low-level driver is responsible for all * receiving flow control, note that the ^S/^Q handling (but not * hardware flow control) is handled by the upper layer, in * copy_to_cooked.   */#define TTY_THROTTLE_SQ_FULL	1#define TTY_THROTTLE_SQ_AVAIL	2#define TTY_THROTTLE_RQ_FULL	3#define TTY_THROTTLE_RQ_AVAIL	4/* * This defines the low- and high-watermarks for the various conditions. * Again, the low-level driver is free to ignore any of these, and has * to implement RQ_THREHOLD_LW for itself if it wants it. */#define SQ_THRESHOLD_LW	16#define SQ_THRESHOLD_HW 768#define RQ_THRESHOLD_LW 16#define RQ_THRESHOLD_HW 768/* * These bits are used in the flags field of the tty structure. *  * So that interrupts won't be able to mess up the queues, * copy_to_cooked must be atomic with repect to itself, as must * tty->write.  Thus, you must use the inline functions set_bit() and * clear_bit() to make things atomic. */#define TTY_WRITE_BUSY 0#define TTY_READ_BUSY 1#define TTY_SQ_THROTTLED 2#define TTY_RQ_THROTTLED 3#define TTY_IO_ERROR 4#define TTY_SLAVE_CLOSED 5#define TTY_EXCLUSIVE 6/* * When a break, frame error, or parity error happens, these codes are * stuffed into the read queue, and the relevant bit in readq_flag bit * array is set. */#define TTY_BREAK	1#define TTY_FRAME	2#define TTY_PARITY	3#define TTY_OVERRUN	4#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))#define TTY_READ_FLUSH(tty) tty_read_flush((tty))extern void tty_write_flush(struct tty_struct *);extern void tty_read_flush(struct tty_struct *);/* Number of chars that must be available in a write queue before   the queue is awakened. */#define WAKEUP_CHARS (3*TTY_BUF_SIZE/4)extern struct tty_struct *tty_table[];extern struct termios *tty_termios[];extern struct termios *termios_locked[];extern int tty_check_write[];extern struct tty_struct * redirect;extern struct tty_ldisc ldiscs[];extern int fg_console;extern unsigned long video_num_columns;extern unsigned long video_num_lines;extern struct wait_queue * keypress_wait;#define TTY_TABLE_IDX(nr)	((nr) ? (nr) : (fg_console+1))#define TTY_TABLE(nr) 		(tty_table[TTY_TABLE_IDX(nr)])/*	intr=^C		quit=^|		erase=del	kill=^U	eof=^D		vtime=\0	vmin=\1		sxtc=\0	start=^Q	stop=^S		susp=^Z		eol=\0	reprint=^R	discard=^U	werase=^W	lnext=^V	eol2=\0*/#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"extern long rs_init(long);extern long lp_init(long);extern long con_init(long);extern long tty_init(long);extern void flush_input(struct tty_struct * tty);extern void flush_output(struct tty_struct * tty);extern void wait_until_sent(struct tty_struct * tty, int timeout);extern int check_change(struct tty_struct * tty, int channel);extern void stop_tty(struct tty_struct * tty);extern void start_tty(struct tty_struct * tty);extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,			     int buflen);extern int tty_write_data(struct tty_struct *tty, char *bufp, int buflen,			  void (*callback)(void * data), void * callarg);extern int tty_ioctl(struct inode *, struct file *, unsigned int, unsigned long);extern int is_orphaned_pgrp(int pgrp);extern int is_ignored(int sig);extern int tty_signal(int sig, struct tty_struct *tty);extern void tty_hangup(struct tty_struct * tty);extern void tty_vhangup(struct tty_struct * tty);extern void tty_unhangup(struct file *filp);extern int tty_hung_up_p(struct file * filp);extern void do_SAK(struct tty_struct *tty);extern void disassociate_ctty(int priv);/* tty write functions */extern void rs_write(struct tty_struct * tty);extern void con_write(struct tty_struct * tty);/* serial.c */extern int  rs_open(struct tty_struct * tty, struct file * filp);/* pty.c */extern int  pty_open(struct tty_struct * tty, struct file * filp);/* console.c */extern int con_open(struct tty_struct * tty, struct file * filp);extern void update_screen(int new_console);extern void blank_screen(void);extern void unblank_screen(void);/* vt.c */extern int vt_ioctl(struct tty_struct *tty, struct file * file,		    unsigned int cmd, unsigned long arg);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -