Reputation: 7466
In our development team we are modifying a driver for our own needs. We need it to execute an external binary (user space application) in the linux filesystem.
Is it correct to do this? What would be the best way to call a binary from inside the linux kernel? system(), popen()?
Thanks for your answer.
Upvotes: 2
Views: 1363
Reputation: 7466
Well, I found a very well explained solution to my question.
char *argv[] = { "/usr/bin/logger", "help!", NULL };
static char *envp[] = {
"HOME=/",
"TERM=linux",
"PATH=/sbin:/bin:/usr/sbin:/usr/bin", NULL };
return call_usermodehelper( argv[0], argv, envp, UMH_WAIT_PROC );
I need to use the call_usermodehelper system calls. The example is self-explanatory. Source: http://www.ibm.com/developerworks/linux/library/l-user-space-apps/index.html
Upvotes: 5