Re: call insmod in C program




mbm wrote:
Hi

I need to insert kernel modules from a C application , is it possible
to do that without calling system("insmod ..")

Definitely. All you need to do is to take the insmod source code and
copy it into your application.
Simple as that. Open Source.


Hi, here goes the program.

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
setuid(0);
system("/sbin/insmod /.../yourmodule.ko");
system("/sbin/rmmod yourmodule");

return 0;

}

compile it with GCC, get back to me in case of any errors. i will be
more than glad to help.

.



Relevant Pages

  • Re: call insmod in C program
    ... mbm wrote: ... I need to insert kernel modules from a C application, ... to do that without calling system ... All you need to do is to take the insmod source code and copy it into your application. ...
    (comp.os.linux.development.system)
  • Re: call insmod in C program
    ... to do that without calling system ... All you need to do is to take the insmod source code and ... Just compile your module at a source directory, ... int main ...
    (comp.os.linux.development.system)
  • Re: Python extension performance
    ... My goal is to use Python to control a bunch of number crunching code, and I need to show that this will not incur a performance hit. ... You don't mention how many times you are calling the function. ... GCC for all modern x86 platforms. ... I meant to compile my extension statically instead of using a shared library by unpacking the source rpm and putting my code in the Modules/ directory. ...
    (comp.lang.python)