Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
termio(7)	       Miscellaneous Information Manual		     termio(7)

NAME
       termio, termios - general terminal interface

DESCRIPTION
       All HP-UX asynchronous communications ports use the same	general	inter-
       face, regardless	of what	hardware  is  involved.	  Network  connections
       such as (see rlogin(1) use the pseudo-terminal interface	(see pty(7).

       This discussion centers around the common features of this interface.

   Opening a Terminal File
       When  a terminal	file is	opened,	it normally causes the process to wait
       until a connection is established.  In practice,	users' programs	seldom
       open  these  files;  they  are  opened by special programs such as (see
       getty(1M)) and become a user's standard	input,	standard  output,  and
       standard	error files.

       If both the and flags (see open(2)) are clear, an open blocks until the
       type of modem connection	requested (see modem(7)) is completed.	If ei-
       ther  the or flag is set, an open succeeds and return immediately with-
       out waiting for the requested modem connection to complete.   The  flag
       (see can	also affect open(2).

   Process Groups
       A  terminal  can	 have  a  foreground process group associated with it.
       This foreground process group plays a special role in handling  signal-
       generating input	characters.

       Command	interpreter  processes	can allocate the terminal to different
       jobs (process groups) by	placing	related	processes in a single  process
       group  and  associating this process group with the terminal.  A	termi-
       nal's foreground	process	group can be set or examined by	a process, as-
       suming  that  the permission requirements are met (see tcsetpgrp(3C) or
       tcgetpgrp(3C)).	The terminal interface aids in this allocation by  re-
       stricting access	to the terminal	by processes that are not in the fore-
       ground process group.

       A process group is considered orphaned when the parent of every	member
       of  the process group is	either itself a	member of the process group or
       is not a	member of the group's session (see Sessions).

   Sessions
       A process that creates a	session	(see setsid(2) or setpgrp(2))  becomes
       a  session leader.  Every process group belongs to exactly one session.
       A process is considered to be a member of  the  session	of  which  its
       process	group  is a member.  A newly created process joins the session
       of its parent.  A  process  can	change	its  session  membership  (see
       setpgid(2)  or  setpgrp(2)).   Usually a	session	comprises all the pro-
       cesses (including children) created as a	result of a single login.

   The Controlling Terminal
       A terminal can belong to	a process as its controlling  terminal.	  Each
       process	of a session that has a	controlling terminal has the same con-
       trolling	terminal.  A terminal can be the controlling terminal  for  at
       most  one session.  The controlling terminal for	a session is allocated
       by the session leader.  If a session leader has no controlling terminal
       and  opens a terminal device file that is not already associated	with a
       session without using the option	(see open(2), the terminal becomes the
       controlling  terminal  of  the  session	and the	controlling terminal's
       foreground process group	is set to the process  group  of  the  session
       leader.	While a	controlling terminal is	associated with	a session, the
       session leader is said to be the	controlling process of the controlling
       terminal.

       The  controlling	terminal is inherited by a child process during	a (see
       fork(2)).  A process relinquishes its controlling terminal if  it  cre-
       ates  a new session with	or (see	setsid(2) and setpgrp(2)), or when all
       file descriptors	associated with	the  controlling  terminal  have  been
       closed.

       When  the  controlling  process terminates, the controlling terminal is
       disassociated from the current session, allowing	it to be acquired by a
       new  session  leader.   A  signal is sent to all	processes in the fore-
       ground process group of the controlling terminal.  Subsequent access to
       the  terminal  by  other	processes in the earlier session can be	denied
       (see with attempts to access the	terminal treated as if a modem discon-
       nect had	been sensed.

   Terminal Access Control
       Read  operations	 are  allowed  (see  from  processes in	the foreground
       process group of	their controlling terminal.  If	a process  is  not  in
       the  foreground	process	group of its controlling terminal, the process
       and all member's	of its process group are considered to be in  a	 back-
       ground  process	group of this controlling terminal.  All attempts by a
       process in a background process group to	read from its controlling ter-
       minal will be denied.  If denied	and the	reading	process	is ignoring or
       blocking	the signal, or the process (on systems	that  implement	 vfork
       separately  from	fork) has made a call to vfork(2) but has not yet made
       a call to exec(2), or the process group of the reading process  is  or-
       phaned, returns -1 with set to EIO and no signal	is sent.  In all other
       cases where the read is	denied,	 the  process  group  of  the  reading
       process	will be	sent a signal.	The default action of the signal is to
       stop the	process	to which it is sent.

       If the process is in the	foreground process group  of  its  controlling
       terminal,  write	operations are allowed (see Attempts by	a process in a
       background process group	to write to its	controlling terminal  are  de-
       nied  if	 (see is set, the process is not ignoring and not blocking the
       signal, and the process (on systems  that  implement  vfork  separately
       from  fork) has not made	a call to vfork(2) without making a subsequent
       call to exec(2).	 If the	write is denied	 and  the  background  process
       group  is  orphaned,  the returns -1 with set to	If the write is	denied
       and the background process group	is not orphaned, the signal is sent to
       the  process  group  of the writing process.  The default action	of the
       signal is to stop the process to	which it is sent.

       Certain calls that set terminal parameters  are	treated	 in  the  same
       fashion	as write, except that is ignored; that is, the effect is iden-
       tical to	that of	terminal writes	when is	set.

   Input Processing and	Reading	Data
       A terminal device associated with a terminal device file	can operate in
       full-duplex  mode,  so  that data can arrive, even while	data output is
       occurring.  Each	terminal device	file has  an  input  queue  associated
       with  it	 into which incoming data is stored by the system before being
       read by a process.  The system imposes a	limit, on the number of	 char-
       acters  that can	be stored in the input queue.  This limit is dependent
       on the particular implementation, but is	at least 256.  When the	 input
       limit is	reached, all saved characters are discarded without notice.

       All  input  is processed	either in canonical mode or non-canonical mode
       (see Canonical Mode Input Processing and	Additionally, input characters
       are processed according to the (see and (see fields.  For example, such
       processing can include echoing, which in	general	means transmitting in-
       put  characters immediately back	to the terminal	when they are received
       from the	terminal.  This	is useful for terminals	that operate in	 full-
       duplex mode.

       The manner in which data	is provided to a process reading from a	termi-
       nal device file depends on whether  the	terminal  device  file	is  in
       canonical or non-canonical mode.

       Another	dependency  is whether the or flag is set by either open(2) or
       fcntl(2).  If the and flags are both clear, the read request is blocked
       until data is available or a signal is received.	 If either the or flag
       is set, the read	request	completes without blocking  in	one  of	 three
       ways:

	      o	 If  there  is enough data available to	satisfy	the entire re-
		 quest,	completes successfully,	having read all	 of  the  data
		 requested, and	returns	the number of characters read.

	      o	 If  there  is not enough data available to satisfy the	entire
		 request, completes successfully, having read as much data  as
		 possible, and returns the number of characters	read.

	      o	 If  there  is no data available, returns -1, with set to when
		 the flag is set.  Otherwise, (flag is clear and is set)  com-
		 pletes	successfully, having read no data, and returns a count
		 of 0.

       The availability	of data	depends	upon whether the input processing mode
       is  canonical  or  non-canonical.  The following	sections, and describe
       each of these input processing modes.  In canonical mode	input process-
       ing, terminal input is processed	in units of lines, where a line	is de-
       limited by a new-line (NL) character, an	end-of-file  (EOF)  character,
       or  an  end-of-line  character (EOL) or (EOL2).	See Special Characters
       for more	information on and This	means that a read request does not re-
       turn until an entire line has been typed	or a signal has	been received.
       Also, no	matter how many	characters are requested in the	read call,  at
       most  one line will be returned.	 It is not, however, necessary to read
       a whole line at once; any number	of characters can be  requested	 in  a
       read, even one, without losing information.

       is  the limit on	the number of characters in a line.  This limit	varies
       with each particular implementation, but	is at least 256.

       When the	limit is reached, all characters in  the  current  undelimited
       line are	discarded without notice.

       Erase  and  kill	processing occur when any of three special characters,
       the ERASE, WERASE, or KILL characters (see is received.	This  process-
       ing  affects data in the	input queue that has not yet been delimited by
       a NL, EOF, EOL, or EOL2 character.  This	undelimited data makes up  the
       current	line.	The  ERASE character deletes the last character	in the
       current line, if	one exists.  The WERASE	 character  deletes  the  last
       word in the current line, if one	exists.	 A word	is defined as a	series
       of non-blank characters (tabs are  equivalent  to  blanks).   The  KILL
       character  deletes all data in the current line,	if any,	and optionally
       outputs a new-line (NL) character.  These characters operate on a  key-
       stroke  basis,  independent of any backspacing or tabbing that may have
       preceded	them.  ERASE, WERASE, and KILL characters have	no  effect  if
       the  current line is empty.  ERASE, WERASE, and KILL characters are not
       placed in the input queue.  In non-canonical mode input processing, in-
       put  characters	are  not assembled into	lines, and erase and kill pro-
       cessing does not	occur.	The values of the and  members	of  the	 array
       (see  are  used	to  determine  how to process the characters received.
       represents the minimum number of	characters that	should be received be-
       fore  successfully returns.  TIME is a timer of 0.10 second granularity
       that is used to timeout bursty and short	term data transmissions.   The
       four  possible  cases  for  MIN and TIME	and their interactions are de-
       scribed below.

       Case A: MIN > 0,	TIME > 0

       In this case, TIME serves as an inter-character timer and is  activated
       after  the first	character is received.	Since it is an inter-character
       timer, it is reset after	each character is received.   The  interaction
       between MIN and TIME is as follows:

	      o	 As  soon  as  one  character is received, the inter-character
		 timer is started.

	      o	 If MIN	characters are	received  before  the  inter-character
		 timer	expires	(remember that the timer is reset upon receipt
		 of each character), the read is satisfied.  If	the timer  ex-
		 pires	before MIN characters are received, the	characters re-
		 ceived	to that	point are returned to the user.

	      o	 Note that if TIME expires, at least one character will	be re-
		 turned	because	the timer would	not have been enabled unless a
		 character was received.  In this case ( MIN > 0, TIME >  0  )
		 the  read  blocks until the MIN and TIME mechanisms are acti-
		 vated by the receipt of the first character, or a  signal  is
		 received.

       Case B: MIN > 0,	TIME = 0

       In  this	case, since the	value of TIME is zero, the timer plays no role
       and only	MIN is significant.  A pending read is not satisfied until MIN
       characters are received after any previous read completes (that is, the
       pending read blocks until MIN characters	are received), or a signal  is
       received.   A program that uses this case to handle record-based	termi-
       nal I/O can block indefinitely in the read operation.

       Case C: MIN = 0,	TIME > 0

       In this case, since the value of	MIN is zero, TIME no longer represents
       an  inter-character timer.  It now serves as a read timer that is acti-
       vated as	soon as	the function is	processed.  A  read  is	 satisfied  as
       soon  as	 a single character is received	or the read timer expires.  If
       the timer expires, no character is returned.  If	the timer does not ex-
       pire,  the  only	 way the read can be satisfied is by a character being
       received.  A read cannot	block indefinitely waiting for a character be-
       cause  if no character is received within TIME x	0.10 seconds after the
       read is initiated, returns a value of zero, having read no data.

       Case D: MIN = 0,	TIME = 0

       The number of characters	requested or the  number  of  characters  cur-
       rently  available,  whichever  is less, is returned without waiting for
       more characters to be input.  If	no characters are available, returns a
       value of	zero, having read no data.

       Some points to note about MIN and TIME:

	      1.   In the above	explanations, the interactions of MIN and TIME
		   are not symmetric. For example, when	MIN > 0	and TIME =  0,
		   TIME	 has  no  effect.  However, in the opposite case where
		   MIN = 0 and TIME > 0, both MIN and TIME play	a role in that
		   MIN is satisfied with the receipt of	a single character.

	      2.   Also	note that in case A ( MIN > 0, TIME > 0	), TIME	repre-
		   sents an inter-character timer while	in case	C ( MIN	 =  0,
		   TIME	> 0 ), TIME represents a read timer.

       These  two  points  highlight the dual purpose of the MIN/TIME feature.
       Cases A and B (where MIN	> 0 ) exist  to	 handle	 burst	mode  activity
       (such  as file transfer programs) where a program would like to process
       at least	MIN characters at a time.   In	case  A,  the  inter-character
       timer  is activated by a	user as	a safety measure while in case B it is
       turned off.

       Cases C and D exist to handle single character timed transfers.	 These
       cases  are  readily adaptable to	screen-based applications that need to
       know if a character is present in the input queue before	refreshing the
       screen.	In case	C the read is timed, while in case D it	is not.

       Another	important  note	is that	MIN is always just a minimum.  It does
       not denote a record length.  For	example, if a program initiates	a read
       of 20 characters	when MIN is 10 and 25 characters are present, 20 char-
       acters will be returned to the user.  Had  the  program	requested  all
       characters, all 25 characters would be returned to the user.

       Furthermore,  if	 TIME is greater than zero and MIN is greater than the
       read will never terminate as a result of	MIN characters being  received
       because	all  the saved characters are discarded	without	notice when is
       exceeded.  If TIME is zero and MIN is greater than the read will	 never
       terminate unless	a signal is received.

   Special Characters
       Certain	characters  have  special functions on input, output, or both.
       Unless specifically denied, each	special	character can  be  changed  or
       disabled.   To  disable	a character, set its value to (see unistd(5)).
       These special functions and their default character values are:

	  INTR		 (Rubout or ASCII DEL) special character on input  and
			 is recognized if (see is enabled.  Generates a	signal
			 which is sent to  all	processes  in  the  foreground
			 process  group	for which the terminal is the control-
			 ling terminal.	 Normally, each	such process is	forced
			 to  terminate,	but arrangements can be	made to	either
			 ignore	or hold	the signal, or to receive a trap to an
			 agreed-upon  location;	 see  signal(2)	and signal(5).
			 If is set, the	INTR character is discarded when  pro-
			 cessed.  If is	clear, the INTR	character is processed
			 as a normal data character, and no signal is sent.

	  QUIT		 (Ctrl-| or ASCII  FS)	special	 character  on	input.
			 Recognized  if	 (see  is  set.	 The treatment of this
			 character is identical	to that	of the INTR  character
			 except	 that  a signal	is generated and the processes
			 that receive this signal are not only terminated, but
			 a  core  image	file (called is	created	in the current
			 working directory if the implementation supports core
			 files.

	  SWTCH		 (ASCII	 NUL)  special	character on input and is only
			 used by the shell layers facility shl(1).  The	 shell
			 layers	 facility  is not part of the general terminal
			 interface.  No	special	functions are performed	by the
			 general  terminal interface when SWTCH	characters are
			 encountered.

	  ERASE		 special character on input and	is recognized if  (see
			 is  enabled.	Erases	the preceding character.  Does
			 not erase beyond the start of a line, as delimited by
			 a  NL,	 EOF,  EOL, or EOL2 character.	If is enabled,
			 the ERASE character is	discarded when processed.   If
			 is  not  enabled, the ERASE character is treated as a
			 normal	data character.

	  WERASE	 (disabled) special character on input and  is	recog-
			 nized if (see is enabled.  Erases the preceding word.
			 Does not erase	beyond the start of a line, as	delim-
			 ited by a NL, EOF, EOL, or EOL2 character.  If	is en-
			 abled,	the WERASE character is	 discarded  when  pro-
			 cessed.   If  is not enabled, the WERASE character is
			 treated as a normal data character.

	  KILL		 special character on input and	is  recognized	if  is
			 enabled.   KILL deletes the entire line, as delimited
			 by a NL, EOF, EOL, or EOL2 character.	If is enabled,
			 the  KILL  character is discarded when	processed.  If
			 is not	enabled, the KILL character is	treated	 as  a
			 normal	data character.

	  EOF		 (Control-D  or	 ASCII EOT) special character on input
			 and is	recognized if is enabled.  EOF can be used  to
			 generate  an  end-of-file  from a terminal.  When re-
			 ceived, all the characters waiting to be read are im-
			 mediately passed to the program without waiting for a
			 new-line, and the EOF is discarded.  Thus,  if	 there
			 are no	characters waiting, (that is, the EOF occurred
			 at the	beginning of a line) a character count of zero
			 is  returned from representing	an end-of-file indica-
			 tion.	If is enabled, the EOF character is  discarded
			 when processed.  If is	not enabled, the EOF character
			 is treated as a normal	data character.

	  NL		 (ASCII	LF) special character on input and  is	recog-
			 nized	if  flag is enabled.  It is the	line delimiter
			 If is not enabled, the	NL character is	treated	 as  a
			 normal	data character.

	  EOL		 (ASCII	 NUL) special character	on input and is	recog-
			 nized if is enabled.  EOL is an additional  line  de-
			 limiter  similar to NL.  It is	not normally used.  If
			 is not	enabled, the EOL character  is	treated	 as  a
			 normal	data character.

	  EOL2		 (disabled)  special  character	on input and is	recog-
			 nized if is enabled.  EOL2 is an additional line  de-
			 limiter similar to EOL.  It is	not normally used.  If
			 is not	enabled, the EOL2 character is	treated	 as  a
			 normal	data character.

	  SUSP		 (disabled) special character recognized on input.  If
			 is enabled, receipt of	the SUSP  character  causes  a
			 signal	 to be sent to all processes in	the foreground
			 process group for which the terminal is the  control-
			 ling  terminal,  and  the SUSP	character is discarded
			 when processed.  If is	not enabled, the SUSP  charac-
			 ter  is  treated as a normal data character.  Command
			 interpreter processes typically set SUSP to  Control-
			 Z.

	  DSUSP		 (disabled) special character recognized on input.  If
			 is enabled, and a process in the  foreground  process
			 group	attempts to read the DSUSP character, a	signal
			 is sent to all	processes in  the  foreground  process
			 group	for which the terminal is the controlling ter-
			 minal,	and the	DSUSP character	is then	discarded.  If
			 is  not  enabled, the DSUSP character is treated as a
			 normal	data character.	 Note that DSUSP is similar to
			 SUSP except that the signal is	sent when a process in
			 the foreground	process	group  attempts	 to  read  the
			 DSUSP character, rather than when it is typed.

	  STOP		 (Control-S  or	 ASCII	DC3) special character on both
			 input and output.  If (output	control)  is  enabled,
			 processing of the STOP	character temporarily suspends
			 output	to the terminal	device.	 This is  useful  with
			 CRT terminals to prevent output from disappearing be-
			 fore it can be	read.  While output is	suspended  and
			 is enabled, STOP characters are ignored and not read.
			 If is enabled,	the STOP character is  discarded  when
			 processed.   If is not	enabled, the STOP character is
			 treated as a normal data character.  If  (input  con-
			 trol)	is  enabled, the system	sends a	STOP character
			 to the	terminal device	 when  the  number  of	unread
			 characters in the input queue is approaching a	system
			 specified limit.  This	is an attempt to prevent  this
			 buffer	 from  overflowing by telling the terminal de-
			 vice to stop sending data.

	  START		 (Control-Q or ASCII DC1) special  character  on  both
			 input	and  output.   If (output control) is enabled,
			 processing of the START character resumes output that
			 has  been  suspended.	 While output is not suspended
			 and is	enabled, START characters are ignored and  not
			 read.	 If  is	 enabled,  the START character is dis-
			 carded	when processed.	 If is not enabled, the	 START
			 character  is treated as a normal data	character.  If
			 IXOFF (input control) is enabled, the system sends  a
			 START character to the	terminal device	when the input
			 queue has drained to a	certain	system-defined	level.
			 This occurs when the input queue is no	longer in dan-
			 ger of	possibly overflowing.

	  CR		 (ASCII	CR) special character on input	is  recognized
			 if  is	 enabled.  When	and are	enabled	and is not en-
			 abled,	this character is translated into  a  NL,  and
			 has  the same affect as the NL	character.  If and are
			 enabled, the CR character is ignored.	If is  enabled
			 and  both  and	 are  not enabled, the CR character is
			 treated as a normal data character.

	  LNEXT		 (disabled) special  character	recognized  on	input.
			 Causes	 the  special meaning of the next character to
			 be ignored.  This works for  all  special  characters
			 specified  above.   It	 allows	characters to be input
			 that would otherwise be interpreted by	the system for
			 a special function.

       The special characters are assigned their default character values when
       the terminal port is opened.  The default values	used are those	speci-
       fied  by	 the System V Interface	Definition, Third Edition (SVID3), ex-
       cept for	the WERASE (Ctrl-W) and	LNEXT (Ctrl-V)	characters  which  are
       set  to	_POSIX_VDISABLE	to maintain binary compatibility with previous
       releases	of HP-UX.  The default character values	assigned when the port
       is  opened  can be changed for all ports	on a system wide basis through
       the use of the command (see stty(1)).  The character values may also be
       changed	for a specific port after it is	opened using the command.  The
       NL and CR characters cannot be changed or disabled.  The	character val-
       ues  for	the remaining special characters can be	changed	or disabled to
       suit individual tastes.

       If is set (see the ERASE, KILL, and EOF characters can be escaped by  a
       preceding  character,  in  which	case no	special	function is performed.
       These characters, and the remaining special characters, may also	be es-
       caped by	preceding them with the	LNEXT character	(see LNEXT above).

       If  two	or  more  special characters have the same value, the function
       performed when the character is processed is undefined.

   Modem Disconnect
       If a modem disconnect is	detected by the	terminal interface for a  con-
       trolling	 terminal,  and	if is clear in the field for the terminal (see
       the signal is sent to the controlling process of	the controlling	termi-
       nal.   Unless  other  arrangements have been made, this causes the con-
       trolling	process	to terminate.  Any subsequent read from	 the  terminal
       device  returns	with  an  end-of-file  indication  until the device is
       closed.	Thus, processes	that read a terminal file and test for end-of-
       file can	terminate appropriately	after a	disconnect.  Any subsequent to
       the terminal device returns -1, with set	to EIO,	until  the  device  is
       closed.

   Closing a Terminal Device File
       The  last process to close a terminal device file causes	any output not
       already sent to the device to be	sent to	the device even	if output  was
       suspended.  This	last close always blocks (even if non-blocking I/O has
       been specified) until all output	has been sent to the terminal  device.
       Any input that has been received	but not	read is	discarded.

   Writing Data	and Output Processing
       When  characters	 are  written,	they  are  placed on the output	queue.
       Characters on the output	queue are transmitted to the terminal as  soon
       as  previously-written  characters are sent.  These characters are pro-
       cessed according	to the field  (see  Input  characters  are  echoed  by
       putting them in the output queue	as they	arrive.	 If a process produces
       characters for output more rapidly than they can	be sent,  the  process
       is  suspended when its output queue exceeds some	limit.	When the queue
       has drained down	to some	threshold, the process is resumed.

   termios Structure
       Routines	that need to control certain terminal I/O characteristics  can
       do  so  by using	the structure as defined in the	header file The	struc-
       ture is defined as follows:

	      #define NCCS	16
	      struct  termios	{
		      tcflag_t	c_iflag;     /*	input modes */
		      tcflag_t	c_oflag;     /*	output modes */
		      tcflag_t	c_cflag;     /*	control	modes */
		      tcflag_t	c_lflag;     /*	local modes */
		      tcflag_t	c_reserved;  /*	reserved for future use	*/
		      cc_t	c_cc[NCCS];  /*	control	chars */
	      };

       The special characters are defined by the array The relative  positions
       and default values for each special character function are as follows:

	    INTR     VINTR     DEL
	    QUIT     VQUIT     Control-|
	    ERASE    VERASE    #
	    KILL     VKILL     @
	    EOF	     VEOF      Control-D
	    EOL	     VEOL      NUL
	    EOL2     VEOL2     disabled
	    MIN	     VMIN      NUL
	    TIME     VTIME     Control-D
	    SUSP     VSUSP     disabled
	    START    VSTART    Control-Q
	    STOP     VSTOP     Control-S
	    WERASE   VWERASE   disabled
	    LNEXT    VLNEXT    disabled
	    DSUSP    VDSUSP    disabled

   termio Structure
       The  structure has been superseded by the structure and is provided for
       backward	compatibility with prior applications (see  The	 structure  is
       defined in the header file and is defined as follows:

	      #define NCC     8
	      struct  termio  {
		      unsigned short  c_iflag;	  /* input modes */
		      unsigned short  c_oflag;	  /* output modes */
		      unsigned short  c_cflag;	  /* control modes */
		      unsigned short  c_lflag;	  /* local modes */
		      char	      c_line;	  /* line discipline */
		      unsigned char   c_cc[NCC];  /* control chars */
	      };

   Modes
       The  next  four sections	describe the specific terminal characteristics
       that can	be set using the and structures	(see Any  bits	in  the	 modes
       fields  that  are  not  explicitly defined below	are ignored.  However,
       they should always be clear to prevent future compatibility problems.

   Input Modes
       The field describes the basic terminal input control:

	      Ignore break condition.
	      Signal interrupt on break.
	      Ignore characters	with parity errors.
	      Mark parity errors.
	      Enable input parity check.
	      Strip character.
	      Map	     NL	to CR on input.
	      Ignore	     CR.
	      Map	     CR	to NL on input.
	      Map uppercase to lowercase on input.
	      Enable start/stop	output control.
	      Enable any character to restart output.
	      Enable start/stop	input control.
	      Enable	     BEL on input line too long.

       A break condition is defined as a sequence of zero-value	bits that con-
       tinues  for  more  than	the time to send one character.	For example, a
       character framing or parity error with data all zeros is	interpreted as
       a single	break condition.

       If  is set, the break condition is ignored.  Therefore the break	condi-
       tion cannot be read by any process.  If is clear	and is set, the	 break
       condition flushes both the input	and output queues and, if the terminal
       is the controlling terminal of a	foreground process  group,  the	 break
       condition  generates  a single signal to	that foreground	process	group.
       If neither nor is set, a	break condition	is read	as a single character,
       or if is	set, as	the three-character sequence

       If  is set, characters with other framing and parity errors (other than
       break) are ignored.

       If is set, and is clear,	a character with a  framing  or	 parity	 error
       (other  than break) is read as the three-character sequence: X, where X
       is the data of the character received in	error.	To avoid ambiguity  in
       this case, if is	clear, a valid character of is read as If both and are
       clear, a	framing	or parity error	(other than  break)  is	 read  as  the
       character

       If is set, input	parity checking	is enabled.  If	is clear, input	parity
       checking	is disabled.  Whether input parity checking is enabled or dis-
       abled is	independent of whether parity detection	is enabled or disabled
       (see If is set (see and is clear, parity	generation is enabled but  in-
       put  parity checking is disabled; the hardware to which the terminal is
       connected will recognize	the parity bit,	but the	terminal special  file
       will not	check whether this bit is set correctly	or not.

       The  following  table shows the interrelationship between the flags and
       The column marked Input gives various types  of	input  characters  re-
       ceived, indicated as follows:

	      NUL     character
	      Character	other than
		      NUL
	      Parity error detected
	      Framing error detected

       Items  enclosed	in brackets indicate one or more of the	conditions are
       true.

       If the flag is clear, characters	received with parity  errors  are  not
       processed  according  to	this table, but	instead, as if no parity error
       had occurred.  Under the	flag columns, indicates	the flag is set, indi-
       cates  the flag is not set, and indicates the flag may be set or	clear.
       The column labeled shows	the results that will be passed	to the	appli-
       cation  code.   A -- indicates that no character	or condition is	passed
       to the application code.	 The value indicates that no character is  re-
       turned,	but that the signal is sent to the foreground process group of
       the controlling terminal.

	    Input    IGNBRK   BRKINT   IGNPAR	PARMRK	       Read
	    --------------------------------------------------------------
	    0[PF]     Set	X	 X	  X		--
	    0[PF]    Clear     Set	 X	  X	      SIGINT
	    0[PF]    Clear    Clear	 X	 Set	 '\377','\0','\0'
	    0[PF]    Clear    Clear	 X	Clear	       '\0'
	    C[PF]      X	X	Set	  X		--
	    C[PF]      X	X      Clear	 Set	  '\377','\0',C
	    C[PF]      X	X      Clear	Clear	       '\0'
	    '\377'     X	X	 X	 Set	  '\377','\377'

       If is set, valid	input characters are first stripped to 7-bits,	other-
       wise all	8-bits are processed.

       If  is  set, a received NL character is translated into a CR character.
       If is set, a received CR	character is ignored (not read).  If is	 clear
       and is set, a received CR character is translated into a	NL character.

       If is set, a received uppercase alphabetic character is translated into
       the corresponding lowercase character.

       If is set, start/stop output control is enabled.	 A received STOP char-
       acter  suspends	output and a received START character restarts output.
       If and are set, any input character without a framing or	 parity	 error
       restarts	 output	 that  has been	suspended.  When these three flags are
       set, output suspended, and an input character received with  a  framing
       or  parity error, output	resumes	if processing it results in data being
       read.  When is set, START and STOP characters are not read, but	merely
       perform	flow  control  functions.   When  is clear, the	START and STOP
       characters are read.

       If is set, start/stop input control is enabled.	The system transmits a
       STOP character when the number of characters in the input queue exceeds
       a system	defined	value (high water mark).  This is  intended  to	 cause
       the  terminal  device to	stop transmitting data in order	to prevent the
       number of characters in the input  queue	 from  exceeding  When	enough
       characters have been read from the input	queue that the number of char-
       acters remaining	is less	than another system defined value  (low	 water
       mark),  the  system  transmits  a  START	character which	is intended to
       cause the terminal device to resume transmitting	data (without risk  of
       overflowing the input queue).  In order to avoid	potential deadlock, is
       ignored in canonical mode whenever there	is no line  delimiter  in  the
       input buffer.  In this case, the	STOP character is not sent at the high
       water mark, but will be transmitted later if a delimiter	 is  received.
       If all complete lines are read from the input queue leaving only	a par-
       tial line with no line delimiter, the START character is	sent, even  if
       the  number  of	characters  is	still greater than the low water mark.
       When is set and the input stream	contains more characters between  line
       delimiters  than	the high water mark allows, there is no	guarantee that
       can prevent buffer overflow and data loss, because the  STOP  character
       may not be sent in time,	if at all.

       If  is  set, the	ASCII BEL character is echoed if the input queue over-
       flows.  Further input is	not stored, but	any input present in the input
       queue is	not discarded.	If is clear, no	ASCII BEL character is echoed,
       and the input already present in	the input queue	is discarded when  the
       input queue overflows.

       The initial input control value is all bits clear.

   Output Modes
       The field specifies the system treatment	of output:

	      Postprocess output.
	      Map lowercase to uppercase on output.
	      Map	     NL	to CR-NL on output.
	      Map	     CR	to NL on output.
	      No	     CR	output at column 0.
	      NL	     performs CR function.
	      Use fill characters for delay.
	      Fill is	     DEL, else NUL.
	      Select new-line delays:
	      No delay
	      Delay type 1
	      Select carriage-return delays:
	      No delay
	      Delay type 1
	      Delay type 2
	      Delay type 3
	      Select horizontal-tab delays:
	      No delay
	      Delay type 1
	      Delay type 2
	      Expand tabs to spaces.
	      Expand tabs to spaces.
	      Select backspace delays:
	      No delay
	      Delay type 1
	      Select vertical-tab delays:
	      No delay
	      Delay type 1
	      Select form-feed delays:
	      No delay
	      Delay type 1

       If is set, output characters are	post-processed as indicated by the re-
       maining flags; otherwise	characters are transmitted without change.

       If is set, a lowercase alphabetic character is transmitted as the  cor-
       responding  uppercase  character.   This	function is often used in con-
       junction	with

       If is set, the NL character is transmitted as the CR-NL character pair.
       If  is set, the CR character is transmitted as the NL character.	 If is
       set, no CR character is transmitted when	at column 0 (first  position).
       If  is set, the NL character is assumed to do the carriage-return func-
       tion; the column	pointer	will be	set to 0, and the delays specified for
       CR  will	 be used.  If is clear,	the NL character is assumed to perform
       only the	line-feed function; the	delays specified for NL	are  used  and
       the column pointer remains unchanged.  For all of these cases, the col-
       umn pointer is always set to 0 if the CR	character is  actually	trans-
       mitted.

       The delay bits specify how long transmission stops to allow for mechan-
       ical or other movement when certain characters are sent to  the	termi-
       nal.  The values	of and FF0 indicate no delay.  If is set, fill charac-
       ters are	transmitted for	delay instead of a timed delay.	 This is  use-
       ful  for	 high baud rate	terminals, that	need only a minimal delay.  If
       is set, the fill	character is DEL; otherwise NUL.

       If a form-feed or vertical-tab delay is specified, it lasts for about 2
       seconds.

       New-line	 delay	lasts  about 0.10 seconds.  If is set, carriage-return
       delays are used instead of the new-line delays.	If is  set,  two  fill
       characters are transmitted.

       Carriage-return	delay  type  1 depends on the current column position;
       type 2 is about 0.10 seconds; type 3 about 0.15 seconds.	  If  is  set,
       delay  type  1 transmits	two fill characters; type 2, four fill charac-
       ters.

       Horizontal-tab delay type 1 is depends on the current column  position.
       Type  2 is about	0.10 seconds; type 3 specifies that tabs are to	be ex-
       panded into spaces.  If is set, two fill	characters are transmitted for
       any delay.

       Backspace  delay	lasts about 0.05 seconds.  If is set, one fill charac-
       ter is transmitted.

       The actual delays depend	on line	speed and system load.

       The initial output control value	is all bits clear.

   Control Modes
       The field describes the hardware	control	of the terminal:

		CBAUD	 Baud rate:   CSIZE    Character size:
		B0	 Hang up      CS5      5 bits
		B50	 50 baud      CS6      6 bits
		B75	 75 baud      CS7      7 bits
		B110	 110 baud     CS8      8 bits
		B134	 134.5 baud
		B150	 150 baud     CSTOPB   Send two	stop bits, else	one.
		B200	 200 baud     CREAD    Enable receiver.
		B300	 300 baud     PARENB   Parity enable.
		B600	 600 baud     PARODD   Odd parity, else	even.
		B900	 900 baud     HUPCL    Hang up on last close.
		B1200	 1200 baud    CLOCAL   Local line, else	dial-up.
		B1800	 1800 baud    LOBLK    Reserved	for use	by shl(1).
		B2400	 2400 baud
		B3600	 3600 baud
		B4800	 4800 baud
		B7200	 7200 baud
		B9600	 9600 baud
		B19200	 19200 baud
		B38400	 38400 baud
		EXTA	 External A
		EXTB	 External B

       The CBAUD bits specify the baud rate.  The zero baud rate, is  used  to
       hang  up	the connection.	 If is specified, the modem control lines (see
       modem(7)) cease to be asserted.	Normally, this disconnects  the	 line.
       For  any	particular hardware, impossible	speed changes are ignored.  is
       provided	for use	with the structure.  When the structure	is used,  sev-
       eral  routines are available for	setting	and getting the	input and out-
       put baud	rates (see

       The bits	specify	the character size in bits for both  transmission  and
       reception.   This  size does not	include	the parity bit,	if any.	 If is
       set, two	stop bits are used; otherwise one stop bit.  For  example,  at
       110 baud, many devices require two stop bits.

       If  is set, parity generation is	enabled	(a parity bit is added to each
       output character).  Furthermore,	parity detection is enabled  (incoming
       characters  are	checked	for the	correct	parity).  If is	set, specifies
       odd parity if set; otherwise even parity	is used.  If  is  clear,  both
       parity generation and parity checking are disabled.

       If is set, the receiver is enabled.  Otherwise no characters can	be re-
       ceived.

       The specific effects of the and bits depend on the mode and type	of the
       modem control in	effect.	 See modem(7) for the details.

       If  is  set,  the modem control lines for the port are lowered (discon-
       nected) when the	last process using the open port closes	it  or	termi-
       nates.

       If  is set, a connection	does not depend	on the state of	the modem sta-
       tus lines.  If is clear,	the modem status lines are monitored.

       Under normal circumstances, a call to waits for a modem	connection  to
       complete.   However,  if	either the or the flags	are set	or is set, the
       returns immediately without waiting for the connection.	If is set, see
       for the effects of and for those	files for which	the connection has not
       been established	or has been lost.

       is used by the shell layers facility (see shl(1)).   The	 shell	layers
       facility	 is not	part of	the general terminal interface,	and the	bit is
       not examined by the general terminal interface.

       The initial hardware control value after	open is	and

   Local Modes
       The field is used to control terminal functions.

	      Enable signals.
	      Canonical	input (erase and kill processing).
	      Canonical	upper/lower presentation.
	      Enable echo.
	      Echo	     ERASE as correcting backspace sequence.
	      Echo	     NL	after kill character.
	      Echo	     NL.
	      Disable flush after interrupt, quit, or suspend.
	      Send	     SIGTTOU for background output.
	      Echo control characters as ^char,
			     DEL as ^?.
	      Echo erased character as character is erased.
	      BS SP BS	     erase entire line on line kill.
	      Output is	being flushed.
	      Reprocess	pending	input at next read or input character.
	      Enable extended functions.

       If is set, each input character is checked against the special  control
       characters  INTR,  QUIT,	 SUSP,	and  DSUSP  (see If an input character
       matches one of these control characters,	the function  associated  with
       that  character	is  performed  and  the	character is discarded.	 If is
       clear, no checking is done and the character is	treated	 as  a	normal
       data  character.	  Thus these special input functions are possible only
       if is set.

       If is set, canonical processing is enabled.  This enables the erase and
       kill  edit  functions,  and the assembly	of input characters into lines
       delimited by NL,	EOF, EOL, or EOL2.  If is  clear,  read	 requests  are
       satisfied  directly from	the input queue.  A read blocks	until at least
       MIN characters have been	received or the	timeout	value TIME has expired
       between	characters.   (See This	allows fast bursts of input to be read
       efficiently while still	allowing  single-character  input.   The  time
       value represents	tenths of seconds.

       If  is  set, and	if is set, an uppercase	letter is accepted on input by
       preceding it with a character, and is output preceded by	 a  character.
       In  this	 mode,	the following escape sequences are generated on	output
       and accepted on input:

       To obtain:   Use:
	   `	     \'
	   |	     \!
	   {	     \(
	   }	     \)
	   \	     \\

       For example, is input as	as and as would	normally be used  in  conjunc-
       tion  with  and	for  terminals that support only the first-sixty-four-
       character limited character set.	 In this case, processing is done  be-
       fore  for  input,  and  processing is done after	for output.  Therefore
       typing causes an	to be read because of and typing causes	an to be  read
       since produces which is turned into by the processing.

       If  is  set,  characters	are echoed back	to the terminal	when received.
       If is clear, characters are not echoed.

       When is set, canonical processing is enabled.  This enables  the	 erase
       and  kill  edit	functions,  and	 the assembly of input characters into
       lines delimited by NL, EOF, EOL and EOL2	as described  in  Furthermore,
       the following echo functions are	possible.

       If  and	are  set,  the	ERASE  and WERASE characters are echoed	as the
       three-character ASCII sequence BS SP BS,	which clears the last  charac-
       ter or word from	the CRT	screen.

       If and are set, and is clear, the first ERASE and WERASE	character in a
       sequence	echoes a  backslash  (\)  followed  by	the  characters	 being
       erased.	 Subsequent ERASE or WERASE characters echo the	characters be-
       ing erased in reverse order.  The next  non-erase  character  causes  a
       slash (/) to be typed before it is echoed.

       If  and are set,	the KILL character is echoed by	erasing	each character
       on the line from	the CRT	screen using using the method selected by and

       If and are set, all control characters (characters with codes between 0
       and  37 octal) other than ASCII TAB, ASCII NL, the START	and STOP char-
       acters, ASCII CR, and ASCII BS are echoed as ^char, where char  is  the
       character given by adding 100 octal to the control character's code.

       If  is  set  and	 is not	set, the NL character is echoed	after the kill
       character to emphasize that the line is being deleted.

       If is set, the NL character is echoed even if is	clear.	This is	useful
       for terminals set to local echo (that is, half duplex).

       Unless  escaped,	the EOF	character is not echoed.  Because ASCII	EOT is
       the default EOF character, this prevents	terminals that respond to  EOT
       from hanging up.

       If  is  set, the	normal flush of	the input and output queues associated
       with quit, interrupt, and suspend characters  is	 not  done.   However,
       does  not  affect  the flushing of data upon receipt of a break when is
       set.

       If the bit is set, an attempt by	a process that is  not	in  the	 fore-
       ground  process	group to write to its controlling terminal will	be de-
       nied when the process is	not ignoring and not blocking the signal.   If
       the  write is denied and	the process is a member	of an orphaned process
       group returns -1	and sets to EIO	and no signal is sent.	If  the	 write
       is  denied  and	the  process  is a not a member	of an orphaned process
       group, the signal is sent to that process group.

       If is set, data written to the terminal device is discarded.  This  bit
       is set by a program.  A program can cancel the effect by	clearing

       If is set, any input that has not been read is reprocessed and possibly
       re-echoed when the next character arrives as input.

       If is set, the ERASE, KILL, and EOF characters can be escaped by	a pre-
       ceding character, in which case no special function is done.

       must  be	 set  before  the and functions	are allowed.  In addition, the
       special characters WERASE and LNEXT are allowed only if is  set.	  does
       not affect any other functions.

       The initial local control value is all-bits-clear.

   Special Control Characters
       Special	control	 characters are	defined	in the array All of these spe-
       cial characters can be changed.	The subscript name and description for
       each  element in	both canonical and non-canonical mode are shown	in the
       following table.

			     Subscript Usage
	       Canonical    Non-Canonical     Description
	      -----------------------------------------------
		 VEOF			    EOF	character
		 VEOL			    EOL	character
		 VEOL2			    EOL2 character
		VERASE			    ERASE character
		VWERASE			    WERASE character
		 VINTR		VINTR	    INTR character
		 VKILL			    KILL character
				VMIN	    MIN	value
		 VQUIT		VQUIT	    QUIT character
		VSTART	       VSTART	    START character
		 VSTOP		VSTOP	    STOP character
		 VSUSP		VSUSP	    SUSP character
		VDSUSP	       VDSUSP	    DSUSP character
				VTIME	    TIME value
		VLNEXT	       VLNEXT	    LNEXT character

   termios Structure-Related Functions
       The following functions are provided when using the termios  structure.
       Note  that  the	effects	on the terminal	device of the and functions do
       not become effective until the function is successfully called.	 Refer
       to the appropriate manual entries for details.

		   termios Structure Functions
	      Function		Description
	      ---------------------------------------
	      cfgetospeed()	get output baud	rate
	      cfgetispeed()	get input baud rate
	      cfsetospeed()	set output baud	rate
	      cfsetispeed()	set input baud rate
	      tcgetattr()	get terminal state
	      tcsetattr()	set terminal state

   termio Structure-Related IOCTL Commands
       Several	system	calls  apply  to terminal files	that use the structure
       (see If a requested command is not recognized, the request  returns  -1
       with set	to EINVAL.

       system calls that reference the structure have the form:

       Commands	using this form	are:

	      Get the parameters associated with the terminal
			     and  store	 them  in  the structure referenced by
			     arg.  This	command	is allowed from	 a  background
			     process;  however,	 the information may be	subse-
			     quently changed by	a foreground process.

	      Set the parameters associated with the terminal from the
			     structure referenced by arg.  The change is imme-
			     diate.   If  characters are being output when the
			     command is	requested, results are	undefined  and
			     the output	may be garbled.

	      Wait for the output to drain before setting new parameters.
			     This form should be used when changing parameters
			     that affect output.

	      Wait for the output to drain,
			     then flush	the input queue	and set	the new	param-
			     eters.

   termio Caveats
       Only  the first eight special control characters	(see can be set	or re-
       turned.	The values of indices VEOL and VEOF are	the  same  as  indices
       VTIME and VMIN respectively.  Hence if is set, VEOL or VTIME is the ad-
       ditional	end-of-line character and VEOF	or  VMIN  is  the  end-of-file
       character.   If	is  clear,  VEOL or VTIME is the inter-character-timer
       value and VEOF or VMIN is the minimum number of characters desired  for
       reads.

   Structure-Independent Functions
       The  following  functions  which	are independent	of both	the and	struc-
       tures are provided for controlling terminals.  Refer to the appropriate
       manual entries for details.

			Structure-Independent Functions
	      Function	      Description
	      ----------------------------------------------------
	      tcsendbreak()   send a break
	      tcdrain()	      wait until output	has drained
	      tcflush()	      flush input or output queue or both
	      tcflow()	      suspend or resume	input or output
	      tcgetpgrp()     get foreground process group id
	      tcsetpgrp()     set foreground process group id
	      tcgetsid()      get session id

   System Asynchronous I/O IOCTL Commands
       The following system calls provide for system asynchronous I/O and have
       the form:

       Commands	using this form	are:

	      If the integer referenced	by
				  arg is non-zero, system asynchronous I/O  is
				  enabled;  that  is, enable to	be sent	to the
				  process currently designated with  (see  be-
				  low)	whenever the terminal device file sta-
				  tus changes from "no read data available" to
				  "read	 data  available".   If	no process has
				  been designated with enable to  be  sent  to
				  the  first  process that opened the terminal
				  device file.

				  If the designated process  has  exited,  the
				  signal is not	sent to	any process.

				  If  the integer referenced by	arg is 0, sys-
				  tem asynchronous I/O is disabled.

				  The default on open  of  a  terminal	device
				  file is that system asynchronous I/O is dis-
				  abled.

	      The integer referenced by
				  arg is set to	1 if system  asynchronous  I/O
				  is  enabled.	 Otherwise, the	integer	refer-
				  enced	by arg is set to 0.

	      Set the process	  ID that will receive the signals due to sys-
				  tem asynchronous I/O to the value of the in-
				  teger	referenced by arg.  If no process  can
				  be  found corresponding to that specified by
				  the integer referenced by arg, the call  re-
				  turns	-1 with	set to ESRCH.  A user with ap-
				  propriate privileges can designate that  any
				  process receive the signals.	If the request
				  is not made by a user	with appropriate priv-
				  ileges  and the calling process does not ei-
				  ther	designate  that	 itself	  or   another
				  process whose	real, saved, or	effective user
				  ID matches its real or effective user	ID  or
				  the  calling	process	 does  not designate a
				  process that is a descendant of the  calling
				  process to receive the signals, the call re-
				  turns	-1 with	set to EPERM.

				  If the designated process  subsequently  ex-
				  its, the signal is not sent to any process.

				  The  default	on  open  of a terminal	device
				  file is  that	 the  process  performing  the
				  first	open is	set to receive the signals.

	      The integer referenced by
				  arg  is  set to the process ID designated to
				  receive signals.

   Line	Control	IOCTL Commands
       Several system calls control input and output.	Some  of  these	 calls
       have the	form:

       Commands	using this form	are:

	      Wait for the output to drain.
			     If	arg is 0, send a break (zero bits for at least
			     0.25 seconds).  The function  performs  the  same
			     function (see tcsendbreak(3C)).

	      Start/stop control.
			     If	 arg  is 0, suspend output; if 1, restart sus-
			     pended output; if 2, transmit a  STOP  character;
			     if	 3,  transmit a	START character.  If any other
			     value is given for	arg, the call returns -1  with
			     set  to  EINVAL.	The function performs the same
			     functions (see tcflow(3C)).

	      If	     arg is 0, flush the input queue; if 1, flush  the
			     output queue; if 2, flush both the	input and out-
			     put queues.  If any other value is	given for arg,
			     the  call	returns	 -1  with  set to EINVAL.  The
			     function  performs	 the   same   functions	  (see
			     tcflush(3C)).

			     Sending  a	 BREAK	is accomplished	by holding the
			     data transmit line	at a  SPACE  or	 logical  zero
			     condition for at least 0.25 seconds.  During this
			     interval, data can	be sent	to the device, but be-
			     cause  of	serial data interface limitations, the
			     BREAK takes precedence over all data.  Thus,  all
			     data  sent	 to  a	device during a	BREAK is lost.
			     This includes system-generated  XON/XOFF  charac-
			     ters used for input flow control.	Note also that
			     a delay in	transmission of	the XOFF flow  control
			     character	until  after  the  BREAK is terminated
			     could still result	in data	overflow  because  the
			     flow  control  character  may  not	 be  sent soon
			     enough.

       Other calls have	the form:

       Commands	using this form	are:

	      Returns in the integer referenced	by
			     arg the number of characters immediately readable
			     from  the	terminal device	file.  This command is
			     allowed from a background process;	 however,  the
			     data  itself  cannot  be  read  from a background
			     process.

   Non-blocking	I/O IOCTL Commands
       Non-blocking I/O	is easily provided via the and flags available in both
       open(2)	and  fcntl(2).	 The commands in this section are provided for
       backward	compatibility with previously developed	applications.	system
       calls  that provide a style of non-blocking I/O different from and have
       the form:

       Commands	using this form	are:

	      If the integer referenced	by
			     arg is non-zero, -style non-blocking I/O  is  en-
			     abled;  that  is,	subsequent reads and writes to
			     the terminal device file are handled  in  a  non-
			     blocking manner (see below).  If the integer ref-
			     erenced by	arg is 0, -style non-blocking  I/O  is
			     disabled.

			     For  reads,  -style non-blocking I/O prevents all
			     read requests to that device file from  blocking,
			     whether  the  requests  succeed  or fail.	Such a
			     read request completes in one of three ways:

				  o  If	there is enough	data available to sat-
				     isfy  the	entire	request, the read com-
				     pletes successfully, having read  all  of
				     the data, and returns the number of char-
				     acters read;

				  o  If	there is not enough data available  to
				     satisfy the entire	request, the read com-
				     pletes successfully, having read as  much
				     data  as possible,	and returns the	number
				     of	characters read;

				  o  If	there is no data available,  the  read
				     returns -1	with set to EWOULDBLOCK.

			     For  writes, -style non-blocking I/O prevents all
			     write requests to that device file	from blocking,
			     whether  the  requests  succeed  or fail.	Such a
			     write request completes in	one of three ways:

				  o  If	there is enough	space available	in the
				     system  to	buffer all the data, the write
				     completes	successfully,  having  written
				     out all of	the data, and returns the num-
				     ber of characters written;

				  o  If	there is not enough space in the  buf-
				     fer  to write out the entire request, the
				     write  completes	successfully,	having
				     written as	much data as possible, and re-
				     turns the number of characters written;

				  o  If	there is no space in the  buffer,  the
				     write returns -1 with set to EWOULDBLOCK.

			     To	 prohibit  -style non-blocking I/O from	inter-
			     fering with the and flags (see  open(2)  and  fc-
			     ntl(2)),  the  functionality of and always	super-
			     sedes the functionality  of  -style  non-blocking
			     I/O.   This  means	 that if either	or is set, the
			     driver performs read requests in accordance  with
			     the definition of or When both and	are clear, the
			     definition	of -style non-blocking I/O applies.

			     The default on open of a terminal device file  is
			     that -style non-blocking I/O is disabled.

	      The integer referenced by
			     arg  is  set  to 1, if -style non-blocking	I/O is
			     enabled.  Otherwise, the  integer	referenced  by
			     arg is set	to 0.

   Process Group Control IOCTL Commands
       The  process  group control features described here (except for setting
       and getting the delayed stop process character) are easily  implemented
       using  the  functions  and (see tcattribute(3C),	tcgetpgrp(3C), tcsetp-
       grp(3C),	and tcgetsid(3C) respectively).

       The following structure,	used with process group	control, is defined in

	      struct ltchars  {
		     unsigned char t_suspc;   /* stop process character*/
		     unsigned char t_dsuspc;  /* delayed stop process character*/
		     unsigned char t_rprntc;  /* reserved; must	be '_POSIX_VDISABLE'*/
		     unsigned char t_flushc;  /* reserved; must	be '_POSIX_VDISABLE'*/
		     unsigned char t_werasc;  /* reserved; must	be '_POSIX_VDISABLE'*/
		     unsigned char t_lnextc;  /* reserved; must	be '_POSIX_VDISABLE'*/
	      };

       The initial value for all these characters is which causes them	to  be
       disabled.  The meaning for each character is as follows:

	      Suspend the foreground process group.
			     A	suspend	signal is sent to all processes	in the
			     foreground	process	group.	Normally, each process
			     is	 forced	 to stop, but arrangements can be made
			     to	either ignore or block the signal, or  to  re-
			     ceive a trap to an	agreed-upon location; see sig-
			     nal(2) and	signal(5).  When enabled, the  typical
			     value  for	 this  character is Control-Z or ASCII
			     SUB.  Setting or getting is equivalent to setting
			     or	getting	the SUSP special control character.

	      Same as	     t_suspc,  except  that the	suspend	signal is sent
			     when a process reads the character,  rather  than
			     when  the	character is typed.  When enabled, the
			     typical value for this  character	is  Ctrl-Y  or
			     ASCII EM.

       Attempts	 to  set  any of the reserved characters to a value other than
       cause to	return -1 with set to EINVAL with no change in	value  of  the
       reserved	character.

       system calls that use the above structure have the form:

       Commands	using this form	are:

	      Get the process group control characters and store them in the
			     ltchars  structure	 referenced by arg.  This com-
			     mand is allowed from a background process.	  How-
			     ever, the information may be subsequently changed
			     by	a foreground process.

	      Set the process group control characters
			     from the structure	referenced by arg.

       Additional process group	control	system calls have the form:

       Commands	using this form	are:

	      Returns in the integer referenced	by
			     arg the foreground	process	group associated  with
			     the  terminal.   This  command  is	allowed	from a
			     background	process.  However, the information may
			     be	 subsequently changed by a foreground process.
			     This feature  is  easily  implemented  using  the
			     function (see tcgetpgrp(3C)).

			     If	 the call fails, it returns -1 and sets	to one
			     of	the following values:

				  [EBADF]     fildes is	not a valid  file  de-
					      scriptor.

				  [ENOTTY]    The  file	associated with	fildes
					      is not the controlling terminal,
					      or  the calling process does not
					      have a controlling terminal.

				  [EACCES]    The file associated with	fildes
					      is  the  controlling terminal of
					      the  calling  process,  however,
					      there  is	 no foreground process
					      group defined for	 the  control-
					      ling terminal.

					      Note: EACCES may not be returned
					      in future	releases.  Behavior in
					      cases    where   no   foreground
					      process group is defined for the
					      controlling  terminal may	change
					      in future	versions of the	 POSIX
					      standard.	   Portable   applica-
					      tions,  therefore,  should   not
					      rely on this error condition.

	      Sets the foreground process group	associated with	the terminal
			     to	 the value referenced by arg.  This feature is
			     easily implemented	using the  function  (see  tc-
			     setpgrp(3C)).

			     If	 the call fails, it returns -1 and sets	to one
			     of	the following values:

				  [EBADF]     fildes is	not a valid  file  de-
					      scriptor.

				  [EINVAL]    The process ID referenced	by arg
					      is not a supported value.

				  [ENOTTY]    The  calling  process  does  not
					      have  a controlling terminal, or
					      the fildes is not	 the  control-
					      ling  terminal,  or the control-
					      ling terminal is no longer asso-
					      ciated  with  the	session	of the
					      calling process.

				  [EPERM]     The process ID referenced	by arg
					      is  a  supported	value but does
					      not match	the process  group  ID
					      of a process in the same session
					      as the calling process.

	      Returns in the integer referenced	by
			     arg the session ID	of the terminal	 specified  by
			     fildes.  This feature is easily implemented using
			     the function (see tcgetsid(3C)).

			     If	the call fails,	it returns -1 and sets to  one
			     of	the following values:

				  [EBADF]     fildes  is  not a	valid file de-
					      scriptor.

				  [ENOTTY]    The   device   associated	  with
					      fildes is	not a terminal.

				  [EACCES]    The fildes is a terminal that is
					      not allocated to a session.

	      Get the process group control mode word
			     and store it in the int referenced	by arg.	  This
			     command  is  allowed  from	 a background process;
			     however,  the  information	 may  be  subsequently
			     changed by	a foreground process.

	      Set  the process group control mode word to the value of the int
	      referenced by
			     arg.

	      Use the int referenced by
			     arg as a mask of bits to set in the process group
			     control mode word.

	      Use the int referenced by
			     arg  as  a	 mask  of bits to clear	in the process
			     group control mode	word.

       The following bit is defined in the process group control mode word:

	      Send	     for background writes.

       Setting or clearing is equivalent to setting or clearing	the flag  (see
       If  is  set and a process is not	in the foreground process group	of its
       controlling terminal, a write by	the process to its controlling	termi-
       nal may be denied (see

   Terminal Size IOCTL Commands
       The following system calls are used to get and set terminal size	infor-
       mation for the terminal referenced by fildes.  These system  calls  use
       the structure to	get and	set the	terminal size information.  The	struc-
       ture, defined in	has the	following members :

	      unsigned short  ws_row;	  /* Rows, in characters */
	      unsigned short  ws_col;	  /* Columns, in characters */
	      unsigned short  ws_xpixel;  /* Horizontal	size, in pixels	*/
	      unsigned short  ws_ypixel;  /* Vertical size, in pixels */

       The initial values for all elements of terminal	size  are  zero.   The
       values for terminal size	are neither set	nor used by the	general	termi-
       nal interface, and have no effect on the	functionality of  the  general
       terminal	interface.  The	values for terminal size are set and used only
       by applications that access them	through	the terminal-size system calls
       (see ioctl(2)).

       system calls that use the above structure have the form:

       Commands	using this form	are:

	      Get the terminal size values and store them in the
			     structure referenced by arg.  This	command	is al-
			     lowed from	a background process.

	      Set the terminal size values from	the
			     structure referenced by arg.  If any of  the  new
			     values  differ  from previous values, a signal is
			     sent to all processes  in	the  terminal's	 fore-
			     ground process group.

   Console Output Redirection IOCTL Command
       Output  which would normally be sent to the system console may be redi-
       rected to any other TTY device or pseudo-device	in  the	 system.   The
       system call used	to control console output redirection has the form:

       The command using this form is:

	      Redirect system console output.
			     Any  output  that	would  normally	be sent	to the
			     system console, either through kernel printf  re-
			     quests, or	through	the console special file, will
			     instead be	sent to	 the  terminal	referenced  by
			     fildes.   The  value of arg is ignored.  The user
			     must have superuser privileges  to	 execute  this
			     request.  Otherwise, the call returns -1 with set
			     to	EPERM.	If the console	output	has  not  been
			     redirected	 to a different	device by a later call
			     to	this command, it is  redirected	 back  to  the
			     physical console device when fildes is closed.

WARNINGS
       Various	HP-UX implementations use non-serial interfaces	that look like
       terminals (such as bit-mapped graphics  displays)  or  ``smart  cards''
       that  cannot  implement the exact capabilities described	above.	There-
       fore, not all systems can exactly meet the standard stated above.  Each
       implementation is required to state any deviations from the standard as
       part of its system-specific documentation.

	      is similar to	  BSD 4.2 with the addition of provisions  for
				  security.

	      is of		  HP origin, complements and allows saving and
				  restoring system asynchronous	I/O TTY	states
				  for command interpreter processes.

	      is similar to	  BSD 4.2 with additional provisions for secu-
				  rity.

	      is similar to	  BSD 4.2 Note also the	 difference  that  the
				  BSD  4.2  version of this functionality used
				  process groups, while	the HP-UX version only
				  uses processes.

	      is the same as	  BSD FIONBIO, 4.2 except that it does not in-
				  terfere with the or and flags.

	      is of		  HP origin, complements and allows saving and
				  restoring  the  -style  non-blocking I/O TTY
				  state	for command interpreter	processes.

       The general terminal interface uses a system resource  known  as	 a  to
       store data being	transmitted or received	through	a communications port.
       These cblocks are continuously used and freed for reuse	as  data  pass
       through	the  system.  If too few cblocks are configured	in the system,
       the cblock pool may be temporarily or permanently exhausted,  and  data
       loss, system hangs, or reduced system performance can result.

       If  cblock  exhaustion is suspected, you	can examine the	system message
       buffer with (see	dmesg(1M)) for messages	indicating  cblock  exhaustion
       has  occurred.	Or, you	can use	(see adb(1)) if	examining the corefile
       of a dump.  The message format is

       where n indicates the number of times  the  operating  system  has  re-
       quested	a  cblock  and none could be provided.	If this	message	is ob-
       served, the kernel should be reconfigured to generate a	larger	number
       of cblocks.

       A  cblock is 32 bytes in	length.	 The default number of cblocks config-
       ured in the system is computed from the tunable system parameter	and is
       defined to be

       This  can  be overridden	by using the optional tunable system parameter
       to specify the desired number of	cblocks	to be used in the system.

       or config(1M) may be used to generate a new kernel with a new value.

DEPENDENCIES
   Series 700
       Built-in	serial ports on	Series 700 machines support the	following  ad-
       ditional	 baud  rate  settings: 57600, and 115200.  An RS-232-to-RS-422
       converter may be	required to achieve practical cable lengths  at	 these
       baud rates (because RS-232 only specifies up to 19200 baud).

       Timed delays are	not supported.

       Built-in	 serial	ports on Series	700 systems have RTS and CTS flow con-
       trol capability,	configurable receive FIFO trigger levels, and  a  con-
       figurable  transmit limit.  RTS/CTS hardware handshaking	can be enabled
       through a bit in	the device file	minor number,  through	an  call  (see
       termiox(7)), or through the command (see	stty(1)).

       The  receive FIFO trigger level is configurable through two bits	in the
       device file minor number.  The receive FIFO trigger level  is  used  to
       set  the	level at which a receive interrupt is generated	to the system.
       Setting a smaller value for the receive FIFO trigger level enables  the
       system  to react	more quickly to	receipt	of characters.	However, using
       a smaller trigger level increases system	overhead to process the	 addi-
       tional  interrupts.   A	higher	receive	FIFO trigger level reduces the
       system interrupt	overhead for heavy inbound data	traffic	at the cost of
       less  time for the system to read data from the hardware	before receive
       FIFOs are overrun.  When	using RTS flow control,	the receive FIFO trig-
       ger level also determines the point at which the	hardware lowers	RTS to
       protect the receive FIFO.  Use of a higher receive FIFO	trigger	 level
       also  reduces XOFF flow control responsiveness because, under light in-
       bound data flow conditions, receipt of the XOFF character by the	system
       is  slightly  delayed.	Choice of the appropriate receive FIFO trigger
       level should be based upon how the serial port is to be used.  For most
       applications  a	receive	 FIFO  trigger level of	8 (c3,c2 = 10) is sug-
       gested.

       Two bits	in the device file minor number	specify	 the  transmit	limit,
       the  number of characters which are successively	loaded into the	trans-
       mit FIFO.  Setting a smaller transmit limit allows the  transmitter  to
       be more responsive to flow control either from receipt of an XOFF char-
       acter or	de-assertion of	CTS at the cost	of increased system  interrupt
       overhead.   Setting  a larger transmit limit reduces interrupt overhead
       but is not as responsive	to flow	control	since  the  remainder  of  the
       transmit	 FIFO  can  be	transmitted even after the transmitter is flow
       controlled.  When communicating with devices which have	little	toler-
       ance  for data receipt after flow control, one must choose the transmit
       limit appropriately.  Series 700	device file  minor  numbers  take  the
       form:

       where:

	      II =    Two hexadecimal digits (8	bits) to indicate the instance
		      of the serial interface.

	      C	=     One hexadecimal digit (4 bits) for FIFO control.	Values
		      for each bit are as follows:

			   +---------------------------+-----------------+
			   |Receive FIFO Trigger Level | Transmit Limit	 |
			   +-------+--------+----------+----+----+-------+
			   |  c3   |  c2    |  Level   | c1 | c0 | Limit |
			   +-------+--------+----------+----+----+-------+
			   |  0	   |   0    |	 1     | 0  | 0	 |   1	 |
			   |  0	   |   1    |	 4     | 0  | 1	 |   4	 |
			   |  1	   |   0    |	 8     | 1  | 0	 |   8	 |
			   |  1	   |   1    |	14     | 1  | 1	 |  12	 |
			   +-------+--------+----------+----+----+-------+
	      H	=     One hexadecimal digit (4 bits) which controls diagnostic
		      access and hardware flow control.

			   +----+---------------------------------------+
			   |Bit	|		  Value			|
			   +----+---------------------------------------+
			   |h3	| Diagnostic telephony access		|
			   |h2	| Reserved				|
			   |h1	| Reserved				|
			   |h0	| Enables RTS/CTS hardware flow	control	|
			   +----+---------------------------------------+
	      M	=     One hexadecimal digit (4 bits) to	determine the port ac-
		      cess type.  Values for each bit are as follows:

			      +-----+--------------------------------+
			      |Bit  |		  Value		     |
			      +-----+--------------------------------+
			      |	m3  |  TI/ALP			     |
			      |	m2  |  0 = Simple protocol (U.S.),   |
			      |	    |  1 = CCITT protocol (Europe)   |
			      |m1m0 | 00 = Direct		     |
			      |	    | 01 = Dial-out modem	     |
			      |	    | 10 = Dial-in modem	     |
			      |	    | 11 = Invalid		     |
			      +-----+--------------------------------+
   Series 800
       Timed  output delays are	not directly supported.	 If used, an appropri-
       ate number of fill characters (based on the current baud	rate) is  out-
       put.   The total	time to	output the fill	characters is at least as long
       as the time requested.

       The system specified input flow control values are as follows: low  wa-
       ter  mark  is  60, high water mark is 180, and maximum allowed input is
       512.

       The HP 98196A (formerly 27140A option 800) interface does  not  support
       the following hardware settings:

	      The
	      HP  A1703-60003 and the HP 28639-60001 interfaces	do not support
	      baud rates above	9600.	Furthermore,  changing	the  following
	      hardware	settings  on port 0 from the default (9600 baud, 8 bit
	      characters, 1 stop bit, no parity) is not	supported:

       The HP J2094A interface does not	support	baud rates above 19200.

       The HP J2094A supports RTS and CTS flow control.	 The RTS/CTS  hardware
       handshaking  can	be enabled through a bit in the	device file minor num-
       ber, through an call (see termiox(7)),  or  through  the	 command  (see
       stty(1)).  Series 800 device file minor numbers take the	form:

       where:

	      II =    Two hexadecimal digits (8	bits) to indicate the instance
		      of the serial interface.

	      PP =    Two hexadecimal digits (8	bits)  to  indicate  the  port
		      number of	this device on the serial interface.

	      H	=     One hexadecimal digit (4 bits) which controls diagnostic
		      access and hardware flow control (HP J2094A only).

			   +----+---------------------------------------+
			   |Bit	|		  Value			|
			   +----+---------------------------------------+
			   |h3	| Card diagnostic			|
			   |h2	| Port diagnostic			|
			   |h1	| Reserved				|
			   |h0	| Enables RTS/CTS hardware flow	control	|
			   +----+---------------------------------------+
	      M	=     One hexadecimal digit (4 bits) for the port access type.
		      Values for each bit are as follows:

			      +-----+--------------------------------+
			      |Bit  |		  Value		     |
			      +-----+--------------------------------+
			      |	m3  |  TI/ALP			     |
			      |	m2  |  0 = Simple protocol (U.S.),   |
			      |	    |  1 = CCITT protocol (Europe)   |
			      |m1m0 | 00 = Direct		     |
			      |	    | 01 = Dial-out modem	     |
			      |	    | 10 = Dial-in modem	     |
			      |	    | 11 = Invalid		     |
			      +-----+--------------------------------+
AUTHOR
       was developed HP	and the	IEEE Computer Society.

       was developed by	HP, AT&T, and the University of	California, Berkeley.

FILES
       EISA mux	has adopted the	following device files naming convention:

       where Port_Module_Name =	[a..h],	Port_Number = 1-16

       For example:

SEE ALSO
       adb(1),	shl(1),	 stty(1),  config(1M),	dmesg(1M), mknod(1M), fork(2),
       ioctl(2), setsid(2), signal(2), stty(2),	 setpgid(2),  blmode(3C),  cf-
       speed(3C),   tccontrol(3C),   tcattribute(3C),  tcgetpgrp(3C),  tcsetp-
       grp(3C),	tcgetsid(3C), signal(5),  unistd(5),  sttyV6(7),  tty(7),  mo-
       dem(7), termiox(7).

STANDARDS CONFORMANCE
								     termio(7)

NAME | DESCRIPTION | WARNINGS | DEPENDENCIES | AUTHOR | FILES | SEE ALSO | STANDARDS CONFORMANCE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=termio&sektion=7&manpath=HP-UX+11.22>

home | help