1#include <errno.h> 2#include <sys/ioctl.h> 3#include <termios.h> 4 5int tcsetattr(int fd, int act, const struct termios* tio) { 6 if (act < 0 || act > 2) { 7 errno = EINVAL; 8 return -1; 9 } 10 return ioctl(fd, TCSETS + act, tio); 11} 12