Re: kthread execve question

From: Petr Vandrovec (VANDROVE@vc.cvut.cz)
Date: Mon Sep 02 2002 - 11:18:55 EST


On 2 Sep 02 at 17:03, Der Herr Hofrat wrote:
>
> any hint whats wrong ? any pointers to using kernel threads dosc/examples in
> general and how to execute user space apps would be appreciated.
>
> char cmd_path[256] = "/bin/echo";
>
> static int exec_cmd(void * kthread_arg)
> {
> static char * envp[] = { "HOME=/",
> "TERM=linux",
> "PATH=/:/bin:/usr/bin:/usr/bin",
> NULL };
> char *argv[] = { kthread_arg,
> ">>",
> "/tmp/kthread_echo",

'>>' is bash thing. Try executing "/bin/touch" with "/tmp/testfile" instead.
If /tmp/testfile will appear, you got it.

And also do not forget that argv[0] should contain program name, not
first argument - so in most cases you want
exec_usermodehelper(argv[0], argv, envp) ...
                                                    Petr Vandrovec
                                                    
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:16 EST