How to execute shell command in kernel programming?

c, kernel-module, linux-kernel, ubuntu

Solution

It's simple!

#include <linux/kmod.h>

char * envp[] = { "HOME=/", NULL };
char * argv[] = { "/bin/ls", NULL };

call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);

Problem

I want to use `system()` function of `stdlib.h` in my c code. I am actually working on kernel programming. Whenever i want to use `system()` in it, it gives error to `stdlib.h` saying no such file found.

Original source

Related problems