On Sat, Jan 3, 2009 at 5:45 PM, niamathullah sharief <shariefbe@xxxxxxxxxxx> wrote: > i know that "ioctl()" is an system call....but can anyone tell me how it > works...from where it called....? these are the things u need to know: a. ioctl() is a syscall. b. from userspace ioctl(), it will jump to sys_ioctl(), in fs/ioctl.c. c. from sys_ioctl(), do_vfs_ioctl() will be called. d. inside the switch() for do_vfs_ioctl(), observed that the different constant are switch. as this big switch will cater for ANY IOCTL constant, it is therefore important that all the ioctl be centralized into ONE include file: arch/x86/include/asm/ioctls.h. (all the constants inside this file must not overlap one another) e. using one example - drivers/video/tcx.c case, it is filtered from do_vfs_ioctl() to vfs_ioctl(), (or file_ioctl(), not sure).....and then subsequently to tcx_ioctl() (inside tcx.c). observe how registration is needed (register_framebuffer(info)). For details: http://lwn.net/Articles/119652/ http://lwn.net/Articles/206765/ As u can see, the entire chain is very non-trivial, if u want to add just one constant and a function pointer for that control. So the following patch attempt to simplify all these: http://lwn.net/Articles/300917/ -- Regards, Peter Teoh -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ