Commit | Line | Data |
---|---|---|
0f8a7bf9 | 1 | /* tty_tty.c 4.9 82/03/31 */ |
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) | |
35c1dcdb BJ |
51 | dev_t dev; |
52 | int cmd; | |
53 | caddr_t addr; | |
54 | int flag; | |
63c57592 BJ |
55 | { |
56 | ||
9060c89c BJ |
57 | if (cmd == TIOCNOTTY) { |
58 | u.u_ttyp = 0; | |
59 | u.u_ttyd = 0; | |
60 | u.u_procp->p_pgrp = 0; | |
61 | return; | |
62 | } | |
e8743532 | 63 | if (u.u_ttyp == NULL) { |
4460d508 BJ |
64 | u.u_error = ENXIO; |
65 | return; | |
66 | } | |
63c57592 BJ |
67 | (*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag); |
68 | } | |
231ed58b BJ |
69 | |
70 | syselect(dev, flag) | |
71 | { | |
72 | ||
e8743532 | 73 | if (u.u_ttyp == NULL) { |
231ed58b | 74 | u.u_error = ENXIO; |
9060c89c | 75 | return (0); |
231ed58b | 76 | } |
0f8a7bf9 | 77 | return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); |
231ed58b | 78 | } |