⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 library_16.html

📁 Glibc的中文手册
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<A NAME="IDX1204"></A>
<A NAME="IDX1205"></A>
<U>Macro:</U> int <B>VQUIT</B><P>
This is the subscript for the QUIT character in the special control
character array.  <CODE><VAR>termios</VAR>.c_cc[VQUIT]</CODE> holds the character
itself.
<P>
The QUIT character raises a <CODE>SIGQUIT</CODE> signal for all processes in
the foreground job associated with the terminal.  The QUIT character
itself is then discarded.  See section <A HREF="library_21.html#SEC330" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC330">Signal Handling</A>, for more information
about signals.
<P>
Typically, the QUIT character is <KBD>C-\</KBD>.
<P>
<A NAME="IDX1206"></A>
<A NAME="IDX1207"></A>
<A NAME="IDX1208"></A>
<U>Macro:</U> int <B>VSUSP</B><P>
This is the subscript for the SUSP character in the special control
character array.  <CODE><VAR>termios</VAR>.c_cc[VSUSP]</CODE> holds the character
itself.
<P>
The SUSP (suspend) character is recognized only if the implementation
supports job control (see section <A HREF="library_24.html#SEC411" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC411">Job Control</A>).  It causes a <CODE>SIGTSTP</CODE>
signal to be sent to all processes in the foreground job associated with
the terminal.  The SUSP character itself is then discarded.
See section <A HREF="library_21.html#SEC330" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC330">Signal Handling</A>, for more information about signals.
<P>
Typically, the SUSP character is <KBD>C-z</KBD>.
<P>
Few applications disable the normal interpretation of the SUSP
character.  If your program does this, it should provide some other
mechanism for the user to stop the job.  When the user invokes this
mechanism, the program should send a <CODE>SIGTSTP</CODE> signal to the
process group of the process, not just to the process itself.
See section <A HREF="library_21.html#SEC365" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC365">Signaling Another Process</A>.
<P>
<A NAME="IDX1209"></A>
<A NAME="IDX1210"></A>
<A NAME="IDX1211"></A>
<U>Macro:</U> int <B>VDSUSP</B><P>
This is the subscript for the DSUSP character in the special control
character array.  <CODE><VAR>termios</VAR>.c_cc[VDSUSP]</CODE> holds the character
itself.
<P>
The DSUSP (suspend) character is recognized only if the implementation
supports job control (see section <A HREF="library_24.html#SEC411" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC411">Job Control</A>).  It sends a <CODE>SIGTSTP</CODE>
signal, like the SUSP character, but not right away--only when the
program tries to read it as input.  Not all systems with job control
support DSUSP; only BSD systems.
<P>
See section <A HREF="library_21.html#SEC330" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC330">Signal Handling</A>, for more information about signals.
<P>
Typically, the DSUSP character is <KBD>C-y</KBD>.
<P>
<H4><A NAME="SEC285" HREF="library_toc.html#SEC285" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC285">Special Characters for Flow Control</A></H4>
<P>
These special characters may be active in either canonical or noncanonical
input mode, but their use is controlled by the flags <CODE>IXON</CODE> and
<CODE>IXOFF</CODE> (see section <A HREF="library_16.html#SEC276" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_16.html#SEC276">Input Modes</A>).
<P>
<A NAME="IDX1212"></A>
<A NAME="IDX1213"></A>
<U>Macro:</U> int <B>VSTART</B><P>
This is the subscript for the START character in the special control
character array.  <CODE><VAR>termios</VAR>.c_cc[VSTART]</CODE> holds the
character itself.
<P>
The START character is used to support the <CODE>IXON</CODE> and <CODE>IXOFF</CODE>
input modes.  If <CODE>IXON</CODE> is set, receiving a START character resumes
suspended output; the START character itself is discarded.  If
<CODE>IXOFF</CODE> is set, the system may also transmit START characters to
the terminal.
<P>
The usual value for the START character is <KBD>C-q</KBD>.  You may not be
able to change this value--the hardware may insist on using <KBD>C-q</KBD>
regardless of what you specify.
<P>
<A NAME="IDX1214"></A>
<A NAME="IDX1215"></A>
<U>Macro:</U> int <B>VSTOP</B><P>
This is the subscript for the STOP character in the special control
character array.  <CODE><VAR>termios</VAR>.c_cc[VSTOP]</CODE> holds the character
itself.
<P>
The STOP character is used to support the <CODE>IXON</CODE> and <CODE>IXOFF</CODE>
input modes.  If <CODE>IXON</CODE> is set, receiving a STOP character causes
output to be suspended; the STOP character itself is discarded.  If
<CODE>IXOFF</CODE> is set, the system may also transmit STOP characters to the
terminal, to prevent the input queue from overflowing.
<P>
The usual value for the STOP character is <KBD>C-s</KBD>.  You may not be
able to change this value--the hardware may insist on using <KBD>C-s</KBD>
regardless of what you specify.
<P>
<H4><A NAME="SEC286" HREF="library_toc.html#SEC286" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC286">Other Special Characters</A></H4>
<P>
Here are two additional special characters that are meaningful on BSD
systems.
<P>
<A NAME="IDX1216"></A>
<A NAME="IDX1217"></A>
<U>Macro:</U> int <B>VDISCARD</B><P>
This is the subscript for the DISCARD character in the special control
character array.  <CODE><VAR>termios</VAR>.c_cc[VDISCARD]</CODE> holds the character
itself.
<P>
The DISCARD character is recognized only when <CODE>IEXTEN</CODE> is set.  Its
effect is to toggle the discard-output flag.  When this flag is set, all
program output is discarded.  Setting the flag also discards all output
currently in the output buffer.
<P>
<A NAME="IDX1218"></A>
<A NAME="IDX1219"></A>
<U>Macro:</U> int <B>VSTATUS</B><P>
This is the subscript for the STATUS character in the special control
character array.  <CODE><VAR>termios</VAR>.c_cc[VSTATUS]</CODE> holds the character
itself.
<P>
The STATUS character's effect is to print out a status message about how
the current process is running.
<P>
The STATUS character is recognized only when canonical mode.  This is a
peculiar design decision, since the STATUS character's meaning has
nothing to do with input, but that's the way it was done.
<P>
<H3><A NAME="SEC287" HREF="library_toc.html#SEC287" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC287">Noncanonical Input</A></H3>
<P>
In noncanonical input mode, the special editing characters such as
ERASE and KILL are ignored.  The system facilities for the user to edit
input are disabled in noncanonical mode, so that all input characters
(unless they are special for signal or flow-control purposes) are passed
to the application program exactly as typed.  It is up to the
application program to give the user ways to edit the input, if
appropriate.
<P>
Noncanonical mode offers special parameters called MIN and TIME for
controlling whether and how long to wait for input to be available.  You
can even use them to avoid ever waiting--to return immediately with
whatever input is available, or with no input.
<P>
The MIN and TIME are stored in elements of the <CODE>c_cc</CODE> array, which
is a member of the <CODE>struct termios</CODE> structure.  Each element of
this array has a particular role, and each element has a symbolic
constant that stands for the index of that element.  <CODE>VMIN</CODE> and
<CODE>VMAX</CODE> are the names for the indices in the array of the MIN and
TIME slots.
<P>
<A NAME="IDX1220"></A>
<A NAME="IDX1221"></A>
<U>Macro:</U> int <B>VMIN</B><P>
This is the subscript for the MIN slot in the <CODE>c_cc</CODE> array.  Thus,
<CODE><VAR>termios</VAR>.c_cc[VMIN]</CODE> is the value itself.
<P>
The MIN slot is only meaningful in noncanonical input mode; it
specifies the minimum number of bytes that must be available in the
input queue in order for <CODE>read</CODE> to return.
<P>
<A NAME="IDX1222"></A>
<A NAME="IDX1223"></A>
<U>Macro:</U> int <B>VTIME</B><P>
This is the subscript for the TIME slot in the <CODE>c_cc</CODE> array.  Thus,
<CODE><VAR>termios</VAR>.c_cc[VTIME]</CODE> is the value itself.
<P>
The TIME slot is only meaningful in noncanonical input mode; it
specifies how long to wait for input before returning, in units of 0.1
seconds.
<P>
The MIN and TIME values interact to determine the criterion for when
<CODE>read</CODE> should return; their precise meanings depend on which of
them are nonzero.  There are four possible cases:
<P>
<UL>
<LI>
Both MIN and TIME are zero.
<P>
In this case, <CODE>read</CODE> always returns immediately with as many
characters as are available in the queue, up to the number requested.
If no input is immediately available, <CODE>read</CODE> returns a value of
zero.
<P>
<LI>
MIN is zero but TIME has a nonzero value.
<P>
In this case, <CODE>read</CODE> waits for time TIME for input to become
available; the availability of a single byte is enough to satisfy the
read request and cause <CODE>read</CODE> to return.  When it returns, it
returns as many characters as are available, up to the number requested.
If no input is available before the timer expires, <CODE>read</CODE> returns a
value of zero.
<P>
<LI>
TIME is zero but MIN has a nonzero value.
<P>
In this case, <CODE>read</CODE> waits until at least MIN bytes are available
in the queue.  At that time, <CODE>read</CODE> returns as many characters as
are available, up to the number requested.  <CODE>read</CODE> can return more
than MIN characters if more than MIN happen to be in the queue.
<P>
<LI>
Both TIME and MIN are nonzero.
<P>
In this case, TIME specifies how long to wait after each input character
to see if more input arrives.  <CODE>read</CODE> keeps waiting until either
MIN bytes have arrived, or TIME elapses with no further input.
<P>
<CODE>read</CODE> can return no input if TIME elapses before the first input
character arrives.  <CODE>read</CODE> can return more than MIN characters if
more than MIN happen to be in the queue.
</UL>
<P>
What happens if MIN is 50 and you ask to read just 10 bytes?
Normally, <CODE>read</CODE> waits until there are 50 bytes in the buffer (or,
more generally, the wait condition described above is satisfied), and
then reads 10 of them, leaving the other 40 buffered in the operating
system for a subsequent call to <CODE>read</CODE>.
<P>
<STRONG>Portability note:</STRONG> On some systems, the MIN and TIME slots are
actually the same as the EOF and EOL slots.  This causes no serious
problem because the MIN and TIME slots are used only in noncanonical
input and the EOF and EOL slots are used only in canonical input, but it
isn't very clean.  The GNU library allocates separate slots for these
uses.
<P>
<A NAME="IDX1224"></A>
<H2><A NAME="SEC288" HREF="library_toc.html#SEC288" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC288">Line Control Functions</A></H2>
<P>
These functions perform miscellaneous control actions on terminal
devices.  As regards terminal access, they are treated like doing
output: if any of these functions is used by a background process on its
controlling terminal, normally all processes in the process group are
sent a <CODE>SIGTTOU</CODE> signal.  The exception is if the calling process
itself is ignoring or blocking <CODE>SIGTTOU</CODE> signals, in which case the
operation is performed and no signal is sent.  See section <A HREF="library_24.html#SEC411" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC411">Job Control</A>.
<A NAME="IDX1225"></A>
<P>
<A NAME="IDX1226"></A>
<U>Function:</U> int <B>tcsendbreak</B> <I>(int <VAR>filedes</VAR>, int <VAR>duration</VAR>)</I><P>
This function generates a break condition by transmitting a stream of
zero bits on the terminal associated with the file descriptor
<VAR>filedes</VAR>.  The duration of the break is controlled by the
<VAR>duration</VAR> argument.  If zero, the duration is between 0.25 and 0.5
seconds.  The meaning of a nonzero value depends on the operating system.
<P>
This function does nothing if the terminal is not an asynchronous serial
data port.
<P>
The return value is normally zero.  In the event of an error, a value
of <CODE>-1</CODE> is returned.  The following <CODE>errno</CODE> error conditions
are defined for this function:
<P>
<DL COMPACT>
<DT><CODE>EBADF</CODE>
<DD>The <VAR>filedes</VAR> is not a valid file descriptor.
<P>
<DT><CODE>ENOTTY</CODE>
<DD>The <VAR>filedes</VAR> is not associated

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -