Add ioctl and wait handler.