STREAMS Modules ttcompat(7M)
NAME
ttcompat - V7, 4BSD and XENIX STREAMS compatibility module
SYNOPSIS
#define BSDCOMP
#include
#include
ioctl(fd, IPUSH, "ttcompat");
DESCRIPTION
ttcompat is a STREAMS module that translates the ioctl calls
supported by the older Version 7, 4BSD, and XENIX terminal
drivers into the ioctl calls supported by the termio inter-
face (see termio(7I)). All other messages pass through this
module unchanged; the behavior of read and write calls is
unchanged, as is the behavior of ioctl calls other than the
ones supported by ttcompat.
This module can be automatically pushed onto a stream using
the autopush mechanism when a terminal device is opened; it
does not have to be explicitly pushed onto a stream. This
module requires that the termios interface be supported by
the modules and the application can push the driver down-
stream. The TCGETS, TCSETS, and TCSETSF ioctl calls must be
supported. If any information set or fetched by those ioctl
calls is not supported by the modules and driver downstream,
some of the V7/4BSD/XENIX functions may not be supported.
For example, if the CBAUD bits in the ccflag field are not
supported, the functions provided by the sgispeed and
sgospeed fields of the sgttyb structure (see below) will
not be supported. If the TCFLSH ioctl is not supported, the
function provided by the TIOCFLUSH ioctl will not be sup-
ported. If the TCXONC ioctl is not supported, the functions
provided by the TIOCSTOP and TIOCSTART ioctl calls will not
be supported. If the TIOCMBIS and TIOCMBIC ioctl calls are
not supported, the functions provided by the TIOCSDTR and
TIOCDTR ioctl calls will not be supported.
The basic ioctl calls use the sgttyb structure defined by
(included by ):
struct sgttyb {
char sgispeed;
char sgospeed;
char sgerase;
char sgkill;
int sgflags;
};
SunOS 5.11 Last change: 2 Oct 2001 1
STREAMS Modules ttcompat(7M)
The sgispeed and sgospeed 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 compati-
bility reasons. If it is set to B38400 and the current
speed is over B38400, the change is ignored. See TIOCGETP
and TIOCSETP below. The sgerase and sgkill fields of the
argument structure specify the erase and kill characters
respectively, and reflect the values in the VERASE and VKIL
members of the ccc field of the termios structure.
The sgflags 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 termi-
nal state, represented by the termios structure.
Delay type 0 (NL0, TAB0, CR0, F0, BS0) is always mapped
into the equivalent delay type 0 in the coflag field of the
termios structure. Other delay mappings are performed as
follows:
SunOS 5.11 Last change: 2 Oct 2001 2
STREAMS Modules ttcompat(7M)
sgflags coflag
BS1 BS1
F1 VT1
CR1 CR2
CR2 CR3
CR3 CR0 (not supported)
TAB1 TAB1
TAB2 TAB2
XTABS TAB3
NL1 ONLRETCR1
NL2 NL1
NL3 NL0 (not supported)
If previous TIOCLSET or TIOCLBIS ioctl calls have not
selected LITOUT or PAS8 mode, and if RAW mode is not
selected, the ISTRIP flag is set in the ciflag field of the
termios structure, and the EVENP and ODP flags control the
parity of characters sent to the terminal and accepted from
the terminal, as follows:
0 (neither EVENP nor ODP) Parity is not to be generated
on output or checked on input.
The character size is set to
CS8 and the PARENB flag is
cleared in the ccflag field
of the termios structure.
EVENP Even parity characters are to
be generated on output and
accepted on input. The INPCK
flag is set in the ciflag
field of the termios struc-
ture, the character size is
set to CS7 and the PARENB flag
is set in the ciflag field of
the termios structure.
SunOS 5.11 Last change: 2 Oct 2001 3
STREAMS Modules ttcompat(7M)
ODP Odd parity characters are to
be generated on output and
accepted on input. The INPCK
flag is set in the ciflag,
the character size is set to
CS7 and the PARENB and PAROD
flags are set in the ciflag
field of the termios struc-
ture.
EVENPODP or ANYP Even parity characters are to
be generated on output and
characters of either parity
are to be accepted on input.
The INPCK flag is cleared in
the ciflag field, the charac-
ter size is set to CS7 and the
PARENB flag is set in the
ciflag field of the termios
structure.
The RAW flag disables all output processing (the OPOST flag
in the coflag field, and the XCASE and IEXTEN flags in the
ciflag field are cleared in the termios structure) and
input processing (all flags in the ciflag field other than
the IXOF and IXANY flags are cleared in the termios
structure). Eight bits of data, with no parity bit are
accepted on input and generated on output; the character
size is set to CS8 and the PARENB and PAROD flags are
cleared in the ccflag field of the termios structure. The
signal-generating and line-editing control characters are
disabled by clearing the ISIG and ICANON flags in the
ciflag field of the termios structure.
The CRMOD 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 ICRNL
flag in the ciflag field, and the OPOST and ONLCR flags in
the coflag field, are set in the termios structure.
The LCASE flag maps upper-case letters in the ASCI charac-
ter set to their lower-case equivalents on input (the IUCLC
flag is set in the ciflag field), and maps lower-case
letters in the ASCI character set to their upper-case
equivalents on output (the OLCUC flag is set in the coflag
field). Escape sequences are accepted on input, and gen-
erated on output, to handle certain ASCI characters not
SunOS 5.11 Last change: 2 Oct 2001 4
STREAMS Modules ttcompat(7M)
supported by older terminals (the XCASE flag is set in the
clflag field).
Other flags are directly mapped to flags in the termios
structure:
sgflags Flags in termios structure
CBREAK Complement of ICANON in clflag field
ECHO ECHO in clflag field
TANDEM IXOF in ciflag field
Another structure associated with each terminal specifies
characters that are special in both the old Version 7 and
the newer 4BSD terminal interfaces. The following structure
is defined by :
struct tchars {
char tintrc; /* interrupt */
char tquitc; /* quit */
char tstartc; /* start output */
char tstopc; /* stop output */
char teofc; /* end-of-file */
char tbrkc; /* input delimiter (like nl) */
};
XENIX defines the tchar structure as tc. The characters
are mapped to members of the ccc field of the termios
structure as follows:
tchars ccc index
tintrc VINTR
tquitc VQUIT
tstartc VSTART
tstopc VSTOP
teofc VEOF
tbrkc VEOL
SunOS 5.11 Last change: 2 Oct 2001 5
STREAMS Modules ttcompat(7M)
Also associated with each terminal is a local flag word
(TIOCLSET and TIOCLGET), specifying flags supported by the
new 4BSD terminal interface. Most of these flags are
directly mapped to flags in the termios structure:
SunOS 5.11 Last change: 2 Oct 2001 6
STREAMS Modules ttcompat(7M)
Local flags Flags in termios structure
LCRTBS Not supported
LPRTERA ECHOPRT in the clflag field
LCRTERA ECHOE in the clflag field
LTILDE Not supported
LMDMBUF Not supported
LTOSTOP TOSTOP in the clflag field
LFLUSHO FLUSHO in the clflag field
LNOHANG CLOCAL in the ccflag field
LCRTKIL ECHOKE in the clflag field
LPAS8 CS8 in the ccflag field
LCTLECH CTLECH in the clflag field
LPENDIN PENDIN in the clflag field
LDECTQ Complement of IXANY in the ciflag field
LNOFLSH NOFLSH in the clflag field
Each flag has a corresponding equivalent sgflags value. The
sgflags definitions omit the leading "L"; for example,
TIOCSETP with sgflags set to TOSTOP is equivalent to
TIOCLSET with LTOSTOP.
Another structure associated with each terminal is the
ltchars structure which defines control characters for the
new 4BSD terminal interface. Its structure is:
struct ltchars {
char tsuspc; /* stop process signal */
char tdsuspc; /* delayed stop process signal */
char trprntc; /* reprint line */
char tflushc; /*flush output (toggles) */
char twerasc; /* word erase */
char tlnextc; /* literal next character */
};
SunOS 5.11 Last change: 2 Oct 2001 7
STREAMS Modules ttcompat(7M)
The characters are mapped to members of the ccc field of
the termios structure as follows:
ltchars ccc index
tsuspc VSUS
tdsuspc VDSUSP
trprntc VREPRINT
tflushc VDISCARD
twerasc VWERASE
tlnextc VLNEXT
IOCTLS
ttcompat responds to the following ioctl calls. All others
are passed to the module below.
TIOCGETP The argument is a pointer to an sgttyb struc-
ture. 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 sgflags field are
derived from the flags in the terminal state
and stored in the structure.
TIOCEXCL Set ``exclusive-use'' mode; no further opens
are permitted until the file has been closed.
TIOCNXCL Turn off ``exclusive-use'' mode.
TIOCSETP The argument is a pointer to an sgttyb struc-
ture. 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 sgflags field
of that structure. The state is changed with a
TCSETSF ioctl so that the interface delays
SunOS 5.11 Last change: 2 Oct 2001 8
STREAMS Modules ttcompat(7M)
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.
TIOCSETN The argument is a pointer to an sgttyb struc-
ture. The terminal state is changed as
TIOCSETP would change it, but a TCSETS ioctl
is used, so that the interface neither delays
nor discards input.
TIOCHPCL The argument is ignored. The HUPCL flag is set
in the ccflag word of the terminal state.
TIOCFLUSH The argument is a pointer to an int variable.
If its value is zero, all characters waiting
in input or output queues are flushed. Other-
wise, the value of the int is treated as the
logical OR of the FREAD and FWRITE flags
defined by . If the FREAD bit is
set, all characters waiting in input queues
are flushed, and if the FWRITE bit is set, all
characters waiting in output queues are
flushed.
TIOCSBRK The argument is ignored. The break bit is set
for the device. (This is not supported by
ttcompat. The underlying driver must support
TIOCSBRK.)
TIOCBRK The argument is ignored. The break bit is
cleared for the device. (This is not supported
by ttcompat. The underlying driver must sup-
port TIOCBRK.)
TIOCSDTR The argument is ignored. The Data Terminal
Ready bit is set for the device.
SunOS 5.11 Last change: 2 Oct 2001 9
STREAMS Modules ttcompat(7M)
TIOCDTR The argument is ignored. The Data Terminal
Ready bit is cleared for the device.
TIOCSTOP The argument is ignored. Output is stopped as
if the STOP character had been typed.
TIOCSTART The argument is ignored. Output is restarted
as if the START character had been typed.
TIOCGETC The argument is a pointer to a tchars struc-
ture. The current terminal state is fetched,
and the appropriate characters in the terminal
state are stored in that structure.
TIOCSETC The argument is a pointer to a tchars struc-
ture. The values of the appropriate characters
in the terminal state are set from the charac-
ters in that structure.
TIOCLGET The argument is a pointer to an int. 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
int pointed to by the argument.
TIOCLBIS The argument is a pointer to an int 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 termi-
nal 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.
TIOCLBIC The argument is a pointer to an int 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 termi-
nal 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.
SunOS 5.11 Last change: 2 Oct 2001 10
STREAMS Modules ttcompat(7M)
TIOCLSET 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 ioctl was
added because sgflags was once a 16 bit
value. The local modes controlled by TIOCLSET
are equivalent to the modes controlled by
TIOCSETP and sgflags.)
TIOCGLTC The argument is a pointer to an ltchars struc-
ture. The values of the appropriate characters
in the terminal state are stored in that
structure.
TIOCSLTC The argument is a pointer to an ltchars struc-
ture. The values of the appropriate characters
in the terminal state are set from the charac-
ters in that structure.
FIORDCHK Returns the number of immediately readable
characters. The argument is ignored. (This
ioctl is handled in the stream head, not in
the ttcompat module.)
FIONREAD Returns the number of immediately readable
characters in the int pointed to by the argu-
ment. (This ioctl is handled in the stream
head, not in the ttcompat module.)
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 tty driver).
DIOCSETP
DIOCSETP
DIOCGETP
LDCLOSE
LDCHG
LDOPEN
LDGET
LDSET
TIOCGETD
TIOCSETD
SunOS 5.11 Last change: 2 Oct 2001 11
STREAMS Modules ttcompat(7M)
The following old ioctls are not supported by ttcompat, but
are supported by Solaris tty drivers. As with all ioctl not
otherwise listed in this documentation, these are passed
through to the underlying driver and are handled there.
TIOCREMOTE
TIOCGWINSZ
TIOCSWINSZ
The following ioctls are not supported by ttcompat, and are
generally not supported by Solaris tty drivers. They are
passed through, and the tty drivers return EINVAL.
LDSMAP
LDGMAP
LDNMAP
TIOCNOTY
TIOCOUTQ
(Note: LDSMAP, LDGMAP, and LDNMAP are defined in
.)
SEE ALSO
ioctl(2), termios(3C), ldterm(7M), termio(7I)
SunOS 5.11 Last change: 2 Oct 2001 12
|