Search here because I know this question just came up and the solution was posted. It has something to do with ioctrl(). Also there is an old header file that contains a function that handles it. If you curious about which it is go digging in the kernel source.
Sorry about the lame answer.