DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SCO OpenServer

ttiocom(D3oddi)


ttiocom -- interpret TTY driver I/O control commands

Syntax

#include <sys/file.h>
#include <sys/tty.h>
#include <sys/types.h>

int ttiocom(struct tty *tp, int cmd, int arg, int mode);

Description

The ttiocom routine is the general purpose ioctl(S) interpreter for use with serial drivers. In most cases, a device driver's ioctl(D2oddi) routine calls ttiocom to send a termio(M) command. ttiocom may then in turn call the driver's proc(D2oddi) routine to send an I/O control command to the TTY device.

Arguments


tp
Pointer to an instance of the tty structure for a TTY device.

cmd
I/O control command passed through from the user program. Valid values of the cmd argument are as follows:

IOC_SELECT
Determines if a character can be read from or written to a TTY device without blocking (going to sleep in the process). mode can be SELREAD or SELWRITE. IOC_SELECT calls the ttselect(D3oddi) routine.

IOCTYPE
Query for line discipline type by setting u.u_rval1 to the value TIOC. rval1 is returned from the system call.

TCSETAF, TCSETAW, TCSETA, TCGETA, TCSBRK, TCXONC, TCFLSH
See termio(M) for details of these commands.

The proc(D2oddi) routine is called by TCXONC as follows:

arg value xxproc argument
0 (zero) T_SUSPEND
1 T_RESUME
2 T_BLOCK
3 T_UNBLOCK

 arg value   xxproc argument
 0 (zero)    T_SUSPEND
 1           T_RESUME
 2           T_BLOCK
 3           T_UNBLOCK


FIORDCHK
Checks to see if characters are waiting to be read. 1 is returned if characters are waiting in t_canq. If ICANON is set, it is also possible for 1 to be returned when characters are not in t_canq, but there are characters in t_delct. If there are no characters in t_canq and ICANON is not set, and if there are characters in t_rawq, 1 is returned. If none of the queues have characters, 0 (zero) is returned. FIORDCHK causes ttrdchk(D3oddi) to be called.

I_XCSETAW
Waits for the UART to empty (waits 11 bit times depending on the terminal's baud rate). I_XCSETAW is a POSIX extension to termio.

I_XCSETAF
Waits until the UART empties and then flushes all read and write buffers (calls ttyflush(D3oddi)). I_XCSETAF is a POSIX extension to termio.

I_XCSETA
Sets terminal parameters from the tty structure specified by the arg argument to ttiocom. I_XCSETA is a POSIX extension to termio.

I_XCGETA
Gets terminal parameters from a terminal's tty structure and puts them into the tty structure specified by the arg argument to ttiocom.

arg
Argument to the I/O control command, also passed through from the user program.

mode
Indicates the mode by which the file was opened. The modes are assigned by the kernel and are interpreted into flag values that are defined in <sys/file.h>. Possible values are FNDELAY, FREAD, FSTOPIO, and FWRITE.

Return values

ttiocom returns 0 if an error is set in u.u_error; otherwise it returns 1.

Usage

Context and synchronization

User context.

Hardware applicability

All

Version applicability

oddi: 1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp

SVR5 DDI compatibility

SVR5 TTY drivers are implemented as STREAMS drivers so there is no direct parallel to this function.

References

sleep(D3oddi), termio(M), ttrdchk(D3oddi), ttselect(D3oddi), tty(D3oddi), ttyflush(D3oddi)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005