Commit | Line | Data |
---|---|---|
e8743532 | 1 | /* tty_tty.c 4.6 82/01/19 */ |
63c57592 BJ |
2 | |
3 | /* | |
964bcfb1 | 4 | * Indirect driver for controlling tty. |
231ed58b BJ |
5 | * |
6 | * THIS IS GARBAGE: MUST SOON BE DONE WITH struct inode * IN PROC TABLE. | |
63c57592 BJ |
7 | */ |
8 | #include "../h/param.h" | |
9 | #include "../h/systm.h" | |
10 | #include "../h/conf.h" | |
11 | #include "../h/dir.h" | |
12 | #include "../h/user.h" | |
13 | #include "../h/tty.h" | |
14 | #include "../h/proc.h" | |
15 | ||
16 | /*ARGSUSED*/ | |
17 | syopen(dev, flag) | |
18 | { | |
19 | ||
e8743532 | 20 | if (u.u_ttyp == NULL) { |
63c57592 BJ |
21 | u.u_error = ENXIO; |
22 | return; | |
23 | } | |
24 | (*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag); | |
25 | } | |
26 | ||
27 | /*ARGSUSED*/ | |
28 | syread(dev) | |
29 | { | |
30 | ||
e8743532 | 31 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
32 | u.u_error = ENXIO; |
33 | return; | |
34 | } | |
63c57592 BJ |
35 | (*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd); |
36 | } | |
37 | ||
38 | /*ARGSUSED*/ | |
39 | sywrite(dev) | |
40 | { | |
41 | ||
e8743532 | 42 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
43 | u.u_error = ENXIO; |
44 | return; | |
45 | } | |
63c57592 BJ |
46 | (*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd); |
47 | } | |
48 | ||
49 | /*ARGSUSED*/ | |
50 | syioctl(dev, cmd, addr, flag) | |
51 | caddr_t addr; | |
52 | { | |
53 | ||
9060c89c BJ |
54 | if (cmd == TIOCNOTTY) { |
55 | u.u_ttyp = 0; | |
56 | u.u_ttyd = 0; | |
57 | u.u_procp->p_pgrp = 0; | |
58 | return; | |
59 | } | |
e8743532 | 60 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
61 | u.u_error = ENXIO; |
62 | return; | |
63 | } | |
63c57592 BJ |
64 | (*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag); |
65 | } | |
231ed58b BJ |
66 | |
67 | syselect(dev, flag) | |
68 | { | |
69 | ||
e8743532 | 70 | if (u.u_ttyp == NULL) { |
231ed58b | 71 | u.u_error = ENXIO; |
9060c89c | 72 | return (0); |
231ed58b | 73 | } |
9060c89c | 74 | return ((*cdevsw[major(u.u_ttyd)].d_select)(dev, flag)); |
231ed58b | 75 | } |