performance: call ioctl() less often
Merge pull request #10 from danrl/master

performance: call ioctl() less often