convert tcgetattr to ioctl