1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
|
<TITLE>tcgetpgrp</TITLE>
<body bgcolor="#ffffcc">
<hr>
<pre>
<h3>TERMIOS(2) Linux Programmer's Manual TERMIOS(2)
</h3>
<h3>NAME
</h3> termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain,
tcflush, tcflow, cfgetospeed, cfgetispeed, cfsetispeed,
cfsetospeed, tcgetpgrp, tcsetpgrp - get and set terminal
attributes, line control, get and set baud rate, get and
set terminal foreground process group ID
<h3>SYNOPSIS
</h3> #include <termios.h>
#include <unistd.h>
int tcgetattr ( int fd, struct termios *termios_p );
int tcsetattr ( int fd, int optional_actions, struct
termios *termios_p );
int tcsendbreak ( int fd, int duration );
int tcdrain ( int fd );
int tcflush ( int fd, int queue_selector );
int tcflow ( int fd, int action );
speed_t cfgetospeed ( struct termios *termios_p );
int cfsetospeed ( struct termios *termios_p, speed_t speed
);
speed_t cfgetispeed ( struct termios *termios_p );
int cfsetispeed ( struct termios *termios_p, speed_t speed
);
pid_t tcgetpgrp ( int fd );
int tcsetpgrp ( int fd, pid_t pgrpid );
<h3>DESCRIPTION
</h3> The termios functions describe a general terminal inter-
face that is provided to control asynchronous communica-
tions ports.
Many of the functions described here have a termios_p
argument that is a pointer to a termios structure. This
structure contains the following members:
tcflag_t c_iflag; /* input modes */
tcflag_t c_oflag; /* output modes */
tcflag_t c_cflag; /* control modes */
tcflag_t c_lflag; /* local modes */
cc_t c_cc[NCCS]; /* control chars */
<h3>Linux February 25, 1995 1
</h3>
<h3>TERMIOS(2) Linux Programmer's Manual TERMIOS(2)
</h3>
c_iflag flag constants:
IGNBRK ignore BREAK condition on input
BRKINT If IGNBRK is not set, generate SIGINT on BREAK con-
dition, else read BREAK as character \0.
IGNPAR ignore framing errors and parity errors.
PARMRK if IGNPAR is not set, prefix a character with a
parity error or framing error with \377 \0. If
neither IGNPAR nor PARMRK is set, read a character
with a parity error or framing error as \0.
INPCK enable input parity checking
ISTRIP strip off eighth bit
INLCR translate NL to CR on input
IGNCR ignore carriage return on input
ICRNL translate carriage return to newline on input
(unless IGNCR is set)
IUCLC map uppercase characters to lowercase on input
IXON enable XON/XOFF flow control on output
IXANY enable any character to restart output
IXOFF enable XON/XOFF flow control on input
IMAXBEL
ring bell when input queue is full
c_oflag flag constants:
OPOST enable implementation-defined output processing
OLCUC map lowercase characters to uppercase on output
ONLCR map NL to CR-NL on output
OCRNL map CR to NL on output
ONOCR don't output CR at column 0
ONLRET don't output CR
OFILL send fill characters for a delay, rather than using
a timed delay
OFDEL fill character is ASCII DEL. If unset, fill
<h3>Linux February 25, 1995 2
</h3>
<h3>TERMIOS(2) Linux Programmer's Manual TERMIOS(2)
</h3>
character is ASCII NUL
NLDLY newline delay mask. Values are NL0 and NL1.
CRDLY carriage return delay mask. Values are CR0, CR1,
CR2, or CR3.
TABDLY horizontal tab delay mask. Values are TAB0, TAB1,
TAB2, TAB3, or XTABS. A value of XTABS expands
tabs to spaces (with tab stops every eight
columns).
BSDLY backspace delay mask. Values are BS0 or BS1.
VTDLY vertical tab delay mask. Values are VT0 or VT1.
FFDLY form feed delay mask. Values are FF0 or FF1.
c_cflag flag constants:
CSIZE character size mask. Values are CS5, CS6, CS7, or
CS8.
CSTOPB set two stop bits, rather than one.
CREAD enable receiver.
PARENB enable parity generation on output and parity
checking for input.
PARODD parity for input and output is odd.
HUPCL lower modem control lines after last process closes
the device (hang up).
CLOCAL ignore modem control lines
CIBAUD mask for input speeds (not used).
CRTSCTS
flow control.
c_lflag flag constants:
ISIG when any of the characters INTR, QUIT, SUSP, or
DSUSP are received, generate the corresponding sig-
nal.
ICANON enable canonical mode. This enables the special
characters EOF, EOL, EOL2, ERASE, KILL, REPRINT,
STATUS, and WERASE, and buffers by lines.
XCASE if ICANON is also set, terminal is uppercase only.
Input is converted to lowercase, except for
<h3>Linux February 25, 1995 3
</h3>
<h3>TERMIOS(2) Linux Programmer's Manual TERMIOS(2)
</h3>
characters preceded by \. On output, uppercase
characters are preceded by \ and lowercase charac-
ters are converted to uppercase.
ECHO echo input characters.
ECHOE if ICANON is also set, the ERASE character erases
the preceding input character, and WERASE erases
the preceding word.
ECHOK if ICANON is also set, the KILL character erases
the current line.
ECHONL if ICANON is also set, echo the NL character even
if ECHO is not set.
ECHOCTL
if ECHO is also set, ASCII control signals other
than TAB, NL, START, and STOP are echoed as ^X,
where X is the character with ASCII code 0x10
greater than the control signal. For example,
character 0x28 (BS) is echoed as ^H.
ECHOPRT
if ICANON and IECHO are also set, characters are
printed as they are being erased.
ECHOKE if ICANON is also set, KILL is echoed by erasing
each character on the line, as specified by ECHOE
and ECHOPRT.
FLUSHO output is being flushed. This flag is toggled by
typing the DISCARD character.
NOFLSH disable flushing the input and output queues when
generating the SIGINT and SIGQUIT signals, and
flushing the input queue when generating the SIG-
SUSP signal.
TOSTOP send the SIGTTOU signal to the process group of a
background process which tries to write to its con-
trolling terminal.
PENDIN all characters in the input queue are reprinted
when the next character is read. (bash handles
typeahead this way.)
IEXTEN enable implementation-defined input processing.
tcgetattr() gets the parameters associated with the object
referred by fd and stores them in the termios structure
referenced by termios_p. This function may be invoked
from a background process; however, the terminal
attributes may be subsequently changed by a foreground
<h3>Linux February 25, 1995 4
</h3>
<h3>TERMIOS(2) Linux Programmer's Manual TERMIOS(2)
</h3>
process.
tcsetattr() sets the parameters associated with the termi-
nal (unless support is required from the underlying hard-
ware that is not available) from the termios structure
referred to by termios_p. optional_actions specifies when
the changes take effect:
TCSANOW
the change occurs immediately.
TCSADRAIN
the change occurs after all output written to fd
has been transmitted. This function should be used
when changing parameters that affect output.
TCSAFLUSH
the change occurs after all output written to the
object referred by fd has been transmitted, and all
input that has been received but not read will be
discarded before the change is made.
tcsendbreak() transmits a continuous stream of zero-valued
bits for a specific duration, if the terminal is using
asynchronous serial data transmission. If duration is
zero, it transmits zero-valued bits for at least 0.25 sec-
onds, and not more that 0.5 seconds. If duration is not
zero, it sends zero-valued bits for duration*N seconds,
where N is at least 0.25, and not more than 0.5.
If the terminal is not using asynchronous serial data
transmission, tcsendbreak() returns without taking any
action.
tcdrain() waits until all output written to the object
referred to by fd has been transmitted.
tcflush() discards data written to the object referred to
by fd but not transmitted, or data received but not read,
depending on the value of queue_selector:
TCIFLUSH
flushes data received but not read.
TCOFLUSH
flushes data written but not transmitted.
TCIOFLUSH
flushes both data received but not read, and data
written but not transmitted.
tcflow() suspends transmission or reception of data on the
object referred to by fd, depending on the value of
action:
<h3>Linux February 25, 1995 5
</h3>
<h3>TERMIOS(2) Linux Programmer's Manual TERMIOS(2)
</h3>
TCOOFF suspends output.
TCOON restarts suspended output.
TCIOFF transmits a STOP character, which stops the termi-
nal device from transmitting data to the system.
TCION transmits a START character, which starts the ter-
minal device transmitting data to the system.
The default on open of a terminal file is that neither its
input nor its output is suspended.
The baud rate functions are provided for getting and set-
ting the values of the input and output baud rates in the
termios structure. The new values do not take effect
until tcsetattr() is successfully called.
Setting the speed to B0 instructs the modem to "hang up".
The actual bit rate corresponding to B38400 may be altered
with setserial(8).
The input and output baud rates are stored in the termios
structure.
cfgetospeed() returns the output baud rate stored in the
termios structure pointed to by termios_p.
cfsetospeed() sets the output baud rate stored in the
termios structure pointed to by termios_p to speed, which
must be one of these constants:
B0
B50
B75
B110
B134
B150
B200
B300
B600
B1200
B1800
B2400
B4800
B9600
B19200
B38400
B57600
B115200
B230400
The zero baud rate, B0, is used to terminate the connec-
tion. If B0 is specified, the modem control lines shall
no longer be asserted. Normally, this will disconnect the
line. CBAUDEX is a mask for the speeds beyond those
<h3>Linux February 25, 1995 6
</h3>
<h3>TERMIOS(2) Linux Programmer's Manual TERMIOS(2)
</h3>
defined in POSIX.1 (57600 and above). Thus, B57600 &
CBAUDEX is nonzero.
cfgetispeed() returns the input baud rate stored in the
termios structure.
cfsetispeed() sets the input baud rate stored in the
termios structure to speed. If the input baud rate is set
to zero, the input baud rate will be equal to the output
baud rate.
tcgetpgrp() returns process group ID of foreground pro-
cessing group, or -1 on error.
tcsetpgrp() sets process group ID to pgrpid. pgrpid must
be the ID of a process group in the same session.
<h3>RETURN VALUES
</h3> cfgetispeed() returns the input baud rate stored in the
termios structure.
cfgetospeed() returns the output baud rate stored in the
termios structure.
tcgetpgrp() returns process group ID of foreground pro-
cessing group, or -1 on error.
All other functions return:
0 on success.
-1 on failure and set errno to indicate the error.
</pre>
<hr>
<h3>SEE ALSO
</h3><p>
<pre>
<h3>Linux February 25, 1995 7
</h3>
</pre>
<P>
<hr>
<p>
<center>
<table border=2 width=80%>
<tr align=center>
<td width=25%>
<a href=../cref.html>Top</a>
</td><td width=25%>
<a href=../master_index.html>Master Index</a>
</td><td width=25%>
<a href=../SYNTAX/keywords.html>Keywords</a>
</td><td width=25%>
<a href=../FUNCTIONS/funcref.htm>Functions</a>
</td>
</tr>
</table>
</center>
<p>
<hr>
This manual page was brought to you by <i>mjl_man V-2.0</i>
|