almost working ioctl, but problems with read blocking