summaryrefslogtreecommitdiff
path: root/share/man/man4/tty.4
diff options
context:
space:
mode:
Diffstat (limited to 'share/man/man4/tty.4')
-rw-r--r--share/man/man4/tty.4127
1 files changed, 72 insertions, 55 deletions
diff --git a/share/man/man4/tty.4 b/share/man/man4/tty.4
index f2edf1add38..161f6b4b372 100644
--- a/share/man/man4/tty.4
+++ b/share/man/man4/tty.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tty.4,v 1.18 2001/09/11 15:32:49 fgsch Exp $
+.\" $OpenBSD: tty.4,v 1.19 2001/10/05 14:45:53 mpech Exp $
.\" $NetBSD: tty.4,v 1.4 1996/03/19 04:26:01 paulus Exp $
.\"
.\" Copyright (c) 1991, 1992, 1993
@@ -66,36 +66,41 @@ system when logging in over a network (using
.Xr rlogin 1 ,
or
.Xr telnet 1
-for example). Even in these cases the details of how the terminal
+for example).
+Even in these cases the details of how the terminal
file was opened and set up is already handled by special software
in the system.
Thus, users do not normally need to worry about the details of
how these lines are opened or used.
.Pp
For hardware terminal ports, dial-out is supported through matching
-device nodes called calling units. For instance, the terminal called
+device nodes called calling units.
+For instance, the terminal called
.Pa /dev/tty03
would have a matching calling unit called
.Pa /dev/cua03 .
These two devices are normally differentiated by creating the calling
unit device node with a minor number 128 greater than the dial-in
-device node. Whereas the dial-in device (the
+device node.
+Whereas the dial-in device (the
.Em tty )
normally
requires a hardware signal to indicate to the system that it is active,
the dial-out device (the
.Em cua )
does not, and hence can communicate unimpeded
-with a device such as a modem. This means that a process like
+with a device such as a modem.
+This means that a process like
.Xr getty 8
will wait on a dial-in device until a connection is established.
Meanwhile, a dial-out connection can be established on the dial-out
device (for the very same hardware terminal port) without disturbing
-anything else on the system. The
+anything else on the system.
+The
.Xr getty 8
process does not even notice that anything is happening on the terminal
-port. If a connecting call comes in after the dial-out connection has
-finished, the
+port.
+If a connecting call comes in after the dial-out connection has finished, the
.Xr getty 8
process will deal with it properly, without having noticed the
intervening dial-out action.
@@ -111,20 +116,23 @@ the particular details of which is described in
.Xr stty 1
at the command level, and in
.Xr termios 4
-at the programming level. A user may be concerned with changing
-settings associated with his particular login terminal and should refer
-to the preceding man pages for the common cases. The remainder of
-this man page is concerned
-with describing details of using and controlling terminal devices
-at a low level, such as that possibly required by a program wishing
-to provide features similar to those provided by the system.
+at the programming level.
+A user may be concerned with changing settings associated with his particular
+login terminal and should refer to the preceding man pages for the common
+cases.
+The remainder of this man page is concerned with describing details of using
+and controlling terminal devices at a low level, such as that possibly
+required by a program wishing to provide features similar to those provided
+by the system.
.Ss Line disciplines
A terminal file is used like any other file in the system in that
it can be opened, read, and written to using standard system
-calls. For each existing terminal file, there is a software processing module
+calls.
+For each existing terminal file, there is a software processing module
called a
.Em "line discipline"
-is associated with it. The
+is associated with it.
+The
.Em "line discipline"
essentially glues the low level device driver code with the high
level generic interface routines (such as
@@ -132,14 +140,15 @@ level generic interface routines (such as
and
.Xr write 2 ) ,
and is responsible for implementing the semantics associated
-with the device. When a terminal file is first opened by a program,
-the default
+with the device.
+When a terminal file is first opened by a program, the default
.Em "line discipline"
called the
.Dv termios
-line discipline is associated with the file. This is the primary
-line discipline that is used in most cases and provides the semantics
-that users normally associate with a terminal. When the
+line discipline is associated with the file.
+This is the primary line discipline that is used in most cases and provides
+the semantics that users normally associate with a terminal.
+When the
.Dv termios
line discipline is in effect, the terminal file behaves and is
operated according to the rules described in
@@ -158,8 +167,8 @@ hardware (or lack thereof, as in the case of ptys).
.Ss Terminal File Operations
All of the following operations are invoked using the
.Xr ioctl 2
-system call. Refer to that man page for a description of
-the
+system call.
+Refer to that man page for a description of the
.Em request
and
.Em argp
@@ -173,11 +182,12 @@ specific to it (actually
.Xr termios 4
defines them as function calls, not ioctl
.Em requests . )
-The following section lists the available ioctl requests. The
-name of the request, a description of its purpose, and the typed
+The following section lists the available ioctl requests.
+The name of the request, a description of its purpose, and the typed
.Em argp
parameter (if any)
-are listed. For example, the first entry says
+are listed.
+For example, the first entry says
.Pp
.D1 Em "TIOCSETD int *ldisc"
.Pp
@@ -276,20 +286,22 @@ Place the current number of characters in the output queue in the
integer pointed to by
.Fa num .
.It Dv TIOCSTI Fa char *cp
-Simulate typed input. Pretend as if the terminal received the
-character pointed to by
+Simulate typed input.
+Pretend as if the terminal received the character pointed to by
.Fa cp .
.It Dv TIOCNOTTY Fa void
-This call is obsolete but left for compatibility. In the past, when
-a process that didn't have a controlling terminal (see
+This call is obsolete but left for compatibility.
+In the past, when a process that didn't have a controlling terminal
+(see
.Em The Controlling Terminal
in
.Xr termios 4 )
first opened a terminal device, it acquired that terminal as its
-controlling terminal. For some programs this was a hazard as they
-didn't want a controlling terminal in the first place, and this
-provided a mechanism to disassociate the controlling terminal from
-the calling process. It
+controlling terminal.
+For some programs this was a hazard as they didn't want a controlling
+terminal in the first place, and this provided a mechanism to disassociate
+the controlling terminal from the calling process.
+It
.Em must
be called by opening the file
.Pa /dev/tty
@@ -309,8 +321,8 @@ In addition, a program can
and call the
.Fn setsid
system call which will place the process into its own session - which
-has the effect of disassociating it from the controlling terminal. This
-is the new and preferred method for programs to lose their controlling
+has the effect of disassociating it from the controlling terminal.
+This is the new and preferred method for programs to lose their controlling
terminal.
.It Dv TIOCSTOP Fa void
Stop output on the terminal (like typing ^S at the keyboard).
@@ -322,12 +334,14 @@ must not currently have a controlling terminal).
.It Dv TIOCDRAIN Fa void
Wait until all output is drained.
.It Dv TIOCEXCL Fa void
-Set exclusive use on the terminal. No further opens are permitted
-except by root. Of course, this means that programs that are run by
-root (or setuid) will not obey the exclusive setting - which limits
-the usefulness of this feature.
+Set exclusive use on the terminal.
+No further opens are permitted except by root.
+Of course, this means that programs that are run by root (or setuid)
+will not obey the exclusive setting - which limits the usefulness
+of this feature.
.It Dv TIOCNXCL Fa void
-Clear exclusive use of the terminal. Further opens are permitted.
+Clear exclusive use of the terminal.
+Further opens are permitted.
.It Dv TIOCFLUSH Fa int *what
If the value of the int pointed to by
.Fa what
@@ -335,24 +349,25 @@ contains the
.Dv FREAD
bit as defined in
.Pa Aq sys/fcntl.h ,
-then all characters in the input queue are cleared. If it contains
-the
+then all characters in the input queue are cleared.
+If it contains the
.Dv FWRITE
-bit, then all characters in the output queue are cleared. If the
-value of the integer is zero, then it behaves as if both the
+bit, then all characters in the output queue are cleared.
+If the value of the integer is zero, then it behaves as if both the
.Dv FREAD
and
.Dv FWRITE
-bits were set (i.e. clears both queues).
+bits were set (i.e., clears both queues).
.It Dv TIOCGWINSZ Fa struct winsize *ws
Put the window size information associated with the terminal in the
.Va winsize
structure pointed to by
.Fa ws .
The window size structure contains the number of rows and columns (and pixels
-if appropriate) of the devices attached to the terminal. It is set by user software
-and is the means by which most full\&-screen oriented programs determine the
-screen size. The
+if appropriate) of the devices attached to the terminal.
+It is set by user software and is the means by which most full\&-screen
+oriented programs determine the screen size.
+The
.Va winsize
structure is defined in
.Pa Aq sys/ioctl.h .
@@ -375,13 +390,14 @@ to this terminal.
If
.Fa on
points to a zero integer, redirect kernel console output back to the normal
-console. This is usually used on workstations to redirect kernel messages
+console.
+This is usually used on workstations to redirect kernel messages
to a particular window.
.It Dv TIOCMSET Fa int *state
The integer pointed to by
.Fa state
-contains bits that correspond to modem state. Following is a list
-of defined variables and the modem state they represent:
+contains bits that correspond to modem state.
+Following is a list of defined variables and the modem state they represent:
.Pp
.Bl -tag -width TIOCMXCTS -compact
.It TIOCM_LE
@@ -430,8 +446,9 @@ is cleared in the terminal.
.It Dv TIOCSFLAGS Fa int *state
The bits in the integer pointed to by
.Fa state
-contain bits that correspond to serial port state. Following is a list
-of defined variables and the serial port state they represent:
+contain bits that correspond to serial port state.
+Following is a list of defined variables and the serial port state they
+represent:
.Pp
.Bl -tag -width TIOCFLAG_SOFTCAR -compact
.It TIOCFLAG_SOFTCAR