Section 10.3. User Interface

   


10.3. User Interface

The default terminal line discipline is derived from a discipline that was present in System V, as modified by the POSIX standard and then was modified further to provide reasonable compatibility with previous 4.2BSD line disciplines. The base structure used to describe terminal state in System V was the termio structure. The base structure used by POSIX and by FreeBSD is the termios structure.

The standard programmatic interface for control of the terminal line discipline is the ioctl system call. This call changes disciplines, sets and gets values for special processing characters and modes, sets and gets hardware serial line parameters, and performs other control operations. Most ioctl operations require one argument in addition to a file descriptor and the command; the argument is the address of an integer or structure from which the system gets parameters or into which information is placed. Because the POSIX Working Group thought that the ioctl system call was difficult and undesirable to specify because of its use of arguments that varied in size, in type, and in whether they were being read or written the group members chose to introduce new interfaces for each of the ioctl calls that they believed were necessary for application portability. Each of these calls is named with a tc prefix. In the FreeBSD system, each of these calls is translated (possibly after preprocessing) into an ioctl call.

The following set of ioctl commands apply specifically to the standard terminal line discipline, although all line disciplines must support at least the first two. Other disciplines generally support other ioctl commands. This list is not exhaustive, although it presents all the commands that are used commonly.

TIOCGETD TIOCSETD

Get (set) the line discipline for this line.

TIOCGETA TIOCSETA

Get (set) the termios parameters for this line, including line speed, behavioral parameters, and special characters (e.g., erase and kill characters).

TIOCSETAW

Set the termios parameters for this line after waiting for the output buffer to drain (but without discarding any characters from the input buffer).

TIOCSETAF

Set the termios parameters for this line after waiting for the output buffer to drain and discarding any characters from the input buffer.

TIOCFLUSH

Discard all characters from the input and output buffers.

TIOCDRAIN

Wait for the output buffer to drain.

TIOCEXCL TIOCNXCL

Get (release) exclusive use of the line.

TIOCCBRK TIOCSBRK

Clear (set) the terminal hardware BREAK condition for the line.

TIOCCDTR TIOCSDTR

Clear (set) data terminal ready on the line.

TIOCGPGRP TIOCSPGRP

Get (set) the process group associated with this terminal (see Section 10.5).

TIOCOUTQ

Return the number of characters in the terminal's output buffer.

TIOCSTI

Enter characters into the terminal's input buffer as though they were typed by the user.

TIOCNOTTY

Disassociate the current controlling terminal from the process (see Section 10.5).

TIOCSCTTY

Make the terminal the controlling terminal for the process (see Section 10.5).

TIOCSTART TIOCSTOP

Start (stop) output on the terminal.

TIOCGWINSZ TIOCSWINSZ

Get (set) the terminal or window size for the terminal line; the window size includes width and height in characters and (optionally, on graphical displays) in pixels.



   
 


The Design and Implementation of the FreeBSD Operating System
The Design and Implementation of the FreeBSD Operating System
ISBN: 0201702452
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net