|
|
The last process to close a terminal-device-file causes any output remaining to be sent to the device and any input remaining to be discarded. Following these actions, if the flag HUPCL is set in the control-modes and the communication-port supports a disconnect function, the terminal-device does a disconnect.
Because the POSIX.1 standard is silent on whether a close blocks waiting for transmission to drain, or even if a close might flush any pending output, a program concerned about how data in terminal input and output-queues are handled should call the appropriate functions such as tcdrain to ensure the desired behavior (see close(S) and tcdrain in termios(S)).