It does help, thanks!
IIRC, ioctl(2) is an interface to special files (/dev entries). You might be able to continue using ioctl, as you have designed your program, but instead of polling continuously, add notification through kqueue(2)/kevent(2) instead. Or, perhaps you could abandon ioctl (since it was intended for device control, not information gathering) and consider using the suite of socket(2)-based syscalls.
|