Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
cfgetospeed(3)
Edit
PageHistory
Diff
Info
LikePages
TERMIOS !!!TERMIOS NAME SYNOPSIS DESCRIPTION RETURN VALUE SEE ALSO ---- !!NAME termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, 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 !!SYNOPSIS __#include __ #include __ __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'' __);__ __int cfmakeraw ( struct termios *__''termios_p'' __);__ __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'' __);__ !!DESCRIPTION The termios functions describe a general terminal interface that is provided to control asynchronous communications 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 */ ''c_iflag'' flag constants: __IGNBRK__ ignore BREAK condition on input __BRKINT__ If __IGNBRK__ is not set, generate __SIGINT__ on BREAK condition, 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 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 signal. __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 characters preceded by . On output, uppercase characters are preceded by \ and lowercase characters 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 0x40 greater than the control signal. For example, character 0x08 (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 SIGSUSP signal. __TOSTOP__ send the SIGTTOU signal to the process group of a background process which tries to write to its controlling 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. The ''c_cc'' array defines the special control characters. The symbolic indices (and meaning: initial values) are: VINTR (interrupt character: 0177, DEL, rubout), VQUIT (quit character: 034, FS, Ctrl-), VERASE (erase character: 010, BS, Ctrl-H), VKILL (kill character: 025, NAK, Ctrl-U), VEOF (end-of-file character: 004, EOT, Ctrl-D), VMIN, VEOL (additional end-of-line character: 0, NUL), VTIME, VEOL2 (yet another end-of-line character: 0, NUL), VSWTCH (switch character: 0, NUL), VSTART (start character: 021, DC1, Ctrl-Q), VSTOP (stop character: 023, DC3, Ctrl-S), VSUSP (suspend character: 032, SUB, Ctrl-Z), VDSUSP (delayed suspend character: 031, EM, Ctrl-Y), VLNEXT (literal next: 026, SYN, Ctrl-V), VWERASE (word erase: 027, ETB, Ctrl-W), VREPRINT (reprint unread characters: 022, DC2, Ctrl-R), VDISCARD (discard pending output: 017, SI, Ctrl-O). These symbolic subscript values are all different, except that VTIME, VMIN may have the same value as VEOL, VEOF, respectively. (In non-canonical mode the special character meaning is replaced by the timeout meaning. MIN represents the minimum number of characters that should be received to satisfy the read. TIME is a decisecond-valued timer. When both are set, a read will wait until at least one character has been received, and then return as soon as either MIN characters have been received or time TIME has passed since the last character was received. If only MIN is set, the read will not return before MIN characters have been received. If only TIME is set, the read will return as soon as either at least one character has been received, or the timer times out. If neither is set, the read will return immediately, only giving the currently already available characters.) __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 process. __tcsetattr()__ sets the parameters associated with the terminal (unless support is required from the underlying hardware 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 seconds, 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'': __TCOOFF__ suspends output. __TCOON__ restarts suspended output. __TCIOFF__ transmits a STOP character, which stops the terminal device from transmitting data to the system. __TCION__ transmits a START character, which starts the terminal 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 setting 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 __B38400__ may be altered with setserial(8). The input and output baud rates are stored in the __termios__ structure. __cfmakeraw__ sets the terminal attributes as follows: termios_p- __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 connection. 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 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 processing 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. !!RETURN VALUE __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 processing group, or -1 on error. All other functions return: 0 on success. -1 on failure and set ''errno'' to indicate the error. !!SEE ALSO setserial(8) ----
One page links to
cfgetospeed(3)
:
Man3c
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.