typos in ioctl
missing locals