[][src]Function termios::tcsetattr

pub fn tcsetattr(fd: RawFd, action: c_int, termios: &Termios) -> Result<()>

Sets a terminal device's parameters.

tcsetattr() returns successfully if it was able to perform any of the requested actions, even if other requested actions could not be performed. It will set all attributes that the implementation supports and leave others unchanged. The Termios structure will not be updated to reflect the changes that were applied.

In order to determine which parameters were applied to the terminal device, an application should use tcgetattr() to obtain the latest state of the terminal device. In particular, when attempting to change baud rates, tcgetattr() can be used to determine which baud rates were actually selected.

If none of the requested actions could be performed, then tcsetattr() returns an error.

Parameters

  • fd should be an open file descriptor associated with a terminal.
  • action should be one of the constants:
    • TCSANOW applies the change immediately.
    • TCSADRAIN applies the change after all output previously written to fd is transmitted. This mode should be used when changing parameters that affect output.
    • TCSAFLUSH applies the change after all output previously written to fd is transmitted. All data received but not read is discarded before applying the change.
  • termios should be a mutable reference to a Termios structure containing the parameters to apply to the terminal device.