xref: /freebsd/share/man/man4/ng_tty.4 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
14cf49a43SJulian Elischer.\" Copyright (c) 1996-1999 Whistle Communications, Inc.
24cf49a43SJulian Elischer.\" All rights reserved.
34cf49a43SJulian Elischer.\"
44cf49a43SJulian Elischer.\" Subject to the following obligations and disclaimer of warranty, use and
54cf49a43SJulian Elischer.\" redistribution of this software, in source or object code forms, with or
64cf49a43SJulian Elischer.\" without modifications are expressly permitted by Whistle Communications;
74cf49a43SJulian Elischer.\" provided, however, that:
84cf49a43SJulian Elischer.\" 1. Any and all reproductions of the source or object code must include the
94cf49a43SJulian Elischer.\"    copyright notice above and the following disclaimer of warranties; and
104cf49a43SJulian Elischer.\" 2. No rights are granted, in any manner or form, to use Whistle
114cf49a43SJulian Elischer.\"    Communications, Inc. trademarks, including the mark "WHISTLE
124cf49a43SJulian Elischer.\"    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
134cf49a43SJulian Elischer.\"    such appears in the above copyright notice or in the software.
144cf49a43SJulian Elischer.\"
154cf49a43SJulian Elischer.\" THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
164cf49a43SJulian Elischer.\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
174cf49a43SJulian Elischer.\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
184cf49a43SJulian Elischer.\" INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
194cf49a43SJulian Elischer.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
204cf49a43SJulian Elischer.\" WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
214cf49a43SJulian Elischer.\" REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
224cf49a43SJulian Elischer.\" SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
234cf49a43SJulian Elischer.\" IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
244cf49a43SJulian Elischer.\" RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
254cf49a43SJulian Elischer.\" WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
264cf49a43SJulian Elischer.\" PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
274cf49a43SJulian Elischer.\" SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
284cf49a43SJulian Elischer.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
294cf49a43SJulian Elischer.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
304cf49a43SJulian Elischer.\" THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
314cf49a43SJulian Elischer.\" OF SUCH DAMAGE.
324cf49a43SJulian Elischer.\"
33eddc45e7SJeroen Ruigrok van der Werven.\" Author: Archie Cobbs <archie@FreeBSD.org>
344cf49a43SJulian Elischer.\" $Whistle: ng_tty.8,v 1.5 1999/01/25 23:46:28 archie Exp $
354cf49a43SJulian Elischer.\"
3655d25fa4SAlexander Motin.Dd December 25, 2008
37bec35b9aSArchie Cobbs.Dt NG_TTY 4
383d45e180SRuslan Ermilov.Os
394cf49a43SJulian Elischer.Sh NAME
404cf49a43SJulian Elischer.Nm ng_tty
419087c349SAndrew Thompson.Nd netgraph node type that is also a TTY hook
424cf49a43SJulian Elischer.Sh SYNOPSIS
43fbad9e2dSRuslan Ermilov.In sys/types.h
4432eef9aeSRuslan Ermilov.In sys/ttycom.h
4532eef9aeSRuslan Ermilov.In netgraph/ng_tty.h
464cf49a43SJulian Elischer.Sh DESCRIPTION
474cf49a43SJulian ElischerThe
484cf49a43SJulian Elischer.Nm tty
499087c349SAndrew Thompsonnode type is both a netgraph node type and a TTY hook.
504cf49a43SJulian Elischer.Pp
514cf49a43SJulian ElischerThe node has a single hook called
524cf49a43SJulian Elischer.Dv hook .
534cf49a43SJulian ElischerIncoming bytes received on the tty device are sent out on this hook,
544cf49a43SJulian Elischerand frames received on
554cf49a43SJulian Elischer.Dv hook
564cf49a43SJulian Elischerare transmitted out on the tty device.
574cf49a43SJulian ElischerNo modification to the data is performed in either direction.
589087c349SAndrew ThompsonWhile the hook is installed on a tty, the normal read and write
599087c349SAndrew Thompsonoperations are unavailable, returning
604cf49a43SJulian Elischer.Er EIO .
614cf49a43SJulian Elischer.Pp
629087c349SAndrew ThompsonIncoming data is delivered directly to ng_tty via the tty bypass hook as a
639087c349SAndrew Thompsonbuffer pointer and length, this is converted to a mbuf and passed to the peer.
649087c349SAndrew Thompson.Pp
6551291597SJulian ElischerThe node supports an optional
6651291597SJulian Elischer.Dq hot character .
679087c349SAndrew ThompsonIf the driver can not deliver data directly to the tty bypass hook then each
689087c349SAndrew Thompsoncharacter is input one at a time.
699087c349SAndrew ThompsonIf set to non-zero and bypass mode is unavailable, incoming
704cf49a43SJulian Elischerdata from the tty device is queued until this character is seen.
714cf49a43SJulian ElischerThis avoids sending lots of mbufs containing a small number of bytes,
724cf49a43SJulian Elischerbut introduces potentially infinite latency.
734cf49a43SJulian ElischerThe default hot character is 0x7e, consistent with
744cf49a43SJulian Elischer.Dv hook
754cf49a43SJulian Elischerbeing connected to a
76bec35b9aSArchie Cobbs.Xr ng_async 4
775203edcdSRuslan Ermilovtype node.
785203edcdSRuslan ErmilovThe hot character has no effect on the transmission of data.
794cf49a43SJulian Elischer.Sh HOOKS
804cf49a43SJulian ElischerThis node type supports the following hooks:
81c60bda17SJoel Dahl.Bl -tag -width ".Va hook"
82c60bda17SJoel Dahl.It Va hook
834cf49a43SJulian Elischer.Xr tty 4
844cf49a43SJulian Elischerserial data contained in
854cf49a43SJulian Elischer.Dv mbuf
864cf49a43SJulian Elischerstructures, with arbitrary inter-frame boundaries.
874cf49a43SJulian Elischer.El
884cf49a43SJulian Elischer.Sh CONTROL MESSAGES
894cf49a43SJulian ElischerThis node type supports the generic control messages, plus the following:
904cf49a43SJulian Elischer.Bl -tag -width foo
914cf49a43SJulian Elischer.It Dv NGM_TTY_SET_HOTCHAR
924cf49a43SJulian ElischerThis command takes an integer argument and sets the hot character
935203edcdSRuslan Ermilovfrom the lower 8 bits.
945203edcdSRuslan ErmilovA hot character of zero disables queueing,
954cf49a43SJulian Elischerso that all received data is forwarded immediately.
964cf49a43SJulian Elischer.It Dv NGM_TTY_GET_HOTCHAR
974cf49a43SJulian ElischerReturns an integer containing the current hot character in the lower
984cf49a43SJulian Elischereight bits.
999087c349SAndrew Thompson.It Dv NGM_TTY_SET_TTY
10055d25fa4SAlexander MotinThis command takes integer process ID and file descriptor of open tty
1019087c349SAndrew Thompsonand registers the tty hooks.
1023136363fSRuslan Ermilov.El
1034cf49a43SJulian Elischer.Sh SHUTDOWN
1049087c349SAndrew ThompsonThis node shuts down when the corresponding device is closed.
1054cf49a43SJulian Elischer.Sh SEE ALSO
1064cf49a43SJulian Elischer.Xr ioctl 2 ,
1074cf49a43SJulian Elischer.Xr netgraph 4 ,
108bec35b9aSArchie Cobbs.Xr ng_async 4 ,
1095521ff5aSRuslan Ermilov.Xr tty 4 ,
110bec35b9aSArchie Cobbs.Xr ngctl 8
11151291597SJulian Elischer.Sh HISTORY
11251291597SJulian ElischerThe
11351291597SJulian Elischer.Nm
11451291597SJulian Elischernode type was implemented in
11551291597SJulian Elischer.Fx 4.0 .
11651291597SJulian Elischer.Sh AUTHORS
117*6c899950SBaptiste Daroussin.An Archie Cobbs Aq Mt archie@FreeBSD.org
118*6c899950SBaptiste Daroussin.An Andrew Thompson Aq Mt thompsa@FreeBSD.org
1199cbda590SRuslan Ermilov.Sh BUGS
1209cbda590SRuslan ErmilovThe serial driver code also has a notion of a
1219cbda590SRuslan Ermilov.Dq hot character .
1229cbda590SRuslan ErmilovUnfortunately, this value is statically defined in terms of the
1239cbda590SRuslan Ermilovline discipline and cannot be changed.
1249cbda590SRuslan ErmilovTherefore, if a hot character other than 0x7e (the default) is set for the
1259cbda590SRuslan Ermilov.Nm
1269cbda590SRuslan Ermilovnode, the node has no way to convey this information to the
1279cbda590SRuslan Ermilovserial driver, and sub-optimal performance may result.
128