The interceptor of ioctl is using a non-standard prototype:
INTERCEPTOR(int, ioctl, int d, unsigned request, void *arg)
At least on OS X, the request argument should be unsigned long and not just unsigned, and also instead of the last argument (arg), the function should be accepting a variable number of arguments, so the prototype should be (per https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/ioctl.2.html):
int ioctl(int fildes, unsigned long request, ...);
It looks to me that this prototype is valid for Linux as well (http://man7.org/linux/man-pages/man2/ioctl.2.html), but I've also found other documents that have request as int and not long (http://linux.die.net/man/2/ioctl). I'm not sure if we need an platform-specific #if.
I have actually seen a memory corruption and a crash because of that, but I'm unable to create a reproducible test case for it.
I agree with "unsigned long request", but is there any benefit in the _unconditional_ va_arg stuff? We don't reliably know if there is an argument to a given ioctl or not, and then we pass this (possible garbage) value to REAL(ioctl) in any case.