Termios is Unix API for terminal I/O.
The anatomy of a program performing serial I/O with the help of termios is as follows:
Open serial device with standard Unix system call open(2)
Configure communication parameters and other interface properties (line discipline, etc.) with the help of specific termios functions and data structures.
Use standard Unix system calls read(2) and write(2) for reading from, and writing to the serial interface. Related system calls like readv(2) and writev(2) can be used, too. Multiple I/O techniques, like blocking, non-blocking, asynchronous I/O (select(2) or poll(2)) or signal-drive I/O (SIGIO signal) are also possible.
Close device with the standard Unix system call close(2) when done.