I wanted to do some upcalls from linux kernelspace. Here is the code for that. Any command that works on bash command prompt will work here.
void do_upcall(char *cmd)
{
char *argv[4], *envp[1];
char swtch[3];
sprintf(swtch,"-c");
argv[0] = "/bin/sh";
argv[1] = swtch;
argv[2] = cmd;
argv[3] = 0;
envp[0] = 0;
call_usermodehelper (argv [0], argv, envp);
}
This is not a breakthrough. Most of the linux hackers would take not more than 5 minutes to get this right. I am posting this just for the heck of it. :)
posted by rumplestiltskin @
1:50 pm
0 comments