>Maybe it's an odd question:
>
>I'm making some test on module programming to accomplish a simple purpose 
>which is based on the el
ementary structure of a module (such as _init, _fini , _info......).And the 
purpose is:
>
>TO EXECUTE AN EXTERNAL COMMAND WHEN THE MODULE IS LOADED

You cannot do that.

In your particular case, the exec code will inside a process; but normally 
it will be loaded inside the kernel (i.e., w/o a process)

>
>     char arg0[] = "ls ";
>     char arg1[] = "-l ";
>     char arg2[] = "/ ";
>     char arg3[] = ">> ";
>     char arg4[] = "/tmp/abc.txt";
>     char arg5[] = "\0";
>     const char *argp[6] = {arg0,arg1,arg2,arg3,arg4,arg5};

You're using shell (>> ....) and you're not invoking the shell.



>1.The function exec_common cannot be called in such a way?


No; it's a private function and it should not be called from
drivers.

>2.The kernel doesn't allow the kernel space to execute an external function 
>when module loaded?

We don't protect again calling wrong functions.

>3.If I stick to accomplishing my purpose,how?


You can't; that is, you cannot start a program from inside your module.

What exactly do you want to do?

Casper

_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to