亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tty_io.c

?? linux 1.0 源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* *  linux/kernel/tty_io.c * *  Copyright (C) 1991, 1992  Linus Torvalds *//* * '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 a 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 discpline 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 <alfie@dcs.warwick.ac.uk>, 27th May 1993. * * Rewrote canonical mode and added more termios flags. * 	-- julian@uhunix.uhcc.hawaii.edu (J. Cowley), 13Jan94 */#include <linux/types.h>#include <linux/major.h>#include <linux/errno.h>#include <linux/signal.h>#include <linux/fcntl.h>#include <linux/sched.h>#include <linux/tty.h>#include <linux/timer.h>#include <linux/ctype.h>#include <linux/kd.h>#include <linux/mm.h>#include <linux/string.h>#include <linux/malloc.h>#include <asm/segment.h>#include <asm/system.h>#include <asm/bitops.h>#include "kbd_kern.h"#include "vt_kern.h"#define CONSOLE_DEV MKDEV(TTY_MAJOR,0)#define MAX_TTYS 256struct tty_struct *tty_table[MAX_TTYS];struct termios *tty_termios[MAX_TTYS];	/* We need to keep the termios state */				  	/* around, even when a tty is closed */struct termios *termios_locked[MAX_TTYS]; /* Bitfield of locked termios flags*/struct tty_ldisc ldiscs[NR_LDISCS];	/* line disc dispatch table	*/int tty_check_write[MAX_TTYS/32];	/* bitfield for the bh handler *//* * fg_console is the current virtual console, * redirect is the pseudo-tty that console output * is redirected to if asked by TIOCCONS. */int fg_console = 0;struct tty_struct * redirect = NULL;struct wait_queue * keypress_wait = NULL;static void initialize_tty_struct(int line, struct tty_struct *tty);static void initialize_termios(int line, struct termios *tp);static int tty_read(struct inode *, struct file *, char *, int);static int tty_write(struct inode *, struct file *, char *, int);static int tty_select(struct inode *, struct file *, int, select_table *);static int tty_open(struct inode *, struct file *);static void tty_release(struct inode *, struct file *);int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc){	if (disc < N_TTY || disc >= NR_LDISCS)		return -EINVAL;		if (new_ldisc) {		ldiscs[disc] = *new_ldisc;		ldiscs[disc].flags |= LDISC_FLAG_DEFINED;	} else		memset(&ldiscs[disc], 0, sizeof(struct tty_ldisc));		return 0;}void put_tty_queue(unsigned char c, struct tty_queue * queue){	int head;	unsigned long flags;	save_flags(flags);	cli();	head = (queue->head + 1) & (TTY_BUF_SIZE-1);	if (head != queue->tail) {		queue->buf[queue->head] = c;		queue->head = head;	}	restore_flags(flags);}int get_tty_queue(struct tty_queue * queue){	int result = -1;	unsigned long flags;	save_flags(flags);	cli();	if (queue->tail != queue->head) {		result = queue->buf[queue->tail];		INC(queue->tail);	}	restore_flags(flags);	return result;}/* * This routine copies out a maximum of buflen characters from the * read_q; it is a convenience for line disciplines so they can grab a * large block of data without calling get_tty_char directly.  It * returns the number of characters actually read. Return terminates * if an error character is read from the queue and the return value * is negated. */int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, int buflen){	int	result = 0;	unsigned char	*p = bufp;	unsigned long flags;	int head, tail;	int ok = 1;	save_flags(flags);	cli();	tail = tty->read_q.tail;	head = tty->read_q.head;	while ((result < buflen) && (tail!=head) && ok) {		ok = !clear_bit (tail, &tty->readq_flags);		*p++ =  tty->read_q.buf[tail++];		tail &= TTY_BUF_SIZE-1;		result++;	}	tty->read_q.tail = tail;	restore_flags(flags);	return (ok) ? result : -result;}void tty_write_flush(struct tty_struct * tty){	if (!tty->write || EMPTY(&tty->write_q))		return;	if (set_bit(TTY_WRITE_BUSY,&tty->flags))		return;	tty->write(tty);	if (!clear_bit(TTY_WRITE_BUSY,&tty->flags))		printk("tty_write_flush: bit already cleared\n");}void tty_read_flush(struct tty_struct * tty){	if (!tty || EMPTY(&tty->read_q))		return;	if (set_bit(TTY_READ_BUSY, &tty->flags))		return;	ldiscs[tty->disc].handler(tty);	if (!clear_bit(TTY_READ_BUSY, &tty->flags))		printk("tty_read_flush: bit already cleared\n");}static int hung_up_tty_read(struct inode * inode, struct file * file, char * buf, int count){	return 0;}static int hung_up_tty_write(struct inode * inode, struct file * file, char * buf, int count){	return -EIO;}static int hung_up_tty_select(struct inode * inode, struct file * filp, int sel_type, select_table * wait){	return 1;}static int hung_up_tty_ioctl(struct inode * inode, struct file * file,			     unsigned int cmd, unsigned long arg){	return -EIO;}static int tty_lseek(struct inode * inode, struct file * file, off_t offset, int orig){	return -ESPIPE;}static struct file_operations tty_fops = {	tty_lseek,	tty_read,	tty_write,	NULL,		/* tty_readdir */	tty_select,	tty_ioctl,	NULL,		/* tty_mmap */	tty_open,	tty_release};static struct file_operations hung_up_tty_fops = {	tty_lseek,	hung_up_tty_read,	hung_up_tty_write,	NULL,		/* hung_up_tty_readdir */	hung_up_tty_select,	hung_up_tty_ioctl,	NULL,		/* hung_up_tty_mmap */	NULL,		/* hung_up_tty_open */	tty_release	/* hung_up_tty_release */};void do_tty_hangup(struct tty_struct * tty, struct file_operations *fops){	int i;	struct file * filp;	struct task_struct *p;	int dev;	if (!tty)		return;	dev = MKDEV(TTY_MAJOR,tty->line);	for (filp = first_file, i=0; i<nr_files; i++, filp = filp->f_next) {		if (!filp->f_count)			continue;		if (filp->f_rdev != dev)			continue;		if (filp->f_inode && filp->f_inode->i_rdev == CONSOLE_DEV)			continue;		if (filp->f_op != &tty_fops)			continue;		filp->f_op = fops;	}	flush_input(tty);	flush_output(tty);	wake_up_interruptible(&tty->secondary.proc_list);	if (tty->session > 0) {		kill_sl(tty->session,SIGHUP,1);		kill_sl(tty->session,SIGCONT,1);	}	tty->session = 0;	tty->pgrp = -1; 	for_each_task(p) {		if (p->tty == tty->line)			p->tty = -1;	}	if (tty->hangup)		(tty->hangup)(tty);}void tty_hangup(struct tty_struct * tty){#ifdef TTY_DEBUG_HANGUP	printk("tty%d hangup...\n", tty->line);#endif	do_tty_hangup(tty, &hung_up_tty_fops);}void tty_vhangup(struct tty_struct * tty){#ifdef TTY_DEBUG_HANGUP	printk("tty%d vhangup...\n", tty->line);#endif	do_tty_hangup(tty, &hung_up_tty_fops);}int tty_hung_up_p(struct file * filp){	return (filp->f_op == &hung_up_tty_fops);}/* * This function is typically called only by the session leader, when * it wants to dissassociate 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. */void disassociate_ctty(int priv){	struct tty_struct *tty;	struct task_struct *p;	if (current->tty >= 0) {		tty = tty_table[current->tty];		if (tty) {			if (tty->pgrp > 0) {				kill_pg(tty->pgrp, SIGHUP, priv);				kill_pg(tty->pgrp, SIGCONT, priv);			}			tty->session = 0;			tty->pgrp = -1;		} else			printk("disassociate_ctty: ctty is NULL?!?");	}	for_each_task(p)	  	if (p->session == current->session)			p->tty = -1;}/* * Sometimes we want to wait until a particular VT has been activated. We * do it in a very simple manner. Everybody waits on a single queue and * get woken up at once. Those that are satisfied go on with their business, * while those not ready go back to sleep. Seems overkill to add a wait * to each vt just for this - usually this does nothing! */static struct wait_queue *vt_activate_queue = NULL;/* * Sleeps until a vt is activated, or the task is interrupted. Returns * 0 if activation, -1 if interrupted. */int vt_waitactive(void){	interruptible_sleep_on(&vt_activate_queue);	return (current->signal & ~current->blocked) ? -1 : 0;}#define vt_wake_waitactive() wake_up(&vt_activate_queue)extern int kill_proc(int pid, int sig, int priv);/* * Performs the back end of a vt switch */void complete_change_console(unsigned int new_console){	unsigned char old_vc_mode;	if (new_console == fg_console || new_console >= NR_CONSOLES)		return;	/*	 * If we're switching, we could be going from KD_GRAPHICS to	 * KD_TEXT mode or vice versa, which means we need to blank or	 * unblank the screen later.	 */	old_vc_mode = vt_cons[fg_console].vc_mode;	update_screen(new_console);	/*	 * If this new console is under process control, send it a signal	 * telling it that it has acquired. Also check if it has died and	 * clean up (similar to logic employed in change_console())	 */	if (vt_cons[new_console].vt_mode.mode == VT_PROCESS)	{		/*		 * Send the signal as privileged - kill_proc() will		 * tell us if the process has gone or something else		 * is awry		 */		if (kill_proc(vt_cons[new_console].vt_pid,			      vt_cons[new_console].vt_mode.acqsig,			      1) != 0)		{		/*		 * The controlling process has died, so we revert back to		 * normal operation. In this case, we'll also change back		 * to KD_TEXT mode. I'm not sure if this is strictly correct		 * but it saves the agony when the X server dies and the screen		 * remains blanked due to KD_GRAPHICS! It would be nice to do		 * this outside of VT_PROCESS but there is no single process		 * to account for and tracking tty count may be undesirable.		 */			vt_cons[new_console].vc_mode = KD_TEXT;			clr_vc_kbd_mode(kbd_table + new_console, VC_RAW);			clr_vc_kbd_mode(kbd_table + new_console, VC_MEDIUMRAW); 			vt_cons[new_console].vt_mode.mode = VT_AUTO; 			vt_cons[new_console].vt_mode.waitv = 0; 			vt_cons[new_console].vt_mode.relsig = 0;			vt_cons[new_console].vt_mode.acqsig = 0;			vt_cons[new_console].vt_mode.frsig = 0;			vt_cons[new_console].vt_pid = -1;			vt_cons[new_console].vt_newvt = -1;		}	}	/*	 * We do this here because the controlling process above may have	 * gone, and so there is now a new vc_mode	 */	if (old_vc_mode != vt_cons[new_console].vc_mode)	{		if (vt_cons[new_console].vc_mode == KD_TEXT)			unblank_screen();		else {			timer_active &= ~(1<<BLANK_TIMER);			blank_screen();		}	}	/*	 * Wake anyone waiting for their VT to activate	 */	vt_wake_waitactive();	return;}/* * Performs the front-end of a vt switch */void change_console(unsigned int new_console){	if (new_console == fg_console || new_console >= NR_CONSOLES)		return;	/*	 * If this vt is in process mode, then we need to handshake with	 * that process before switching. Essentially, we store where that	 * vt wants to switch to and wait for it to tell us when it's done	 * (via VT_RELDISP ioctl).	 *	 * We also check to see if the controlling process still exists.	 * If it doesn't, we reset this vt to auto mode and continue.	 * This is a cheap way to track process control. The worst thing	 * that can happen is: we send a signal to a process, it dies, and	 * the switch gets "lost" waiting for a response; hopefully, the	 * user will try again, we'll detect the process is gone (unless	 * the user waits just the right amount of time :-) and revert the	 * vt to auto control.	 */	if (vt_cons[fg_console].vt_mode.mode == VT_PROCESS)	{		/*		 * Send the signal as privileged - kill_proc() will		 * tell us if the process has gone or something else		 * is awry		 */		if (kill_proc(vt_cons[fg_console].vt_pid,			      vt_cons[fg_console].vt_mode.relsig,			      1) == 0)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩欧美一区二区| 国产日韩三级在线| 久久精品一二三| 亚洲国产精品一区二区久久| 日韩电影在线观看电影| 白白色 亚洲乱淫| 日韩午夜精品电影| 亚洲资源中文字幕| 国产99久久久国产精品免费看| 91精品国产麻豆| 亚洲男女一区二区三区| 国产91精品欧美| 精品国产露脸精彩对白| 污片在线观看一区二区| 在线观看不卡一区| 亚洲人成小说网站色在线| 国产福利视频一区二区三区| 5月丁香婷婷综合| 午夜视频在线观看一区二区| 欧美中文字幕一区二区三区| 亚洲视频一区二区免费在线观看| 成人午夜免费电影| 久久久久久久网| 国产一区免费电影| 久久久噜噜噜久久人人看| 久久疯狂做爰流白浆xx| 日韩一区二区视频在线观看| 午夜精品123| 6080日韩午夜伦伦午夜伦| 日韩主播视频在线| 欧美一级片在线| 麻豆91在线看| 亚洲精品一区二区三区99 | 中国av一区二区三区| 福利一区二区在线观看| 欧美国产精品久久| 91一区二区三区在线观看| 亚洲人成精品久久久久久| 色婷婷综合久色| 午夜久久久久久久久久一区二区| 欧美精品日韩一本| 麻豆成人久久精品二区三区小说| 亚洲精品一区二区三区四区高清| 国产高清久久久久| 亚洲同性gay激情无套| 欧美色图一区二区三区| 日韩vs国产vs欧美| 久久综合色鬼综合色| 国产九九视频一区二区三区| 成人免费在线视频| 欧美日韩国产色站一区二区三区| 青青草原综合久久大伊人精品| 久久综合久久综合久久综合| 粉嫩av一区二区三区在线播放| 日韩毛片在线免费观看| 91精品欧美综合在线观看最新| 看国产成人h片视频| 国产亚洲视频系列| 色偷偷久久一区二区三区| 日韩高清一区在线| 国产日产欧美一区二区视频| 日本精品裸体写真集在线观看| 人妖欧美一区二区| 国产精品久久午夜夜伦鲁鲁| 欧美亚洲一区二区在线| 久久99国产精品尤物| 国产精品毛片无遮挡高清| 欧美日韩一区高清| 福利视频网站一区二区三区| 婷婷成人综合网| 国产精品毛片久久久久久久| 91麻豆精品国产91久久久久| 丁香六月久久综合狠狠色| 日韩精品电影在线| 日韩毛片视频在线看| 欧美tickle裸体挠脚心vk| 一本大道av伊人久久综合| 国内外成人在线视频| 亚洲一二三区视频在线观看| 欧美激情综合在线| 精品久久久久av影院 | 久久综合99re88久久爱| 欧美色图天堂网| 97精品国产97久久久久久久久久久久 | 一区二区三区在线高清| 欧美mv和日韩mv的网站| 欧美色涩在线第一页| 成人免费va视频| 国产麻豆视频精品| 五月综合激情日本mⅴ| 亚洲精品写真福利| √…a在线天堂一区| 久久久www成人免费无遮挡大片| 欧美美女bb生活片| 91国在线观看| 99久精品国产| av欧美精品.com| 国产精品亚洲一区二区三区妖精| 日产欧产美韩系列久久99| 亚洲综合一二区| 亚洲一区免费在线观看| 亚洲精品中文字幕乱码三区| 亚洲视频在线一区| 亚洲美女屁股眼交3| 国产精品久久久久天堂| 国产精品视频一区二区三区不卡| 久久精品亚洲一区二区三区浴池| 精品久久久影院| 久久久久久久久久久黄色| 久久综合久久鬼色中文字| 精品99久久久久久| 久久综合九色综合欧美就去吻| 精品1区2区在线观看| 日韩欧美国产小视频| 欧美变态口味重另类| 精品1区2区在线观看| 2023国产精品自拍| 国产精品色在线| 日韩久久一区二区| 亚洲国产精品天堂| 日本在线不卡一区| 另类成人小视频在线| 国产精品88888| av在线这里只有精品| 91蜜桃在线免费视频| 欧美性做爰猛烈叫床潮| 91精品国产综合久久福利软件 | 欧美性大战久久久久久久| 欧美日韩一区二区三区不卡| 在线播放91灌醉迷j高跟美女 | 欧洲中文字幕精品| 欧美日韩国产在线播放网站| 91精品国产高清一区二区三区蜜臀| 欧美一级国产精品| 国产视频一区二区在线观看| 国产精品久久久久aaaa樱花 | 亚洲图片有声小说| 久久爱另类一区二区小说| 成人小视频在线| 欧美日韩在线亚洲一区蜜芽| 欧美一级理论片| 国产精品麻豆欧美日韩ww| 亚洲电影一级黄| 国产乱码精品一区二区三区av| 99久久精品国产一区| 91精品国产美女浴室洗澡无遮挡| 久久免费视频色| 亚洲综合图片区| 国产美女一区二区三区| 91久久线看在观草草青青 | 欧美老女人第四色| 精品国产电影一区二区| 亚洲视频狠狠干| 久久99九九99精品| 色成人在线视频| 久久网站最新地址| 一区二区三区国产| 国产精品538一区二区在线| 一本久道中文字幕精品亚洲嫩| 日韩精品一区二区三区视频播放| 一区在线观看视频| 久久精品国产第一区二区三区| 91视频在线观看免费| 精品久久一区二区三区| 午夜亚洲福利老司机| aaa亚洲精品| 久久久久久9999| 日韩av一区二| 91久久精品国产91性色tv| 欧美国产精品中文字幕| 狠狠色伊人亚洲综合成人| 欧美日韩精品一区二区三区蜜桃| 国产精品国产三级国产普通话99 | 欧美日韩精品电影| 日韩一区有码在线| 国产成人免费在线观看| 欧美成人一区二区三区在线观看| 日韩久久一区二区| 成人激情免费网站| 久久综合国产精品| 激情久久五月天| 欧美一区二区视频观看视频| 一区二区三区视频在线看| 成人免费精品视频| 中文在线一区二区 | 久久久不卡网国产精品一区| 日韩激情一二三区| 欧美日韩久久一区二区| 怡红院av一区二区三区| 99久久久精品免费观看国产蜜| 亚洲精品在线电影| 国产一区二区三区在线观看精品| 欧美一区二区二区| 日韩高清一级片| 日韩精品一区二| 韩日av一区二区| 久久精品视频网| 成人午夜电影网站| 国产精品久久久久影院色老大| 波多野结衣在线一区|