On Sun, Nov 13, 2005 at 13:00:56 +0500, Fawad Lateef wrote: > On 11/12/05, Hossein Aminaiee <aminaiee@xxxxxxxxx> wrote: > > Dear all, > > I just wanted to know how it is possible to open a device file in a > > linux module and issue ioctl commands. I have included asm/ioctl.h in my > > code. But whenever I want to insert my module, I get "unknown symbol > > ioctl" message from the kernel. > > Is there any tutorial available, or Any tips and tricks? > > You can't directly call ioctl function rather you have to get the the > file_operations or block_device_operation pointers of the device > (registered with kernel in registration function of device) on which > you want to call ioctl. Or you have to work-out on doing system-calls > from with-in the kernel module .... I am giving a code example which I > used to open a file in kernel module and perform read operation on it > and you can try/use the same method to call ioctl rather than read in > below code example ! I would, however, suggest first looking at the code of the particular ioctl you want to call and try to invoke the underlying code more directly. The overhead of opening a file and calling through ioctl is likely not necessary. There is another thing - you are likely doing something, that does not belong in kernel at all in the first place. -- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature