This source file includes following definitions.
- pty_copy
- mpty_write
- spty_write
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <linux/sched.h>
16 #include <linux/tty.h>
17
18 #include <asm/system.h>
19 #include <asm/io.h>
20
21 static inline void pty_copy(struct tty_struct * from, struct tty_struct * to)
22 {
23 int c;
24
25 while (!from->stopped && !EMPTY(from->write_q)) {
26 if (FULL(to->read_q)) {
27 if (FULL(to->secondary))
28 break;
29 TTY_READ_FLUSH(to);
30 continue;
31 }
32 c = GETCH(from->write_q);
33 PUTCH(c,to->read_q);
34 if (current->signal & ~current->blocked)
35 break;
36 }
37 TTY_READ_FLUSH(to);
38 wake_up(&from->write_q->proc_list);
39 }
40
41
42
43
44
45
46 void mpty_write(struct tty_struct * tty)
47 {
48 int nr = tty - tty_table;
49
50 if ((nr >> 6) != 2)
51 printk("bad mpty\n\r");
52 else
53 pty_copy(tty,tty+64);
54 }
55
56 void spty_write(struct tty_struct * tty)
57 {
58 int nr = tty - tty_table;
59
60 if ((nr >> 6) != 3)
61 printk("bad spty\n\r");
62 else
63 pty_copy(tty,tty-64);
64 }