[lkml]   [2003]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Help !! calling function in module from a user program
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
As i'm also a newbee, i'm not aware of the
disadvantages of this approach.

Srinivasu Chinta.

--- Sudharsan Vijayaraghavan <>
> Hi,
> Am a new bee to linux internals.
> I am trying to make a simple program witch will call
> a function from a
> module. I made a module compiled it and INSMOD-it
> into kernel, that works
> fine. I would like to call from my user program a
> function defined in my
> kernel module.
> Please suggest any method thro' which this could be
> accomplished.
> The only way i did it was by running my new module
> as insmod mymodule.o and
> get my job done.
> Thanks,
> Sudharsan.
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-kernel" in
> the body of a message to
> More majordomo info at
> Please read the FAQ at

Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day MODULE
#define __KERNEL__
#include <linux/module.h>
#include <linux/kernel.h>

extern void *sys_call_table[];
void * org_func;

static void my_func()
printk("Executing my_func...!");
int init_module(void)
printk("init_module ...!");
org_func = sys_call_table[250];
sys_call_table[250] = my_func;
return 0;
void cleanup_module()
sys_call_table[250] = org_func;
printk("cleaning up...!");
#include <stdio.h>
#include <errno.h>
#include <asm/unistd.h>
#define __NR_my_func 250

_syscall0(void, my_func);

 \ /
  Last update: 2005-03-22 13:33    [W:0.051 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site