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