70
71 static struct streamtab ttcoinfo;
72
73 static struct fmodsw fsw = {
74 "ttcompat",
75 &ttcoinfo,
76 D_MTQPAIR | D_MP
77 };
78
79 /*
80 * Module linkage information for the kernel.
81 */
82
83 static struct modlstrmod modlstrmod = {
84 &mod_strmodops,
85 "alt ioctl calls",
86 &fsw
87 };
88
89 static struct modlinkage modlinkage = {
90 MODREV_1, &modlstrmod, NULL
91 };
92
93 int
94 _init(void)
95 {
96 return (mod_install(&modlinkage));
97 }
98
99 int
100 _fini(void)
101 {
102 return (mod_remove(&modlinkage));
103 }
104
105 int
106 _info(struct modinfo *modinfop)
107 {
108 return (mod_info(&modlinkage, modinfop));
109 }
110
149 &ttycompatmoinfo
150 };
151
152 static struct streamtab ttcoinfo = {
153 &ttycompatrinit,
154 &ttycompatwinit,
155 NULL,
156 NULL
157 };
158
159 /*
160 * This is the termios structure that is used to reset terminal settings
161 * when the underlying device is an instance of zcons. It came from
162 * cmd/init/init.c and should be kept in-sync with dflt_termios found therein.
163 */
164 static const struct termios base_termios = {
165 BRKINT|ICRNL|IXON|IMAXBEL, /* iflag */
166 OPOST|ONLCR|TAB3, /* oflag */
167 CS8|CREAD|B9600, /* cflag */
168 ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN, /* lflag */
169 CINTR, CQUIT, CERASE, CKILL, CEOF, 0, 0, 0, 0, 0, 0, 0, /* c_cc vals */
170 0, 0, 0, 0, 0, 0, 0
171 };
172
173
174 static void ttcompat_do_ioctl(ttcompat_state_t *, queue_t *, mblk_t *);
175 static void ttcompat_ioctl_ack(queue_t *, mblk_t *);
176 static void ttcopyout(queue_t *, mblk_t *);
177 static void ttcompat_ioctl_nak(queue_t *, mblk_t *);
178 static void from_compat(compat_state_t *, struct termios *);
179 static void to_compat(struct termios *, compat_state_t *);
180
181 /*
182 * Open - get the current modes and translate them to the V7/4BSD equivalent.
183 */
184 /*ARGSUSED*/
185 static int
186 ttcompatopen(queue_t *q, dev_t *devp, int oflag, int sflag, cred_t *crp)
187 {
188 ttcompat_state_t *tp;
189 mblk_t *mp;
190 mblk_t *datamp;
|
70
71 static struct streamtab ttcoinfo;
72
73 static struct fmodsw fsw = {
74 "ttcompat",
75 &ttcoinfo,
76 D_MTQPAIR | D_MP
77 };
78
79 /*
80 * Module linkage information for the kernel.
81 */
82
83 static struct modlstrmod modlstrmod = {
84 &mod_strmodops,
85 "alt ioctl calls",
86 &fsw
87 };
88
89 static struct modlinkage modlinkage = {
90 MODREV_1, { &modlstrmod, NULL }
91 };
92
93 int
94 _init(void)
95 {
96 return (mod_install(&modlinkage));
97 }
98
99 int
100 _fini(void)
101 {
102 return (mod_remove(&modlinkage));
103 }
104
105 int
106 _info(struct modinfo *modinfop)
107 {
108 return (mod_info(&modlinkage, modinfop));
109 }
110
149 &ttycompatmoinfo
150 };
151
152 static struct streamtab ttcoinfo = {
153 &ttycompatrinit,
154 &ttycompatwinit,
155 NULL,
156 NULL
157 };
158
159 /*
160 * This is the termios structure that is used to reset terminal settings
161 * when the underlying device is an instance of zcons. It came from
162 * cmd/init/init.c and should be kept in-sync with dflt_termios found therein.
163 */
164 static const struct termios base_termios = {
165 BRKINT|ICRNL|IXON|IMAXBEL, /* iflag */
166 OPOST|ONLCR|TAB3, /* oflag */
167 CS8|CREAD|B9600, /* cflag */
168 ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN, /* lflag */
169 { CINTR, CQUIT, CERASE, CKILL, CEOF, /* c_cc vals */
170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
171 };
172
173
174 static void ttcompat_do_ioctl(ttcompat_state_t *, queue_t *, mblk_t *);
175 static void ttcompat_ioctl_ack(queue_t *, mblk_t *);
176 static void ttcopyout(queue_t *, mblk_t *);
177 static void ttcompat_ioctl_nak(queue_t *, mblk_t *);
178 static void from_compat(compat_state_t *, struct termios *);
179 static void to_compat(struct termios *, compat_state_t *);
180
181 /*
182 * Open - get the current modes and translate them to the V7/4BSD equivalent.
183 */
184 /*ARGSUSED*/
185 static int
186 ttcompatopen(queue_t *q, dev_t *devp, int oflag, int sflag, cred_t *crp)
187 {
188 ttcompat_state_t *tp;
189 mblk_t *mp;
190 mblk_t *datamp;
|