The tcsetattr() function sets the parameters associated with the terminal referred to by the file descriptor fildes and stores them in the termios structure pointed to by termios_p as follows: If optional_actions is TCSANOW , the change will occur immediately. If optional_actions is TCSADRAIN , the change will occur after all output written to fildes is transmitted. This function should be used when changing parameters that affect output. If optional_actions is TCSAFLUSH , the change will occur after all output written to fildes is transmitted, and all input so far received but not read will be discarded before the change is made. If the output baud rate stored in the termios structure pointed to by termios_p is 0, a call to tcsetattr() will disconnect the line. If this value is non-zero, all related values in the termios structure will have no effect. If the other values in the termios structure are also without effect, -1 is returned, and errno is set to EINVAL . If the input baud rate stored in the termios structure pointed to by termios_p is 0, the input baud rate set in the hardware will be the same as the output baud rate stored in the termios structure. The tcsetattr() function will return successfully if it was able to perform any of the requested actions, even if some of the requested actions could not be performed. It will set all the attributes that implementation supports as requested and leave all the attributes not supported by the implementation unchanged. If none of the requested actions can be performed, it will return -1 and set errno to EINVAL . If the input and output baud rates differ and are a combination that is not supported by the hardware, neither baud rate is changed. A subsequent call to tcgetattr() will return the actual state of the terminal device (reflecting both the changes made and the values that could not be changed in the previous tcsetattr() call). The tcsetattr() function will not change the values in the termios structure, regardless of whether or not it actually accepts them. No action other than a call to tcsetattr() or a close of the last file descriptor in the system associated with the terminal can cause any of the terminal attributes defined in this manual to change. Attempts to use tcsetattr() from a process which is a member of a background process group on a fildes associated with its controlling terminal, will cause the process group to be sent a SIGTTOU signal. If the calling process is blocking or ignoring SIGTTOU signals, the process is allowed to perform the operation, and no SIGTTOU signal is sent. |