summaryrefslogtreecommitdiff
path: root/usr/src/man/man4m/ttcompat.4m
blob: 339d1844520e2ec960ee1cd83f438e5b6e36e912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
'\" te
.\" Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved.
.\" Copyright 2001 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH TTCOMPAT 4M "Oct 2, 2001"
.SH NAME
ttcompat \- V7, 4BSD and XENIX STREAMS compatibility module
.SH SYNOPSIS
.LP
.nf
#define BSD_COMP
#include <sys/stropts.h>
#include <sys/ioctl.h>
ioctl(\fIfd\fR, I_PUSH, "ttcompat");
.fi

.SH DESCRIPTION
.sp
.LP
\fBttcompat\fR is a STREAMS module that translates the \fBioctl\fR calls
supported by the older \fBVersion\fR \fB7,\fR \fB4BSD,\fR and \fBXENIX\fR
terminal drivers into the \fBioctl\fR calls supported by the \fBtermio\fR
interface (see \fBtermio\fR(4I)). All other messages pass through this module
unchanged; the behavior of \fBread\fR and \fBwrite\fR calls is unchanged, as is
the behavior of \fBioctl\fR calls other than the ones supported by
\fBttcompat\fR.
.sp
.LP
This module can be automatically pushed onto a stream using the \fBautopush\fR
mechanism when a terminal device is opened; it does not have to be explicitly
pushed onto a stream. This module requires that the \fBtermios\fR interface be
supported by the modules and the application can push the driver downstream.
The \fBTCGETS,\fR \fBTCSETS,\fR and \fBTCSETSF\fR \fBioctl\fR calls must be
supported. If any information set or fetched by those \fBioctl\fR calls is not
supported by the modules and driver downstream, some of the \fBV7/4BSD/XENIX\fR
functions may not be supported. For example, if the \fBCBAUD\fR bits in the
\fBc_cflag\fR field are not supported, the functions provided by the
\fBsg_ispeed\fR and \fBsg_ospeed\fR fields of the \fBsgttyb\fR structure (see
below) will not be supported. If the \fBTCFLSH\fR \fBioctl\fR is not supported,
the function provided by the \fBTIOCFLUSH\fR \fBioctl\fR will not be supported.
If the \fBTCXONC\fR \fBioctl\fR is not supported, the functions provided by the
\fBTIOCSTOP\fR and \fBTIOCSTART\fR \fBioctl\fR calls will not be supported. If
the \fBTIOCMBIS\fR and \fBTIOCMBIC\fR \fBioctl\fR calls are not supported, the
functions provided by the \fBTIOCSDTR\fR and \fBTIOCCDTR\fR \fBioctl\fR calls
will not be supported.
.sp
.LP
The basic \fBioctl\fR calls use the \fBsgttyb\fR structure defined by
<\fBsys/ttold.h\fR> (included by <\fBsys/ioctl.h\fR>):
.sp
.in +2
.nf
struct   sgttyb   {
	char	sg_ispeed;
	char	sg_ospeed;
	char	sg_erase;
	char	sg_kill;
	int	sg_flags;
};
.fi
.in -2

.sp
.LP
The \fBsg_ispeed\fR and \fBsg_ospeed\fR fields describe the  input and output
speeds of the device.  If the speed set on the device is  over B38400,  then it
is reported as B38400 for compatibility reasons. If it is set to B38400 and
the current speed is over B38400, the change is ignored. See TIOCGETP and
TIOCSETP below. The \fBsg_erase\fR and \fBsg_kill fields\fR of the argument
structure specify the erase and kill characters respectively, and reflect the
values in the VERASE and VKILL members of the \fBc_cc field\fR of the
\fBtermios\fR structure.
.sp
.LP
The \fBsg_flags\fR field of the argument structure contains several flags that
determine the system's treatment of the terminal. They are mapped into flags in
fields of the terminal state, represented by the \fBtermios\fR structure.
.sp
.LP
Delay type \fB0\fR (NL0,  TAB0, CR0, FF0,  BS0) is  always mapped into the
equivalent delay type \fB0\fR in the \fBc_oflag\fR field of the \fBtermios\fR
structure. Other delay  mappings are  performed as follows:
.sp

.sp
.TS
box;
c | c
l | l .
sg_flags	c_oflag
_
BS1	BS1
_
FF1	VT1
_
CR1	CR2
_
CR2	CR3
_
CR3	CR0 (not supported)
_
TAB1	TAB1
_
TAB2	TAB2
_
XTABS	TAB3
_
NL1	ONLRET|CR1
_
NL2	NL1
_
NL3	NL0 (not supported)
.TE

.sp
.LP
If previous \fBTIOCLSET\fR or \fBTIOCLBIS\fR \fBioctl\fR calls have not
selected \fBLITOUT\fR or \fBPASS8\fR mode, and if \fBRAW\fR mode is not
selected, the \fBISTRIP\fR flag is set in the \fBc_iflag\fR field of the
\fBtermios\fR structure, and the \fBEVENP\fR and \fBODDP\fR flags control the
parity of characters sent to the terminal and accepted from the terminal, as
follows:
.sp
.ne 2
.na
\fB0 (neither EVENP nor ODDP)\fR
.ad
.RS 30n
Parity is not to be generated on output or checked on input. The  character
size is set to \fBCS8\fR and the \fBPARENB\fR flag is cleared in the
\fBc_cflag\fR field of the \fBtermios\fR structure.
.RE

.sp
.ne 2
.na
\fBEVENP\fR
.ad
.RS 30n
Even parity characters are to be generated on output and accepted on input. The
INPCK  flag is set in the \fBc_iflag\fR field of the \fBtermios\fR structure,
the character size is set to \fBCS7\fR and the \fBPARENB\fR flag is set in the
\fBc_iflag\fR field of the \fBtermios\fR structure.
.RE

.sp
.ne 2
.na
\fBODDP\fR
.ad
.RS 30n
Odd parity characters are to be generated on output and accepted on input. The
\fBINPCK\fR flag is set in the \fBc_iflag\fR, the character size is set to
\fBCS7\fR and the \fBPARENB\fR and \fBPARODD\fR flags are set in the
\fBc_iflag\fR field  of the \fBtermios\fR structure.
.RE

.sp
.ne 2
.na
\fBEVENP|ODDP or ANYP\fR
.ad
.RS 30n
Even parity  characters are to be generated  on output and characters of
either parity are to be  accepted on input. The \fBINPCK\fR flag is cleared in
the \fBc_iflag\fR field, the character size is set to \fBCS7\fR and the
\fBPARENB\fR flag is set in the \fBc_iflag\fR field of the \fBtermios\fR
structure.
.RE

.sp
.LP
The \fBRAW\fR flag disables all output processing (the \fBOPOST\fR flag in the
\fBc_oflag\fR field, and the \fBXCASE\fR and \fBIEXTEN\fR flags in the
\fBc_iflag\fR field are cleared in the termios structure) and input processing
(all flags  in the \fBc_iflag\fR field other than the \fBIXOFF\fR and
\fBIXANY\fR flags  are cleared  in the \fBtermios\fR structure).  Eight bits of
data, with no parity bit are accepted on input and generated on output; the
character size is set to \fBCS8\fR and the \fBPARENB\fR and \fBPARODD\fR flags
are cleared in the \fBc_cflag\fR field of the \fBtermios\fR structure. The
signal-generating and line-editing control characters are disabled by clearing
the \fBISIG\fR and \fBICANON\fR flags in the \fBc_iflag\fR field of the termios
structure.
.sp
.LP
The \fBCRMOD\fR flag turns input carriage return characters into linefeed
characters, and output linefeed characters to be sent as a carriage return
followed by a linefeed. The \fBICRNL\fR flag in the \fBc_iflag\fR field, and
the \fBOPOST\fR and \fBONLCR\fR flags in the \fBc_oflag field\fR, are set in
the termios structure.
.sp
.LP
The \fBLCASE\fR flag maps upper-case letters in the \fBASCII\fR character set
to their lower-case equivalents on input (the \fBIUCLC\fR flag is set in the
\fBc_iflag\fR field), and maps lower-case letters in the \fBASCII\fR character
set to their upper-case equivalents on output (the \fBOLCUC\fR flag is set in
the \fBc_oflag\fR field). Escape sequences are accepted on input, and generated
on output, to handle certain \fBASCII\fR characters not supported by older
terminals (the \fBXCASE\fR flag is set in the \fBc_lflag\fR field).
.sp
.LP
Other flags are directly mapped to flags in the \fBtermios\fR structure:
.sp

.sp
.TS
box;
c | c
l | l .
sg_flags	Flags in termios structure
_
CBREAK	Complement of ICANON in c_lflag field
_
ECHO	ECHO in c_lflag field
_
TANDEM	IXOFF in c_iflag field
.TE

.sp
.LP
Another structure associated with each terminal specifies characters that are
special in both the old Version 7 and the newer \fB4BSD\fR terminal interfaces.
The following structure is defined by \fB<sys/ttold.h>\fR:
.sp
.in +2
.nf
struct   tchars   {
          char t_intrc;     /* interrupt */
          char t_quitc;     /* quit */
          char t_startc; /* start output */
          char t_stopc;     /* stop output */
          char t_eofc;        /* end-of-file */
          char t_brkc;        /* input delimiter (like nl) */
     };
.fi
.in -2

.sp
.LP
\fBXENIX\fR defines the  \fBtchar\fR structure as  \fBtc\fR. The characters are
mapped to members of the \fBc_cc\fR field of the \fBtermios\fR structure as
follows:
.sp
.in +2
.nf
       tchars                c_cc index
       t_intrc               VINTR
       t_quitc               VQUIT
       t_startc              VSTART
       t_stopc               VSTOP
       t_eofc                VEOF
       t_brkc                VEOL
.fi
.in -2

.sp
.LP
Also associated with each terminal is a local flag word (\fBTIOCLSET\fR and
\fBTIOCLGET\fR), specifying flags  supported by the new 4BSD terminal
interface. Most of these flags are directly mapped to flags in the
\fBtermios\fR structure:
.sp

.sp
.TS
box;
c | c
l | l .
Local flags	Flags in termios structure
_
LCRTBS	Not supported
_
LPRTERA	ECHOPRT in the c_lflag field
_
LCRTERA	ECHOE in the c_lflag field
_
LTILDE	Not supported
_
LMDMBUF	Not supported
_
LTOSTOP	TOSTOP in the c_lflag field
_
LFLUSHO	FLUSHO in the c_lflag field
_
LNOHANG	CLOCAL in the c_cflag field
_
LCRTKIL	ECHOKE in the c_lflag field
_
LPASS8	CS8 in the c_cflag field
_
LCTLECH	CTLECH in the c_lflag field
_
LPENDIN	PENDIN in the c_lflag field
_
LDECCTQ	Complement of IXANY in the c_iflag field
_
LNOFLSH	NOFLSH in the c_lflag field
.TE

.sp
.LP
Each flag has a corresponding equivalent \fBsg_flags\fR value. The
\fBsg_flags\fR definitions omit the leading "L"; for example, TIOCSETP with
\fBsg_flags\fR set to TOSTOP is equivalent to TIOCLSET with LTOSTOP.
.sp
.LP
Another structure associated with each terminal is the \fBltchars\fR structure
which defines control characters for the new \fB4BSD\fR terminal interface. Its
structure is:
.sp
.in +2
.nf
struct ltchars {
   char t_suspc;  /* stop process signal */
   char t_dsuspc; /* delayed stop process signal */
   char t_rprntc; /* reprint line */
   char t_flushc; /*flush output (toggles) */
   char t_werasc; /* word erase */
   char t_lnextc; /* literal next character */
};
.fi
.in -2

.sp
.LP
The characters are mapped to members of the \fBc_cc\fR field of the
\fBtermios\fR structure as follows:
.sp

.sp
.TS
box;
c | c
l | l .
ltchars	c_cc index
_
t_suspc 	VSUS
_
t_dsuspc	VDSUSP
_
t_rprntc	VREPRINT
_
t_flushc	VDISCARD
_
t_werasc	VWERASE
_
t_lnextc	VLNEXT
.TE

.SH IOCTLS
.sp
.LP
\fBttcompat\fR responds to the following \fBioctl\fR calls. All others are
passed to the module below.
.sp
.ne 2
.na
\fB\fBTIOCGETP\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBsgttyb\fR structure. The current  terminal
state is fetched; the  appropriate characters in  the terminal  state are
stored  in that structure, as are the input and output speeds. If the speed is
over B38400,  then B38400 is  returned. The values of the flags in the
\fBsg_flags\fR field are derived from the flags in the terminal state and
stored in the structure.
.RE

.sp
.ne 2
.na
\fB\fBTIOCEXCL\fR \fR
.ad
.RS 14n
Set ``exclusive-use'' mode; no further opens are  permitted until the file has
been closed.
.RE

.sp
.ne 2
.na
\fB\fBTIOCNXCL\fR \fR
.ad
.RS 14n
Turn off ``exclusive-use'' mode.
.RE

.sp
.ne 2
.na
\fB\fBTIOCSETP\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBsgttyb\fR structure. The appropriate
characters and input and output speeds in the terminal state are set from the
values in that structure, and the flags in the terminal state are set to match
the values of the flags in the \fBsg_flags\fR field of that structure. The
state is changed with a \fBTCSETSF\fR \fBioctl\fR so that the interface delays
until output is quiescent, then throws away any unread characters, before
changing the modes. If the current device speed is over B38400 for either input
or output speed, and B38400 is specified through this interface for that speed,
the actual device speed is not changed. If the device speed is B38400 or lower
or if some speed other than B38400 is specified, then the actual speed
specified is set.
.RE

.sp
.ne 2
.na
\fB\fBTIOCSETN\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBsgttyb\fR structure. The terminal state is
changed as  \fBTIOCSETP\fR would change it, but a \fBTCSETS\fR \fBioctl\fR is
used, so that the interface neither delays nor discards input.
.RE

.sp
.ne 2
.na
\fB\fBTIOCHPCL\fR \fR
.ad
.RS 14n
The argument is ignored. The \fBHUPCL\fR flag is set in the \fBc_cflag\fR word
of the terminal state.
.RE

.sp
.ne 2
.na
\fB\fBTIOCFLUSH\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBint\fR variable. If its value is zero, all
characters waiting in input or output queues are flushed. Otherwise, the value
of the \fBint\fR is treated as the logical \fBOR\fR of the \fBFREAD\fR and
\fBFWRITE\fR flags defined by \fB<sys/file.h>\fR\&. If the \fBFREAD\fR bit is
set, all characters waiting in input queues are flushed, and if the
\fBFWRITE\fR bit is set, all characters waiting in output queues are flushed.
.RE

.sp
.ne 2
.na
\fB\fBTIOCSBRK\fR \fR
.ad
.RS 14n
The argument is ignored. The break bit is set for the device. (This  is not
supported  by \fBttcompat\fR. The underlying driver must support TIOCSBRK.)
.RE

.sp
.ne 2
.na
\fB\fBTIOCCBRK\fR \fR
.ad
.RS 14n
The argument is ignored. The break bit is cleared for the device. (This is not
supported by \fBttcompat\fR. The underlying driver must support TIOCCBRK.)
.RE

.sp
.ne 2
.na
\fB\fBTIOCSDTR\fR \fR
.ad
.RS 14n
The argument is ignored. The Data Terminal Ready bit is set for the device.
.RE

.sp
.ne 2
.na
\fB\fBTIOCCDTR\fR \fR
.ad
.RS 14n
The argument is ignored. The Data Terminal Ready bit is cleared for the device.
.RE

.sp
.ne 2
.na
\fB\fBTIOCSTOP\fR \fR
.ad
.RS 14n
The argument is ignored. Output is stopped as if the \fBSTOP\fR character had
been typed.
.RE

.sp
.ne 2
.na
\fB\fBTIOCSTART\fR \fR
.ad
.RS 14n
The argument is ignored. Output is restarted as if the \fBSTART\fR character
had been typed.
.RE

.sp
.ne 2
.na
\fB\fBTIOCGETC\fR \fR
.ad
.RS 14n
The argument is a pointer to a \fBtchars\fR structure. The current terminal
state is fetched, and the appropriate characters in the terminal state are
stored in that structure.
.RE

.sp
.ne 2
.na
\fB\fBTIOCSETC\fR \fR
.ad
.RS 14n
The argument is a pointer to a \fBtchars\fR structure. The values of the
appropriate characters in the terminal state are set from the characters in
that structure.
.RE

.sp
.ne 2
.na
\fB\fBTIOCLGET\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBint\fR. The current terminal state is
fetched, and the values of the local flags are derived from the flags in the
terminal state and stored in the \fBint\fR pointed to by the argument.
.RE

.sp
.ne 2
.na
\fB\fBTIOCLBIS\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBint\fR whose value is a mask containing
flags to be set in the local flags word. The current terminal state is fetched,
and the values of the local flags are derived from the flags in the terminal
state; the specified flags are set, and the flags in the terminal state are set
to match the new value of the local flags word.
.RE

.sp
.ne 2
.na
\fB\fBTIOCLBIC\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBint\fR whose value is a mask containing
flags to be cleared in the local flags word. The current terminal state is
fetched, and the values of the local flags are derived from the flags in the
terminal state; the specified flags are cleared, and the flags in the terminal
state are set to match the new value of the local flags word.
.RE

.sp
.ne 2
.na
\fB\fBTIOCLSET\fR \fR
.ad
.RS 14n
The argument is a pointer to an int containing a new set of local flags. The
flags in the terminal state are set to match the  new value of the local flags
word.  (This \fBioctl\fR was added because \fBsg_flags\fR was once a 16  bit
value. The local modes controlled by TIOCLSET are equivalent to the modes
controlled by TIOCSETP and \fBsg_flags\fR.)
.RE

.sp
.ne 2
.na
\fB\fBTIOCGLTC\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBltchars\fR structure. The values of the
appropriate characters in the terminal state are stored in that structure.
.RE

.sp
.ne 2
.na
\fB\fBTIOCSLTC\fR \fR
.ad
.RS 14n
The argument is a pointer to an \fBltchars\fR structure. The values of the
appropriate characters in the terminal state are set from the characters in
that structure.
.RE

.sp
.ne 2
.na
\fB\fBFIORDCHK\fR \fR
.ad
.RS 14n
Returns the number of immediately readable characters. The argument is ignored.
(This ioctl is  handled in the stream head, not in the \fBttcompat\fR module.)
.RE

.sp
.ne 2
.na
\fB\fBFIONREAD\fR \fR
.ad
.RS 14n
Returns the number of immediately readable characters in the int pointed to by
the argument. (This ioctl is  handled in the stream head, not in the
\fBttcompat\fR module.)
.RE

.sp
.LP
The following ioctls are returned as successful for the sake of compatibility.
However, nothing significant is done (that is, the state of the terminal is not
changed in any way, and no message is passed through to the underlying
\fBtty\fR driver).
.sp
.in +2
.nf

DIOCSETP
DIOCSETP
DIOCGETP
LDCLOSE
LDCHG
LDOPEN
LDGETT
LDSETT
TIOCGETD
TIOCSETD
.fi
.in -2

.sp
.LP
The following old \fBioctl\fRs are not supported by \fBttcompat\fR, but are
supported by Solaris \fBtty\fR drivers. As with all ioctl not otherwise listed
in this documentation, these are passed through to the underlying driver and
are handled there.
.sp
.in +2
.nf
TIOCREMOTE
TIOCGWINSZ
TIOCSWINSZ
.fi
.in -2

.sp
.LP
The following \fBioctls\fR are  not supported by \fBttcompat\fR, and are
generally not supported by Solaris \fBtty\fR drivers. They are  passed through,
and the \fBtty\fR drivers return EINVAL.
.sp
.in +2
.nf
LDSMAP
LDGMAP
LDNMAP
TIOCNOTTY
TIOCOUTQ
.fi
.in -2

.sp
.LP
(Note:   LDSMAP,   LDGMAP,  and   LDNMAP   are  defined   in
<\fBsys/termios.h\fR>.)
.SH SEE ALSO
.sp
.LP
.BR ioctl (2),
.BR termios (3C),
.BR termio (4I),
.BR ldterm (4M)