Commit | Line | Data |
---|---|---|
840510a3 | 1 | /* tty_tty.c 4.11 82/10/13 */ |
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 | ||
840510a3 BJ |
34 | if (u.u_ttyp == NULL) |
35 | return (ENXIO); | |
36 | return ((*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd, uio)); | |
63c57592 BJ |
37 | } |
38 | ||
39 | /*ARGSUSED*/ | |
be3a1208 BJ |
40 | sywrite(dev, uio) |
41 | dev_t dev; | |
42 | struct uio *uio; | |
63c57592 BJ |
43 | { |
44 | ||
840510a3 BJ |
45 | if (u.u_ttyp == NULL) |
46 | return (ENXIO); | |
47 | return ((*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd, uio)); | |
63c57592 BJ |
48 | } |
49 | ||
50 | /*ARGSUSED*/ | |
51 | syioctl(dev, cmd, addr, flag) | |
35c1dcdb BJ |
52 | dev_t dev; |
53 | int cmd; | |
54 | caddr_t addr; | |
55 | int flag; | |
63c57592 BJ |
56 | { |
57 | ||
9060c89c BJ |
58 | if (cmd == TIOCNOTTY) { |
59 | u.u_ttyp = 0; | |
60 | u.u_ttyd = 0; | |
61 | u.u_procp->p_pgrp = 0; | |
62 | return; | |
63 | } | |
e8743532 | 64 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
65 | u.u_error = ENXIO; |
66 | return; | |
67 | } | |
63c57592 BJ |
68 | (*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag); |
69 | } | |
231ed58b BJ |
70 | |
71 | syselect(dev, flag) | |
72 | { | |
73 | ||
e8743532 | 74 | if (u.u_ttyp == NULL) { |
231ed58b | 75 | u.u_error = ENXIO; |
9060c89c | 76 | return (0); |
231ed58b | 77 | } |
0f8a7bf9 | 78 | return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); |
231ed58b | 79 | } |