func Tcflush(fd, which uintptr) error {
	return unix.IoctlSetPointerInt(int(fd), unix.TIOCFLUSH, int(which))
}
Tcflush discards data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of which.
package termios
import (
	"time"
	"golang.org/x/sys/unix"
)
const (
	IXON       = 0x00000200
	IXOFF      = 0x00000400
	IXANY      = 0x00000800
	CCTS_OFLOW = 0x00010000
	CRTS_IFLOW = 0x00020000
	CRTSCTS    = CCTS_OFLOW | CRTS_IFLOW
)
func Tcgetattr(fd uintptr) (*unix.Termios, error) {
	return unix.IoctlGetTermios(int(fd), unix.TIOCGETA)
}
func Tcsetattr(fd, opt uintptr, argp *unix.Termios) error {
	switch opt {
	case TCSANOW:
		opt = unix.TIOCSETA
	case TCSADRAIN:
		opt = unix.TIOCSETAW
	case TCSAFLUSH:
		opt = unix.TIOCSETAF
	default:
		return unix.EINVAL
	}
	return unix.IoctlSetTermios(int(fd), uint(opt), argp)
}
func Tcsendbreak(fd uintptr, duration int) error {
	if err := unix.IoctlSetInt(int(fd), unix.TIOCSBRK, 0); err != nil {
		return err
	}
	time.Sleep(4 / 10 * time.Second)
	return unix.IoctlSetInt(int(fd), unix.TIOCCBRK, 0)
}
func Tcdrain(fd uintptr) error {
	return unix.IoctlSetInt(int(fd), unix.TIOCDRAIN, 0)
}