diff options
Diffstat (limited to 'static/netbsd/man4/tty.4 2.html')
| -rw-r--r-- | static/netbsd/man4/tty.4 2.html | 403 |
1 files changed, 0 insertions, 403 deletions
diff --git a/static/netbsd/man4/tty.4 2.html b/static/netbsd/man4/tty.4 2.html deleted file mode 100644 index 3262c807..00000000 --- a/static/netbsd/man4/tty.4 2.html +++ /dev/null @@ -1,403 +0,0 @@ -<table class="head"> - <tr> - <td class="head-ltitle">TTY(4)</td> - <td class="head-vol">Device Drivers Manual</td> - <td class="head-rtitle">TTY(4)</td> - </tr> -</table> -<div class="manual-text"> -<section class="Sh"> -<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> -<p class="Pp"><code class="Nm">tty</code> — <span class="Nd">general - terminal interface</span></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> -<p class="Pp"><code class="In">#include - <<a class="In">sys/ioctl.h</a>></code></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> -<p class="Pp">This section describes the interface to the terminal drivers in - the system.</p> -<section class="Ss"> -<h2 class="Ss" id="Terminal_Special_Files"><a class="permalink" href="#Terminal_Special_Files">Terminal - Special Files</a></h2> -<p class="Pp">Each hardware terminal port on the system usually has two terminal - special device files associated with it in the directory - <span class="Pa">/dev/</span> (for example, - <span class="Pa">/dev/tty03</span> and - <span class="Pa">/dev/dty03</span>).</p> -<p class="Pp">The <span class="Pa">/dev/ttyXX</span> special file is used for - dial-in modems and terminals. When a user logs into the system on one of - these hardware terminal ports, the system has already opened the associated - device and prepared the line for normal interactive use (see - <a class="Xr">getty(8)</a>).</p> -<p class="Pp">The <span class="Pa">/dev/dtyXX</span> special file is a - SunOS-compatible dial-out device. Unlike the dial-in device, opening the - dial-out device never blocks. If the corresponding dial-in device is already - opened (not blocked in the open waiting for carrier), then the dial-out open - will fail immediately; otherwise it will succeed immediately. While the - dial-out device is open, the dial-in device may not be opened. If the - dial-in open is blocking, it will wait until the dial-out device is closed - (and carrier is detected); otherwise it will fail immediately.</p> -<p class="Pp" id="ptys">There is also a special case of a terminal file that - connects not to a hardware terminal port, but to another program on the - other side. These special terminal devices are called - <a class="permalink" href="#ptys"><i class="Em">ptys</i></a> (pseudo - terminals) and provide the mechanism necessary to give users the same - interface to the system when logging in over a network (using - <a class="Xr">rlogin(1)</a> or <a class="Xr">telnet(1)</a>, 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. Also, these lines are often used for dialing out of a system (through - an out-calling modem), but again the system provides programs that hide the - details of accessing these terminal special files (see - <a class="Xr">tip(1)</a>).</p> -<p class="Pp">When an interactive user logs in, the system prepares the line to - behave in a certain way (called a <i class="Em">line discipline</i>), the - particular details of which is described in <a class="Xr">stty(1)</a> at the - command level, and in <a class="Xr">termios(4)</a> 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.</p> -</section> -<section class="Ss"> -<h2 class="Ss" id="Line_disciplines"><a class="permalink" href="#Line_disciplines">Line - disciplines</a></h2> -<p class="Pp">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 called a - <i class="Em">line discipline</i> associated with it. The <i class="Em">line - discipline</i> essentially glues the low level device driver code with the - high level generic interface routines (such as <a class="Xr">read(2)</a> and - <a class="Xr">write(2)</a>), and is responsible for implementing the - semantics associated with the device. When a terminal file is first opened - by a program, the default <i class="Em">line discipline</i> called the - <code class="Dv">termios</code> 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 - <code class="Dv">termios</code> line discipline is in effect, the terminal - file behaves and is operated according to the rules described in - <a class="Xr">termios(4)</a>. Please refer to that man page for a full - description of the terminal semantics. The operations described here - generally represent features common across all <i class="Em">line - disciplines</i>, however some of these calls may not make sense in - conjunction with a line discipline other than - <code class="Dv">termios</code>, and some may not be supported by the - underlying hardware (or lack thereof, as in the case of ptys).</p> -</section> -<section class="Ss"> -<h2 class="Ss" id="Terminal_File_Operations"><a class="permalink" href="#Terminal_File_Operations">Terminal - File Operations</a></h2> -<p class="Pp">All of the following operations are invoked using the - <a class="Xr">ioctl(2)</a> system call. Refer to that man page for a - description of the - <a class="permalink" href="#request"><i class="Em" id="request">request</i></a> - and <i class="Em">argp</i> parameters. In addition to the ioctl - <i class="Em">requests</i> defined here, the specific line discipline in - effect will define other <i class="Em">requests</i> specific to it - (actually, <a class="Xr">termios(4)</a> defines them as function calls, not - ioctl <i class="Em">requests</i>). The following section lists the available - ioctl requests. The name of the request, a description of its purpose, and - the typed <i class="Em">argp</i> parameter (if any) are listed. For example, - the first entry says</p> -<p class="Pp"></p> -<div class="Bd Bd-indent"><i class="Em">TIOCSLINED char name[32]</i></div> -<p class="Pp">and would be called on the terminal associated with file - descriptor zero by the following code fragment:</p> -<div class="Bd Pp Li"> -<pre> ioctl(0, TIOCSLINED, "termios");</pre> -</div> -</section> -<section class="Ss"> -<h2 class="Ss" id="Terminal_File_Request_Descriptions"><a class="permalink" href="#Terminal_File_Request_Descriptions">Terminal - File Request Descriptions</a></h2> -<dl class="Bl-tag"> - <dt id="TIOCSLINED"><a class="permalink" href="#TIOCSLINED"><code class="Dv">TIOCSLINED</code></a> - <var class="Fa">char name[32]</var></dt> - <dd>Change to the new line discipline called <var class="Fa">name</var>.</dd> - <dt id="TIOCGLINED"><a class="permalink" href="#TIOCGLINED"><code class="Dv">TIOCGLINED</code></a> - <var class="Fa">char name[32]</var></dt> - <dd>Return the current line discipline in the string pointed to by - <var class="Fa">name</var>.</dd> - <dt id="TIOCSBRK"><a class="permalink" href="#TIOCSBRK"><code class="Dv">TIOCSBRK</code></a> - <var class="Fa">void</var></dt> - <dd>Set the terminal hardware into BREAK condition.</dd> - <dt id="TIOCCBRK"><a class="permalink" href="#TIOCCBRK"><code class="Dv">TIOCCBRK</code></a> - <var class="Fa">void</var></dt> - <dd>Clear the terminal hardware BREAK condition.</dd> - <dt id="TIOCSDTR"><a class="permalink" href="#TIOCSDTR"><code class="Dv">TIOCSDTR</code></a> - <var class="Fa">void</var></dt> - <dd>Assert data terminal ready (DTR).</dd> - <dt id="TIOCCDTR"><a class="permalink" href="#TIOCCDTR"><code class="Dv">TIOCCDTR</code></a> - <var class="Fa">void</var></dt> - <dd>Clear data terminal ready (DTR).</dd> - <dt id="TIOCGPGRP"><a class="permalink" href="#TIOCGPGRP"><code class="Dv">TIOCGPGRP</code></a> - <var class="Fa">int *tpgrp</var></dt> - <dd>Return the current process group the terminal is associated with in the - integer pointed to by <var class="Fa">tpgrp</var>. This is the underlying - call that implements the <a class="Xr">tcgetpgrp(3)</a> call.</dd> - <dt id="TIOCSPGRP"><a class="permalink" href="#TIOCSPGRP"><code class="Dv">TIOCSPGRP</code></a> - <var class="Fa">int *tpgrp</var></dt> - <dd>Associate the terminal with the process group (as an integer) pointed to - by <var class="Fa">tpgrp</var>. This is the underlying call that - implements the <a class="Xr">tcsetpgrp(3)</a> call.</dd> - <dt id="TIOCGETA"><a class="permalink" href="#TIOCGETA"><code class="Dv">TIOCGETA</code></a> - <var class="Fa">struct termios *term</var></dt> - <dd>Place the current value of the termios state associated with the device in - the termios structure pointed to by <var class="Fa">term</var>. This is - the underlying call that implements the <a class="Xr">tcgetattr(3)</a> - call.</dd> - <dt id="TIOCSETA"><a class="permalink" href="#TIOCSETA"><code class="Dv">TIOCSETA</code></a> - <var class="Fa">struct termios *term</var></dt> - <dd>Set the termios state associated with the device immediately. This is the - underlying call that implements the <a class="Xr">tcsetattr(3)</a> call - with the <code class="Dv">TCSANOW</code> option.</dd> - <dt id="TIOCSETAW"><a class="permalink" href="#TIOCSETAW"><code class="Dv">TIOCSETAW</code></a> - <var class="Fa">struct termios *term</var></dt> - <dd>First wait for any output to complete, then set the termios state - associated with the device. This is the underlying call that implements - the <a class="Xr">tcsetattr(3)</a> call with the - <code class="Dv">TCSADRAIN</code> option.</dd> - <dt id="TIOCSETAF"><a class="permalink" href="#TIOCSETAF"><code class="Dv">TIOCSETAF</code></a> - <var class="Fa">struct termios *term</var></dt> - <dd>First wait for any output to complete, clear any pending input, then set - the termios state associated with the device. This is the underlying call - that implements the <a class="Xr">tcsetattr(3)</a> call with the - <code class="Dv">TCSAFLUSH</code> option.</dd> - <dt id="TIOCOUTQ"><a class="permalink" href="#TIOCOUTQ"><code class="Dv">TIOCOUTQ</code></a> - <var class="Fa">int *num</var></dt> - <dd>Place the current number of characters in the output queue in the integer - pointed to by <var class="Fa">num</var>.</dd> - <dt id="TIOCSTI"><a class="permalink" href="#TIOCSTI"><code class="Dv">TIOCSTI</code></a> - <var class="Fa">char *cp</var></dt> - <dd>Simulate typed input. Pretend as if the terminal received the character - pointed to by <var class="Fa">cp</var>.</dd> - <dt id="TIOCNOTTY"><a class="permalink" href="#TIOCNOTTY"><code class="Dv">TIOCNOTTY</code></a> - <var class="Fa">void</var></dt> - <dd>This call is obsolete but left for compatibility. In the past, when a - process that didn't have a controlling terminal (see - <a class="permalink" href="#The"><i class="Em" id="The">The Controlling - Terminal</i></a> in <a class="Xr">termios(4)</a>) 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 - <a class="permalink" href="#must"><i class="Em" id="must">must</i></a> be - called by opening the file <span class="Pa">/dev/tty</span> and calling - <code class="Dv">TIOCNOTTY</code> on that file descriptor. - <p class="Pp" id="open">The current system does not allocate a controlling - terminal to a process on an - <a class="permalink" href="#open"><code class="Fn">open</code></a>() - call: there is a specific ioctl called <code class="Dv">TIOCSCTTY</code> - to make a terminal the controlling terminal. In addition, a program can - <a class="permalink" href="#fork"><code class="Fn" id="fork">fork</code></a>() - and call the - <a class="permalink" href="#setsid"><code class="Fn" id="setsid">setsid</code></a>() - 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 - terminal.</p> - </dd> - <dt id="TIOCSTOP"><a class="permalink" href="#TIOCSTOP"><code class="Dv">TIOCSTOP</code></a> - <var class="Fa">void</var></dt> - <dd>Stop output on the terminal (like typing ^S at the keyboard).</dd> - <dt id="TIOCSTART"><a class="permalink" href="#TIOCSTART"><code class="Dv">TIOCSTART</code></a> - <var class="Fa">void</var></dt> - <dd>Start output on the terminal (like typing ^Q at the keyboard).</dd> - <dt id="TIOCSCTTY"><a class="permalink" href="#TIOCSCTTY"><code class="Dv">TIOCSCTTY</code></a> - <var class="Fa">void</var></dt> - <dd>Make the terminal the controlling terminal for the process (the process - must not currently have a controlling terminal).</dd> - <dt id="TIOCDRAIN"><a class="permalink" href="#TIOCDRAIN"><code class="Dv">TIOCDRAIN</code></a> - <var class="Fa">void</var></dt> - <dd>Wait until all output is drained.</dd> - <dt id="TIOCEXCL"><a class="permalink" href="#TIOCEXCL"><code class="Dv">TIOCEXCL</code></a> - <var class="Fa">void</var></dt> - <dd>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.</dd> - <dt id="TIOCNXCL"><a class="permalink" href="#TIOCNXCL"><code class="Dv">TIOCNXCL</code></a> - <var class="Fa">void</var></dt> - <dd>Clear exclusive use of the terminal. Further opens are permitted.</dd> - <dt id="TIOCFLUSH"><a class="permalink" href="#TIOCFLUSH"><code class="Dv">TIOCFLUSH</code></a> - <var class="Fa">int *what</var></dt> - <dd>If the value of the int pointed to by <var class="Fa">what</var> contains - the <code class="Dv">FREAD</code> bit as defined in - <code class="In"><<a class="In">sys/fcntl.h</a>></code>, then all - characters in the input queue are cleared. If it contains the - <code class="Dv">FWRITE</code> 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 <code class="Dv">FREAD</code> and - <code class="Dv">FWRITE</code> bits were set (i.e. clears both - queues).</dd> - <dt id="TIOCGWINSZ"><a class="permalink" href="#TIOCGWINSZ"><code class="Dv">TIOCGWINSZ</code></a> - <var class="Fa">struct winsize *ws</var></dt> - <dd>Put the window size information associated with the terminal in the - <var class="Va">winsize</var> structure pointed to by - <var class="Fa">ws</var>. 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 - <var class="Va">winsize</var> structure is defined in - <code class="In"><<a class="In">sys/ioctl.h</a>></code>.</dd> - <dt id="TIOCSWINSZ"><a class="permalink" href="#TIOCSWINSZ"><code class="Dv">TIOCSWINSZ</code></a> - <var class="Fa">struct winsize *ws</var></dt> - <dd>Set the window size associated with the terminal to be the value in the - <var class="Va">winsize</var> structure pointed to by - <var class="Fa">ws</var> (see above).</dd> - <dt id="TIOCGQSIZE"><a class="permalink" href="#TIOCGQSIZE"><code class="Dv">TIOCGQSIZE</code></a> - <var class="Fa">int *qsize</var></dt> - <dd>Get the current size of the tty input and output queues.</dd> - <dt id="TIOCSQSIZE"><a class="permalink" href="#TIOCSQSIZE"><code class="Dv">TIOCSQSIZE</code></a> - <var class="Fa">int *qsize</var></dt> - <dd>Set the size of the tty input and output queues. Valid sizes are between - <code class="Dv">1024</code> and <code class="Dv">65536</code> and input - values are converted to a power of two. All pending input and output is - dropped.</dd> - <dt id="TIOCCONS"><a class="permalink" href="#TIOCCONS"><code class="Dv">TIOCCONS</code></a> - <var class="Fa">int *on</var></dt> - <dd>If <var class="Fa">on</var> points to a non-zero integer, redirect kernel - console output (kernel printf's) to this terminal. If - <var class="Fa">on</var> points to a zero integer, redirect kernel console - output back to the normal console. This is usually used on workstations to - redirect kernel messages to a particular window.</dd> - <dt id="TIOCMSET"><a class="permalink" href="#TIOCMSET"><code class="Dv">TIOCMSET</code></a> - <var class="Fa">int *state</var></dt> - <dd>The integer pointed to by <var class="Fa">state</var> contains bits that - correspond to modem state. Following is a list of defined variables and - the modem state they represent: - <p class="Pp"></p> - <dl class="Bl-tag Bl-compact"> - <dt>TIOCM_LE</dt> - <dd>Line Enable.</dd> - <dt>TIOCM_DTR</dt> - <dd>Data Terminal Ready.</dd> - <dt>TIOCM_RTS</dt> - <dd>Request To Send.</dd> - <dt>TIOCM_ST</dt> - <dd>Secondary Transmit.</dd> - <dt>TIOCM_SR</dt> - <dd>Secondary Receive.</dd> - <dt>TIOCM_CTS</dt> - <dd>Clear To Send.</dd> - <dt>TIOCM_CAR</dt> - <dd>Carrier Detect.</dd> - <dt>TIOCM_CD</dt> - <dd>Carrier Detect (synonym).</dd> - <dt>TIOCM_RNG</dt> - <dd>Ring Indication.</dd> - <dt>TIOCM_RI</dt> - <dd>Ring Indication (synonym).</dd> - <dt>TIOCM_DSR</dt> - <dd>Data Set Ready.</dd> - </dl> - <p class="Pp">This call sets the terminal modem state to that represented by - <var class="Fa">state</var>. Not all terminals may support this.</p> - </dd> - <dt id="TIOCMGET"><a class="permalink" href="#TIOCMGET"><code class="Dv">TIOCMGET</code></a> - <var class="Fa">int *state</var></dt> - <dd>Return the current state of the terminal modem lines as represented above - in the integer pointed to by <var class="Fa">state</var>.</dd> - <dt id="TIOCMBIS"><a class="permalink" href="#TIOCMBIS"><code class="Dv">TIOCMBIS</code></a> - <var class="Fa">int *state</var></dt> - <dd>The bits in the integer pointed to by <var class="Fa">state</var> - represent modem state as described above, however the state is OR-ed in - with the current state.</dd> - <dt id="TIOCMBIC"><a class="permalink" href="#TIOCMBIC"><code class="Dv">TIOCMBIC</code></a> - <var class="Fa">int *state</var></dt> - <dd>The bits in the integer pointed to by <var class="Fa">state</var> - represent modem state as described above, however each bit which is on in - <var class="Fa">state</var> is cleared in the terminal.</dd> - <dt id="TIOCSFLAGS"><a class="permalink" href="#TIOCSFLAGS"><code class="Dv">TIOCSFLAGS</code></a> - <var class="Fa">int *state</var></dt> - <dd>The bits in the integer pointed to by <var class="Fa">state</var> contain - bits that correspond to serial port state. Following is a list of defined - flag values and the serial port state they represent: - <p class="Pp"></p> - <dl class="Bl-tag Bl-compact"> - <dt>TIOCFLAG_SOFTCAR</dt> - <dd>Ignore hardware carrier.</dd> - <dt>TIOCFLAG_CLOCAL</dt> - <dd>Set the <a class="Xr">termios(4)</a> <code class="Dv">CLOCAL</code> - flag on open.</dd> - <dt>TIOCFLAG_CRTSCTS</dt> - <dd>Set the <a class="Xr">termios(4)</a> <code class="Dv">CRTSCTS</code> - flag on open.</dd> - <dt>TIOCFLAG_MDMBUF</dt> - <dd>Set the <a class="Xr">termios(4)</a> <code class="Dv">MDMBUF</code> - flag on open.</dd> - </dl> - <p class="Pp">This call sets the serial port state to that represented by - <var class="Fa">state</var>. Not all serial ports may support this.</p> - </dd> - <dt id="TIOCGFLAGS"><a class="permalink" href="#TIOCGFLAGS"><code class="Dv">TIOCGFLAGS</code></a> - <var class="Fa">int *state</var></dt> - <dd>Return the current state of the serial port as represented above in the - integer pointed to by <var class="Fa">state</var>.</dd> -</dl> -</section> -</section> -<section class="Sh"> -<h1 class="Sh" id="COMPATIBILITY"><a class="permalink" href="#COMPATIBILITY">COMPATIBILITY</a></h1> -<p class="Pp">Two ioctls are maintained for backwards compatibility. They - provide methods to get and set the current line discipline, but are not - extensible.</p> -<dl class="Bl-tag"> - <dt id="TIOCSETD"><a class="permalink" href="#TIOCSETD"><code class="Dv">TIOCSETD</code></a> - <var class="Fa">int *ldisc</var></dt> - <dd>Change to the new line discipline pointed to by - <var class="Fa">ldisc</var>. The old list of available line disciplines - are listed in - <code class="In"><<a class="In">sys/ttycom.h</a>></code> and are: - <p class="Pp"></p> - <dl class="Bl-tag Bl-compact"> - <dt>TTYDISC</dt> - <dd>Termios interactive line discipline.</dd> - <dt>TABLDISC</dt> - <dd>Tablet line discipline.</dd> - <dt>SLIPDISC</dt> - <dd>Serial IP line discipline.</dd> - <dt>PPPDISC</dt> - <dd>Point to Point Protocol line discipline.</dd> - <dt>STRIPDISC</dt> - <dd>Starmode Radio IP line discipline.</dd> - </dl> - </dd> - <dt id="TIOCGETD"><a class="permalink" href="#TIOCGETD"><code class="Dv">TIOCGETD</code></a> - <var class="Fa">int *ldisc</var></dt> - <dd>Return the current line discipline in the integer pointed to by - <var class="Fa">ldisc</var>.</dd> -</dl> -</section> -<section class="Sh"> -<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE - ALSO</a></h1> -<p class="Pp"><a class="Xr">stty(1)</a>, <a class="Xr">ioctl(2)</a>, - <a class="Xr">tcgetattr(3)</a>, <a class="Xr">tcsetattr(3)</a>, - <a class="Xr">ttyaction(3)</a>, <a class="Xr">pty(4)</a>, - <a class="Xr">termios(4)</a>, <a class="Xr">ttys(5)</a>, - <a class="Xr">getty(8)</a>, <a class="Xr">linedisc(9)</a></p> -</section> -<section class="Sh"> -<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1> -<p class="Pp">A console typewriter device <span class="Pa">/dev/tty</span> and - asynchronous communication interfaces <span class="Pa">/dev/tty[0-5]</span> - first appeared in <span class="Ux">Version 1 AT&T UNIX</span>. - Separate dial-out device files were implemented in SunOS 4. They were cloned - by <span class="An">Charles M. Hannum</span> for <span class="Ux">NetBSD - 1.4</span>.</p> -</section> -</div> -<table class="foot"> - <tr> - <td class="foot-date">September 7, 2019</td> - <td class="foot-os">NetBSD 10.1</td> - </tr> -</table> |
