ptg10805159Section 18.2 Overview 677
Function Description
tcgetattr fetch attributes (termiosstructure)
tcsetattr set attributes (termiosstructure)
cfgetispeed get input speed
cfgetospeed get output speed
cfsetispeed set input speed
cfsetospeed set output speed
tcdrain wait for all output to be transmitted
tcflow suspend transmit or receive
tcflush flush pending input and/or output
tcsendbreak send BREAK character
tcgetpgrp get foreground process group ID
tcsetpgrp set foreground process group ID
tcgetsid get process group ID of session leader for controlling TTYFigure 18.7 Summary of terminal I/O functionsThe relationships among the 13 functions shown in Figure18.7 areillustrated in
Figure18.8.input baud rate output baud rate
struct
termiosterminal line discipline / terminal device drivercfsetispeedcfgetispeedcfsetospeedcfgetospeedtcsetattr tcgetattr tcsendbreaktcdraintcflushtcflowline control functionstcgetsidtcgetpgrptcsetpgrpforeground
process group IDFigure 18.8Relationships among the terminal-related functionsPOSIX.1 doesn’t specify where in thetermiosstructurethe baud rate information is stored;
that is an implementation detail. Some systems, such as Solaris, storethis information in the
c_cflagfield. Linux and BSD-derived systems, such as FreeBSD and Mac OS X, have two
separate fields in the structure: one for the input speed and one for the output speed.