Commit | Line | Data |
---|---|---|
be3a1208 | 1 | /* tty_tty.c 4.10 82/08/22 */ |
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" | |
be3a1208 | 15 | #include "../h/uio.h" |
63c57592 BJ |
16 | |
17 | /*ARGSUSED*/ | |
18 | syopen(dev, flag) | |
19 | { | |
20 | ||
e8743532 | 21 | if (u.u_ttyp == NULL) { |
63c57592 BJ |
22 | u.u_error = ENXIO; |
23 | return; | |
24 | } | |
25 | (*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag); | |
26 | } | |
27 | ||
28 | /*ARGSUSED*/ | |
be3a1208 BJ |
29 | syread(dev, uio) |
30 | dev_t dev; | |
31 | struct uio *uio; | |
63c57592 BJ |
32 | { |
33 | ||
e8743532 | 34 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
35 | u.u_error = ENXIO; |
36 | return; | |
37 | } | |
be3a1208 | 38 | (*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd, uio); |
63c57592 BJ |
39 | } |
40 | ||
41 | /*ARGSUSED*/ | |
be3a1208 BJ |
42 | sywrite(dev, uio) |
43 | dev_t dev; | |
44 | struct uio *uio; | |
63c57592 BJ |
45 | { |
46 | ||
e8743532 | 47 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
48 | u.u_error = ENXIO; |
49 | return; | |
50 | } | |
be3a1208 | 51 | (*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd, uio); |
63c57592 BJ |
52 | } |
53 | ||
54 | /*ARGSUSED*/ | |
55 | syioctl(dev, cmd, addr, flag) | |
35c1dcdb BJ |
56 | dev_t dev; |
57 | int cmd; | |
58 | caddr_t addr; | |
59 | int flag; | |
63c57592 BJ |
60 | { |
61 | ||
9060c89c BJ |
62 | if (cmd == TIOCNOTTY) { |
63 | u.u_ttyp = 0; | |
64 | u.u_ttyd = 0; | |
65 | u.u_procp->p_pgrp = 0; | |
66 | return; | |
67 | } | |
e8743532 | 68 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
69 | u.u_error = ENXIO; |
70 | return; | |
71 | } | |
63c57592 BJ |
72 | (*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag); |
73 | } | |
231ed58b BJ |
74 | |
75 | syselect(dev, flag) | |
76 | { | |
77 | ||
e8743532 | 78 | if (u.u_ttyp == NULL) { |
231ed58b | 79 | u.u_error = ENXIO; |
9060c89c | 80 | return (0); |
231ed58b | 81 | } |
0f8a7bf9 | 82 | return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); |
231ed58b | 83 | } |