Fixed some bugs now it should work.
Ioctler succeeds even if ioctl does not, the return of ioctl is printed.