1 /* $NetBSD: svr4_termios.c,v 1.26 2008/03/21 21:54:59 ad Exp $ */
4 * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: svr4_termios.c,v 1.26 2008/03/21 21:54:59 ad Exp $");
35 #include <sys/param.h>
37 #include <sys/systm.h>
39 #include <sys/filedesc.h>
40 #include <sys/ioctl.h>
41 #include <sys/termios.h>
43 #include <sys/socket.h>
44 #include <sys/mount.h>
46 #include <sys/malloc.h>
48 #include <sys/syscallargs.h>
50 #include <compat/svr4/svr4_types.h>
51 #include <compat/svr4/svr4_util.h>
52 #include <compat/svr4/svr4_signal.h>
53 #include <compat/svr4/svr4_ioctl.h>
54 #include <compat/svr4/svr4_lwp.h>
55 #include <compat/svr4/svr4_ucontext.h>
56 #include <compat/svr4/svr4_syscallargs.h>
57 #include <compat/svr4/svr4_stropts.h>
58 #include <compat/svr4/svr4_termios.h>
63 # define __CONCAT3(a,b,c) a ## b ## c
65 # define __CONCAT3(a,b,c) a/**/b/**/c
69 static u_long
bsd_to_svr4_speed(u_long
, u_long
);
70 static u_long
svr4_to_bsd_speed(u_long
, u_long
);
71 static void svr4_to_bsd_termios(const struct svr4_termios
*,
72 struct termios
*, int);
73 static void bsd_to_svr4_termios(const struct termios
*,
74 struct svr4_termios
*);
75 static void svr4_termio_to_termios(const struct svr4_termio
*,
76 struct svr4_termios
*);
77 static void svr4_termios_to_termio(const struct svr4_termios
*,
78 struct svr4_termio
*);
80 static void print_svr4_termios(const struct svr4_termios
*);
81 static void print_bsd_termios(const struct termios
*);
82 #endif /* DEBUG_SVR4 */
84 #define undefined_char(a,b) /**/
85 #define undefined_flag1(f,a,b) /**/
86 #define undefined_flag2(f,a,b,c1,t1,c2,t2) /**/
87 #define undefined_flag4(f,a,b,c1,t1,c2,t2,c3,t3,c4,t4) /**/
89 #define svr4_to_bsd_char(a,b) \
90 if (new || __CONCAT3(SVR4_,a,b) < SVR4_NCC) { \
91 if (st->c_cc[__CONCAT3(SVR4_,a,b)] == SVR4_POSIX_VDISABLE) \
92 bt->c_cc[__CONCAT(a,b)] = _POSIX_VDISABLE; \
94 bt->c_cc[__CONCAT(a,b)] = st->c_cc[__CONCAT3(SVR4_,a,b)]; \
97 #define svr4_to_bsd_flag1(f,a,b) \
98 if (new || __CONCAT3(SVR4_,a,b) < 0200000) { \
99 if (st->f & __CONCAT3(SVR4_,a,b)) \
100 bt->f |= __CONCAT(a,b); \
102 bt->f &= ~__CONCAT(a,b); \
105 #define svr4_to_bsd_flag2(f,a,b,c1,t1,c2,t2) \
106 if (new || __CONCAT3(SVR4_,a,b) < 0200000) { \
107 bt->f &= ~__CONCAT(a,b); \
108 switch (st->f & __CONCAT3(SVR4_,a,b)) { \
109 case __CONCAT3(SVR4_,c1,t1): bt->f |= __CONCAT(c1,t1); break; \
110 case __CONCAT3(SVR4_,c2,t2): bt->f |= __CONCAT(c2,t2); break; \
114 #define svr4_to_bsd_flag4(f,a,b,c1,t1,c2,t2,c3,t3,c4,t4) \
115 if (new || __CONCAT3(SVR4_,a,b) < 0200000) { \
116 bt->f &= ~__CONCAT(a,b); \
117 switch (st->f & __CONCAT3(SVR4_,a,b)) { \
118 case __CONCAT3(SVR4_,c1,t1): bt->f |= __CONCAT(c1,t1); break; \
119 case __CONCAT3(SVR4_,c2,t2): bt->f |= __CONCAT(c2,t2); break; \
120 case __CONCAT3(SVR4_,c3,t3): bt->f |= __CONCAT(c3,t3); break; \
121 case __CONCAT3(SVR4_,c4,t4): bt->f |= __CONCAT(c4,t4); break; \
126 #define bsd_to_svr4_char(a,b) \
127 if (bt->c_cc[__CONCAT(a,b)] == _POSIX_VDISABLE) \
128 st->c_cc[__CONCAT3(SVR4_,a,b)] = SVR4_POSIX_VDISABLE; \
130 st->c_cc[__CONCAT3(SVR4_,a,b)] = bt->c_cc[__CONCAT(a,b)]
132 #define bsd_to_svr4_flag1(f,a,b) \
133 if (bt->f & __CONCAT(a,b)) \
134 st->f |= __CONCAT3(SVR4_,a,b); \
136 st->f &= ~__CONCAT3(SVR4_,a,b)
138 #define bsd_to_svr4_flag2(f,a,b,c1,t1,c2,t2) \
139 st->f &= ~__CONCAT(a,b); \
140 switch (bt->f & __CONCAT(a,b)) { \
141 case __CONCAT(c1,t1): st->f |= __CONCAT3(SVR4_,c1,t1); break; \
142 case __CONCAT(c2,t2): st->f |= __CONCAT3(SVR4_,c2,t2); break; \
145 #define bsd_to_svr4_flag4(f,a,b,c1,t1,c2,t2,c3,t3,c4,t4) \
146 st->f &= ~__CONCAT(a,b); \
147 switch (bt->f & __CONCAT(a,b)) { \
148 case __CONCAT(c1,t1): st->f |= __CONCAT3(SVR4_,c1,t1); break; \
149 case __CONCAT(c2,t2): st->f |= __CONCAT3(SVR4_,c2,t2); break; \
150 case __CONCAT(c3,t3): st->f |= __CONCAT3(SVR4_,c3,t3); break; \
151 case __CONCAT(c4,t4): st->f |= __CONCAT3(SVR4_,c4,t4); break; \
156 print_svr4_termios(const struct svr4_termios
*st
)
159 uprintf("SVR4\niflag=%lo oflag=%lo cflag=%lo lflag=%lo\n",
160 st
->c_iflag
, st
->c_oflag
, st
->c_cflag
, st
->c_lflag
);
162 for (i
= 0; i
< SVR4_NCCS
; i
++)
163 uprintf("%o ", st
->c_cc
[i
]);
169 print_bsd_termios(const struct termios
*bt
)
172 uprintf("BSD\niflag=%o oflag=%o cflag=%o lflag=%o\n",
173 bt
->c_iflag
, bt
->c_oflag
, bt
->c_cflag
, bt
->c_lflag
);
175 for (i
= 0; i
< NCCS
; i
++)
176 uprintf("%o ", bt
->c_cc
[i
]);
179 #endif /* DEBUG_SVR4 */
182 bsd_to_svr4_speed(u_long sp
, u_long mask
)
186 #define getval(a,b) case __CONCAT(a,b): sp = __CONCAT3(SVR4_,a,b)
205 default: sp
= SVR4_B9600
; /* XXX */
208 while ((mask
& 1) == 0) {
218 svr4_to_bsd_speed(u_long sp
, u_long mask
)
220 while ((mask
& 1) == 0) {
227 #define getval(a,b) case __CONCAT3(SVR4_,a,b): return __CONCAT(a,b)
246 default: return B9600
; /* XXX */
252 svr4_to_bsd_termios(const struct svr4_termios
*st
, struct termios
*bt
, int new)
254 /* control characters */
256 * We process VMIN and VTIME first,
257 * because they are shared with VEOF and VEOL
259 svr4_to_bsd_char(V
,MIN
);
260 svr4_to_bsd_char(V
,TIME
);
262 svr4_to_bsd_char(V
,INTR
);
263 svr4_to_bsd_char(V
,QUIT
);
264 svr4_to_bsd_char(V
,ERASE
);
265 svr4_to_bsd_char(V
,KILL
);
266 svr4_to_bsd_char(V
,EOF
);
267 svr4_to_bsd_char(V
,EOL
);
268 svr4_to_bsd_char(V
,EOL2
);
269 undefined_char(V
,SWTCH
);
270 svr4_to_bsd_char(V
,START
);
271 svr4_to_bsd_char(V
,STOP
);
272 svr4_to_bsd_char(V
,SUSP
);
273 svr4_to_bsd_char(V
,DSUSP
);
274 svr4_to_bsd_char(V
,REPRINT
);
275 svr4_to_bsd_char(V
,DISCARD
);
276 svr4_to_bsd_char(V
,WERASE
);
277 svr4_to_bsd_char(V
,LNEXT
);
280 svr4_to_bsd_flag1(c_iflag
,I
,GNBRK
);
281 svr4_to_bsd_flag1(c_iflag
,B
,RKINT
);
282 svr4_to_bsd_flag1(c_iflag
,I
,GNPAR
);
283 svr4_to_bsd_flag1(c_iflag
,P
,ARMRK
);
284 svr4_to_bsd_flag1(c_iflag
,I
,NPCK
);
285 svr4_to_bsd_flag1(c_iflag
,I
,STRIP
);
286 svr4_to_bsd_flag1(c_iflag
,I
,NLCR
);
287 svr4_to_bsd_flag1(c_iflag
,I
,GNCR
);
288 svr4_to_bsd_flag1(c_iflag
,I
,CRNL
);
289 undefined_flag1(c_iflag
,I
,UCLC
);
290 svr4_to_bsd_flag1(c_iflag
,I
,XON
);
291 svr4_to_bsd_flag1(c_iflag
,I
,XANY
);
292 svr4_to_bsd_flag1(c_iflag
,I
,XOFF
);
293 svr4_to_bsd_flag1(c_iflag
,I
,MAXBEL
);
294 undefined_flag1(c_iflag
,D
,OSMODE
);
297 svr4_to_bsd_flag1(c_oflag
,O
,POST
);
298 undefined_flag1(c_oflag
,O
,LCUC
);
299 svr4_to_bsd_flag1(c_oflag
,O
,NLCR
);
300 undefined_flag1(c_oflag
,O
,CRNL
);
301 undefined_flag1(c_oflag
,O
,NOCR
);
302 undefined_flag1(c_oflag
,O
,NLRET
);
303 undefined_flag1(c_oflag
,O
,FILL
);
304 undefined_flag1(c_oflag
,O
,FDEL
);
305 undefined_flag2(c_oflag
,N
,LDLY
,N
,L0
,N
,L1
);
306 undefined_flag4(c_oflag
,C
,RDLY
,C
,R0
,C
,R1
,C
,R2
,C
,R3
);
307 undefined_flag4(c_oflag
,T
,ABDLY
,T
,AB0
,T
,AB1
,T
,AB2
,T
,AB3
);
308 undefined_flag2(c_oflag
,B
,SDLY
,B
,S0
,B
,S1
);
309 undefined_flag2(c_oflag
,V
,TDLY
,V
,T0
,V
,T1
);
310 undefined_flag2(c_oflag
,F
,FDLY
,F
,F0
,F
,F1
);
311 undefined_flag1(c_oflag
,P
,AGEOUT
);
312 undefined_flag1(c_oflag
,W
,RAP
);
315 bt
->c_ospeed
= svr4_to_bsd_speed(st
->c_cflag
, SVR4_CBAUD
);
316 svr4_to_bsd_flag4(c_cflag
,C
,SIZE
,C
,S5
,C
,S6
,C
,S7
,C
,S8
)
317 svr4_to_bsd_flag1(c_cflag
,C
,STOPB
);
318 svr4_to_bsd_flag1(c_cflag
,C
,READ
);
319 svr4_to_bsd_flag1(c_cflag
,P
,ARENB
);
320 svr4_to_bsd_flag1(c_cflag
,P
,ARODD
);
321 svr4_to_bsd_flag1(c_cflag
,H
,UPCL
);
322 svr4_to_bsd_flag1(c_cflag
,C
,LOCAL
);
323 undefined_flag1(c_cflag
,R
,CV1EN
);
324 undefined_flag1(c_cflag
,X
,MT1EN
);
325 undefined_flag1(c_cflag
,L
,OBLK
);
326 undefined_flag1(c_cflag
,X
,CLUDE
);
327 bt
->c_ispeed
= svr4_to_bsd_speed(st
->c_cflag
, SVR4_CIBAUD
);
328 undefined_flag1(c_cflag
,P
,AREXT
);
330 /* line discipline modes */
331 svr4_to_bsd_flag1(c_lflag
,I
,SIG
);
332 svr4_to_bsd_flag1(c_lflag
,I
,CANON
);
333 undefined_flag1(c_lflag
,X
,CASE
);
334 svr4_to_bsd_flag1(c_lflag
,E
,CHO
);
335 svr4_to_bsd_flag1(c_lflag
,E
,CHOE
);
336 svr4_to_bsd_flag1(c_lflag
,E
,CHOK
);
337 svr4_to_bsd_flag1(c_lflag
,E
,CHONL
);
338 svr4_to_bsd_flag1(c_lflag
,N
,OFLSH
);
339 svr4_to_bsd_flag1(c_lflag
,T
,OSTOP
);
340 svr4_to_bsd_flag1(c_lflag
,E
,CHOCTL
);
341 svr4_to_bsd_flag1(c_lflag
,E
,CHOPRT
);
342 svr4_to_bsd_flag1(c_lflag
,E
,CHOKE
);
343 undefined_flag1(c_lflag
,D
,EFECHO
);
344 svr4_to_bsd_flag1(c_lflag
,F
,LUSHO
);
345 svr4_to_bsd_flag1(c_lflag
,P
,ENDIN
);
346 svr4_to_bsd_flag1(c_lflag
,I
,EXTEN
);
351 bsd_to_svr4_termios(const struct termios
*bt
, struct svr4_termios
*st
)
353 /* control characters */
355 * We process VMIN and VTIME first,
356 * because they are shared with VEOF and VEOL
358 bsd_to_svr4_char(V
,MIN
);
359 bsd_to_svr4_char(V
,TIME
);
360 bsd_to_svr4_char(V
,INTR
);
361 bsd_to_svr4_char(V
,QUIT
);
362 bsd_to_svr4_char(V
,ERASE
);
363 bsd_to_svr4_char(V
,KILL
);
364 bsd_to_svr4_char(V
,EOF
);
365 bsd_to_svr4_char(V
,EOL
);
366 bsd_to_svr4_char(V
,EOL2
);
367 undefined_char(V
,SWTCH
);
368 bsd_to_svr4_char(V
,START
);
369 bsd_to_svr4_char(V
,STOP
);
370 bsd_to_svr4_char(V
,SUSP
);
371 bsd_to_svr4_char(V
,DSUSP
);
372 bsd_to_svr4_char(V
,REPRINT
);
373 bsd_to_svr4_char(V
,DISCARD
);
374 bsd_to_svr4_char(V
,WERASE
);
375 bsd_to_svr4_char(V
,LNEXT
);
378 bsd_to_svr4_flag1(c_iflag
,I
,GNBRK
);
379 bsd_to_svr4_flag1(c_iflag
,B
,RKINT
);
380 bsd_to_svr4_flag1(c_iflag
,I
,GNPAR
);
381 bsd_to_svr4_flag1(c_iflag
,P
,ARMRK
);
382 bsd_to_svr4_flag1(c_iflag
,I
,NPCK
);
383 bsd_to_svr4_flag1(c_iflag
,I
,STRIP
);
384 bsd_to_svr4_flag1(c_iflag
,I
,NLCR
);
385 bsd_to_svr4_flag1(c_iflag
,I
,GNCR
);
386 bsd_to_svr4_flag1(c_iflag
,I
,CRNL
);
387 undefined_flag1(c_iflag
,I
,UCLC
);
388 bsd_to_svr4_flag1(c_iflag
,I
,XON
);
389 bsd_to_svr4_flag1(c_iflag
,I
,XANY
);
390 bsd_to_svr4_flag1(c_iflag
,I
,XOFF
);
391 bsd_to_svr4_flag1(c_iflag
,I
,MAXBEL
);
392 undefined_flag1(c_iflag
,D
,OSMODE
);
395 bsd_to_svr4_flag1(c_oflag
,O
,POST
);
396 undefined_flag1(c_oflag
,O
,LCUC
);
397 bsd_to_svr4_flag1(c_oflag
,O
,NLCR
);
398 undefined_flag1(c_oflag
,O
,CRNL
);
399 undefined_flag1(c_oflag
,O
,NOCR
);
400 undefined_flag1(c_oflag
,O
,NLRET
);
401 undefined_flag1(c_oflag
,O
,FILL
);
402 undefined_flag1(c_oflag
,O
,FDEL
);
403 undefined_flag2(c_oflag
,N
,LDLY
,N
,L0
,N
,L1
);
404 undefined_flag4(c_oflag
,C
,RDLY
,C
,R0
,C
,R1
,C
,R2
,C
,R3
);
405 undefined_flag4(c_oflag
,T
,ABDLY
,T
,AB0
,T
,AB1
,T
,AB2
,T
,AB3
);
406 undefined_flag2(c_oflag
,B
,SDLY
,B
,S0
,B
,S1
);
407 undefined_flag2(c_oflag
,V
,TDLY
,V
,T0
,V
,T1
);
408 undefined_flag2(c_oflag
,F
,FDLY
,F
,F0
,F
,F1
);
409 undefined_flag1(c_oflag
,P
,AGEOUT
);
410 undefined_flag1(c_oflag
,W
,RAP
);
413 st
->c_cflag
&= ~SVR4_CBAUD
;
414 st
->c_cflag
|= bsd_to_svr4_speed(bt
->c_ospeed
, SVR4_CBAUD
);
415 bsd_to_svr4_flag4(c_cflag
,C
,SIZE
,C
,S5
,C
,S6
,C
,S7
,C
,S8
)
416 bsd_to_svr4_flag1(c_cflag
,C
,STOPB
);
417 bsd_to_svr4_flag1(c_cflag
,C
,READ
);
418 bsd_to_svr4_flag1(c_cflag
,P
,ARENB
);
419 bsd_to_svr4_flag1(c_cflag
,P
,ARODD
);
420 bsd_to_svr4_flag1(c_cflag
,H
,UPCL
);
421 bsd_to_svr4_flag1(c_cflag
,C
,LOCAL
);
422 undefined_flag1(c_cflag
,R
,CV1EN
);
423 undefined_flag1(c_cflag
,X
,MT1EN
);
424 undefined_flag1(c_cflag
,L
,OBLK
);
425 undefined_flag1(c_cflag
,X
,CLUDE
);
426 st
->c_cflag
&= ~SVR4_CIBAUD
;
427 st
->c_cflag
|= bsd_to_svr4_speed(bt
->c_ispeed
, SVR4_CIBAUD
);
429 undefined_flag1(c_oflag
,P
,AREXT
);
431 /* line discipline modes */
432 bsd_to_svr4_flag1(c_lflag
,I
,SIG
);
433 bsd_to_svr4_flag1(c_lflag
,I
,CANON
);
434 undefined_flag1(c_lflag
,X
,CASE
);
435 bsd_to_svr4_flag1(c_lflag
,E
,CHO
);
436 bsd_to_svr4_flag1(c_lflag
,E
,CHOE
);
437 bsd_to_svr4_flag1(c_lflag
,E
,CHOK
);
438 bsd_to_svr4_flag1(c_lflag
,E
,CHONL
);
439 bsd_to_svr4_flag1(c_lflag
,N
,OFLSH
);
440 bsd_to_svr4_flag1(c_lflag
,T
,OSTOP
);
441 bsd_to_svr4_flag1(c_lflag
,E
,CHOCTL
);
442 bsd_to_svr4_flag1(c_lflag
,E
,CHOPRT
);
443 bsd_to_svr4_flag1(c_lflag
,E
,CHOKE
);
444 undefined_flag1(c_lflag
,D
,EFECHO
);
445 bsd_to_svr4_flag1(c_lflag
,F
,LUSHO
);
446 bsd_to_svr4_flag1(c_lflag
,P
,ENDIN
);
447 bsd_to_svr4_flag1(c_lflag
,I
,EXTEN
);
452 svr4_termio_to_termios(const struct svr4_termio
*t
, struct svr4_termios
*ts
)
456 ts
->c_iflag
= (svr4_tcflag_t
) t
->c_iflag
;
457 ts
->c_oflag
= (svr4_tcflag_t
) t
->c_oflag
;
458 ts
->c_cflag
= (svr4_tcflag_t
) t
->c_cflag
;
459 ts
->c_lflag
= (svr4_tcflag_t
) t
->c_lflag
;
461 for (i
= 0; i
< SVR4_NCC
; i
++)
462 ts
->c_cc
[i
] = (svr4_cc_t
) t
->c_cc
[i
];
467 svr4_termios_to_termio(const struct svr4_termios
*ts
, struct svr4_termio
*t
)
471 t
->c_iflag
= (u_short
) ts
->c_iflag
;
472 t
->c_oflag
= (u_short
) ts
->c_oflag
;
473 t
->c_cflag
= (u_short
) ts
->c_cflag
;
474 t
->c_lflag
= (u_short
) ts
->c_lflag
;
475 t
->c_line
= 0; /* XXX */
477 for (i
= 0; i
< SVR4_NCC
; i
++)
478 t
->c_cc
[i
] = (u_char
) ts
->c_cc
[i
];
482 svr4_term_ioctl(file_t
*fp
, struct lwp
*l
, register_t
*retval
, int fd
, u_long cmd
, void *data
)
485 struct svr4_termios st
;
486 struct svr4_termio t
;
488 int (*ctl
)(file_t
*, u_long
, void *) = fp
->f_ops
->fo_ioctl
;
495 if ((error
= (*ctl
)(fp
, TIOCGETA
, &bt
)) != 0)
498 memset(&st
, 0, sizeof(st
));
499 bsd_to_svr4_termios(&bt
, &st
);
501 DPRINTF(("ioctl(TCGET%c);\n", cmd
== SVR4_TCGETA
? 'A' : 'S'));
503 print_bsd_termios(&bt
);
504 print_svr4_termios(&st
);
505 #endif /* DEBUG_SVR4 */
507 if (cmd
== SVR4_TCGETA
) {
508 svr4_termios_to_termio(&st
, &t
);
509 return copyout(&t
, data
, sizeof(t
));
512 return copyout(&st
, data
, sizeof(st
));
521 /* get full BSD termios so we don't lose information */
522 if ((error
= (*ctl
)(fp
, TIOCGETA
, &bt
)) != 0)
529 if ((error
= copyin(data
, &st
, sizeof(st
))) != 0)
537 if ((error
= copyin(data
, &t
, sizeof(t
))) != 0)
540 svr4_termio_to_termios(&t
, &st
);
548 svr4_to_bsd_termios(&st
, &bt
, new);
553 DPRINTF(("ioctl(TCSET[A|S]);\n"));
558 DPRINTF(("ioctl(TCSET[A|S]W);\n"));
563 DPRINTF(("ioctl(TCSET[A|S]F);\n"));
569 print_bsd_termios(&bt
);
570 print_svr4_termios(&st
);
571 #endif /* DEBUG_SVR4 */
573 return (*ctl
)(fp
, cmd
, &bt
);
575 case SVR4_TIOCGWINSZ
:
577 struct svr4_winsize ws
;
579 error
= (*ctl
)(fp
, TIOCGWINSZ
, &ws
);
582 return copyout(&ws
, data
, sizeof(ws
));
585 case SVR4_TIOCSWINSZ
:
587 struct svr4_winsize ws
;
589 if ((error
= copyin(data
, &ws
, sizeof(ws
))) != 0)
591 return (*ctl
)(fp
, TIOCSWINSZ
, &ws
);
595 return svr4_stream_ti_ioctl(fp
, l
, retval
, fd
, cmd
, data
);