OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man3 / termios.3
index d668a4b..d091c4b 100644 (file)
@@ -37,7 +37,7 @@
 .\"     Enhanced the discussion of "raw" mode for cfmakeraw().
 .\"     Document CMSPAR.
 .\"
-.TH TERMIOS 3 2013-03-15 "Linux" "Linux Programmer's Manual"
+.TH TERMIOS 3 2014-05-08 "Linux" "Linux Programmer's Manual"
 .SH NAME
 termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow,
 cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, cfsetspeed \-
@@ -104,7 +104,7 @@ cc_t     c_cc[NCCS];   /* special characters */
 The values that may be assigned to these fields are described below.
 In the case of the first four bit-mask fields,
 the definitions of some of the associated flags that may be set are
-only exposed if a specific feature test macro (see
+exposed only if a specific feature test macro (see
 .BR feature_test_macros (7))
 is defined, as noted in brackets ("[]").
 .PP
@@ -175,13 +175,11 @@ Linux does not implement this bit, and acts as if it is always set.
 (not in POSIX) Input is UTF8;
 this allows character-erase to be correctly performed in cooked mode.
 .PP
-\fIc_oflag\fP flag constants defined in POSIX.1:
+.I c_oflag
+flag constants:
 .TP
 .B OPOST
 Enable implementation-defined output processing.
-.PP
-The remaining \fIc_oflag\fP flag constants are defined in POSIX.1-2001,
-unless marked otherwise.
 .TP
 .B OLCUC
 (not in POSIX) Map lowercase characters to uppercase on output.
@@ -202,7 +200,7 @@ Don't output CR.
 Send fill characters for a delay, rather than using a timed delay.
 .TP
 .B OFDEL
-(not in POSIX) Fill character is ASCII DEL (0177).
+Fill character is ASCII DEL (0177).
 If unset, fill character is ASCII NUL (\(aq\\0\(aq).
 (Not implemented on Linux.)
 .TP
@@ -346,7 +344,7 @@ devices): if
 .B PARODD
 is set, the parity bit is always 1; if
 .B PARODD
-is not set, then the parity bit is always 0).
+is not set, then the parity bit is always 0.
 [requires
 .B _BSD_SOURCE
 or
@@ -374,7 +372,12 @@ If \fBICANON\fP is also set, terminal is uppercase only.
 Input is converted to lowercase, except for characters preceded by \\.
 On output, uppercase characters are preceded by \\ and lowercase
 characters are converted to uppercase.
-[requires _BSD_SOURCE or _SVID_SOURCE or _XOPEN_SOURCE]
+[requires
+.B _BSD_SOURCE
+or
+.B _SVID_SOURCE
+or
+.BR _XOPEN_SOURCE ]
 .\" glibc is probably now wrong to allow
 .\" Define
 .\" .B _XOPEN_SOURCE
@@ -669,7 +672,7 @@ the change occurs immediately.
 the change occurs after all output written to
 .I fd
 has been transmitted.
-This function should be used when changing
+This option should be used when changing
 parameters that affect output.
 .IP \fBTCSAFLUSH\fP
 the change occurs after all output written to the object referred by
@@ -724,8 +727,8 @@ and TIME
 determine the circumstances in which a
 .BR read (2)
 completes; there are four distinct cases:
-.IP * 2
-MIN == 0; TIME == 0:
+.TP
+MIN == 0, TIME == 0 (polling read)
 If data is available,
 .BR read (2)
 returns immediately, with the lesser of the number of bytes
@@ -733,13 +736,13 @@ available, or the number of bytes requested.
 If no data is available,
 .BR read (2)
 returns 0.
-.IP * 2
-MIN > 0; TIME == 0:
+.TP
+MIN > 0, TIME == 0 (blocking read)
 .BR read (2)
-blocks until the lesser of MIN bytes or the number of bytes requested
-are available, and returns the lesser of these two values.
-.IP * 2
-MIN == 0; TIME > 0:
+blocks until MIN bytes are available,
+and returns up to the number of bytes requested.
+.TP
+MIN == 0, TIME > 0 (read with timeout)
 TIME specifies the limit for a timer in tenths of a second.
 The timer is started when
 .BR read (2)
@@ -750,17 +753,56 @@ or when the timer expires.
 If the timer expires without any input becoming available,
 .BR read (2)
 returns 0.
-.IP * 2
-MIN > 0; TIME > 0:
+If data is already available at the time of the call to
+.BR read (2),
+the call behaves as though the data was received immediately after the call.
+.TP
+MIN > 0, TIME > 0 (read with interbyte timeout)
 TIME specifies the limit for a timer in tenths of a second.
 Once an initial byte of input becomes available,
 the timer is restarted after each further byte is received.
 .BR read (2)
-returns either when the lesser of the number of bytes requested or
-MIN byte have been read,
-or when the inter-byte timeout expires.
-Because the timer is only started after the initial byte
+returns when any of the following conditions is met:
+.RS
+.IP * 3
+MIN bytes have been received.
+.IP *
+The interbyte timer expires.
+.IP *
+The number of bytes requested by
+.BR read (2)
+has been received.
+(POSIX does not specify this termination condition,
+and on some other implementations
+.\" e.g., Solaris
+.BR read (2)
+does not return in this case.)
+.RE
+.IP
+Because the timer is started only after the initial byte
 becomes available, at least one byte will be read.
+If data is already available at the time of the call to
+.BR read (2),
+the call behaves as though the data was received immediately after the call.
+.PP
+POSIX
+.\" POSIX.1-2008 XBD 11.1.7
+does not specify whether the setting of the
+.B O_NONBLOCK
+file status flag takes precedence over the MIN and TIME settings.
+If
+.B O_NONBLOCK
+is set, a
+.BR read (2)
+in noncanonical mode may return immediately,
+regardless of the setting of MIN or TIME.
+Furthermore, if no data is available,
+POSIX permits a
+.BR read (2)
+in noncanonical mode to return either 0, or \-1 with
+.I errno
+set to
+.BR EAGAIN .
 .SS Raw mode
 .LP
 .BR cfmakeraw ()
@@ -929,6 +971,23 @@ Therefore, when making multiple changes
 it may be necessary to follow this call with a further call to
 .BR tcgetattr ()
 to check that all changes have been performed successfully.
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR tcgetattr (),
+.BR tcsetattr (),
+.BR tcsendbreak (),
+.BR tcdrain (),
+.BR tcflush (),
+.BR tcflow (),
+.BR cfmakeraw (),
+.BR cfgetispeed (),
+.BR cfgetospeed (),
+.BR cfsetispeed (),
+.BR cfsetospeed (),
+and
+.BR cfsetspeed ()
+functions are thread-safe.
 .SH CONFORMING TO
 .BR tcgetattr (),
 .BR tcsetattr (),
@@ -948,7 +1007,7 @@ and
 .BR cfsetspeed ()
 are nonstandard, but available on the BSDs.
 .SH NOTES
-UNIX V7 and several later systems have a list of baud rates
+UNIX\ V7 and several later systems have a list of baud rates
 where after the fourteen values B0, ..., B9600 one finds the
 two constants EXTA, EXTB ("External A" and "External B").
 Many systems extend the list with much higher baud rates.
@@ -979,3 +1038,12 @@ behaves like
 .BR console_ioctl (4),
 .BR tty_ioctl (4),
 .BR setserial (8)
+.SH COLOPHON
+This page is part of release 3.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.