1) Why do we need to go so far back?
2) An alternative solution is to make xioctl a macro, or even expand it inline. (preference?) The code will look messier, but avoid the CheckPrototypeDefinition.

(The "long" may look trivial, but I spent ages debugging an opencv program before realising it was the request which was the invalid argument and not the more likely user provided *arg.)