You can try calling sys_ioctl
.
It is exported if the kernel is compiled using CONFIG_COMPAT
.
Or, if you have a struct file_operations
device driver, you can directly call its ioctl
handler.
However, the ioctl descriptor expects the pointer parameters to be in the address space of the current process, and not in the address space of the kernel. copy_from_user
will be used to read them. If you point to the kernel address space, copy_from_user
will fail. I do not understand how you will get around this.
Edit:
If you call the ioctl handler between the code below than copy_from_user
, it will never fail.
mm_segment_t fs; fs = get_fs(); set_fs (get_ds()); set_fs(fs);
source share