Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
2100bbbc | 6 | * @(#)tty_tty.c 7.4 (Berkeley) %G% |
da7c5cc6 | 7 | */ |
63c57592 BJ |
8 | |
9 | /* | |
964bcfb1 | 10 | * Indirect driver for controlling tty. |
231ed58b BJ |
11 | * |
12 | * THIS IS GARBAGE: MUST SOON BE DONE WITH struct inode * IN PROC TABLE. | |
63c57592 | 13 | */ |
94368568 JB |
14 | #include "param.h" |
15 | #include "systm.h" | |
16 | #include "conf.h" | |
94368568 JB |
17 | #include "user.h" |
18 | #include "ioctl.h" | |
19 | #include "tty.h" | |
20 | #include "proc.h" | |
21 | #include "uio.h" | |
63c57592 BJ |
22 | |
23 | /*ARGSUSED*/ | |
24 | syopen(dev, flag) | |
830bbc16 BJ |
25 | dev_t dev; |
26 | int flag; | |
63c57592 BJ |
27 | { |
28 | ||
830bbc16 BJ |
29 | if (u.u_ttyp == NULL) |
30 | return (ENXIO); | |
31 | return ((*cdevsw[major(u.u_ttyd)].d_open)(u.u_ttyd, flag)); | |
63c57592 BJ |
32 | } |
33 | ||
34 | /*ARGSUSED*/ | |
76e0e3c3 | 35 | syread(dev, uio, flag) |
be3a1208 BJ |
36 | dev_t dev; |
37 | struct uio *uio; | |
63c57592 BJ |
38 | { |
39 | ||
840510a3 BJ |
40 | if (u.u_ttyp == NULL) |
41 | return (ENXIO); | |
76e0e3c3 | 42 | return ((*cdevsw[major(u.u_ttyd)].d_read)(u.u_ttyd, uio, flag)); |
63c57592 BJ |
43 | } |
44 | ||
45 | /*ARGSUSED*/ | |
76e0e3c3 | 46 | sywrite(dev, uio, flag) |
be3a1208 BJ |
47 | dev_t dev; |
48 | struct uio *uio; | |
63c57592 BJ |
49 | { |
50 | ||
840510a3 BJ |
51 | if (u.u_ttyp == NULL) |
52 | return (ENXIO); | |
76e0e3c3 | 53 | return ((*cdevsw[major(u.u_ttyd)].d_write)(u.u_ttyd, uio, flag)); |
63c57592 BJ |
54 | } |
55 | ||
56 | /*ARGSUSED*/ | |
57 | syioctl(dev, cmd, addr, flag) | |
35c1dcdb BJ |
58 | dev_t dev; |
59 | int cmd; | |
60 | caddr_t addr; | |
61 | int flag; | |
63c57592 BJ |
62 | { |
63 | ||
9060c89c | 64 | if (cmd == TIOCNOTTY) { |
e39f9ea6 MT |
65 | if (SESS_LEADER(u.u_procp)) { |
66 | /* | |
67 | * XXX - check posix draft | |
68 | */ | |
69 | u.u_ttyp->t_session = 0; | |
70 | u.u_ttyp->t_pgid = 0; | |
71 | } | |
76e0e3c3 MT |
72 | u.u_ttyp = 0; |
73 | u.u_ttyd = 0; | |
830bbc16 | 74 | return (0); |
4460d508 | 75 | } |
830bbc16 BJ |
76 | if (u.u_ttyp == NULL) |
77 | return (ENXIO); | |
78 | return ((*cdevsw[major(u.u_ttyd)].d_ioctl)(u.u_ttyd, cmd, addr, flag)); | |
63c57592 | 79 | } |
231ed58b | 80 | |
a8d3bf7f | 81 | /*ARGSUSED*/ |
231ed58b | 82 | syselect(dev, flag) |
a8d3bf7f BJ |
83 | dev_t dev; |
84 | int flag; | |
231ed58b BJ |
85 | { |
86 | ||
e8743532 | 87 | if (u.u_ttyp == NULL) { |
231ed58b | 88 | u.u_error = ENXIO; |
9060c89c | 89 | return (0); |
231ed58b | 90 | } |
0f8a7bf9 | 91 | return ((*cdevsw[major(u.u_ttyd)].d_select)(u.u_ttyd, flag)); |
231ed58b | 92 | } |