Messages in this thread | ![/](/images/icornerl.gif) | | Subject | Re: Help !! calling function in module from a user program | From | Alex Bennee <> | Date | 18 Feb 2003 14:04:17 +0000 |
| |
On Tue, 2003-02-18 at 13:43, Srinivas Chinta wrote: > Hi, > One way of doing this is , by hooking up your function > inside the module as a system call. > Here i'm sending two files, module.c and user_space.c. > first do "insmod module.o" and then run > "./user_space". > As i'm also a newbee, i'm not aware of the > disadvantages of this approach.
The main disadvantage is your driver/module becomes a specialized device that can only be accessed by special syscall incantaion by one application. The Un*x way is about keeping every thing as standard as possible so there is easy interaction between user-mode programs accessing the device even if they don't know the details of the internals.
Most devices can be treated as char devices or block devices and are coded as such. This way you can dump the contents of your hard-drive by doing "cat /dev/hda1 > dump" without cat having intimate knowledge of what a hard drive is and how to access one.
Of course there will always be times when new system calls need to be added but generally this should be done sparinginly.
-- Alex, homepage: http://www.bennee.com/~alex/
He missed an invaluable opportunity to hold his tongue. -- Andrew Lang
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |