Skip to contentSkip to conversation

kthread execve question

DISCUSSION Petr Vandrovec 1 participant 1 message Sep 2, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines · Der Herr Hofrat

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)

Quoted 8 lines
{
    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