public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* How to run an a.out file in a kernel module
@ 2006-10-27 10:16 ranjith kumar
  2006-10-27 11:06 ` Jiri Slaby
  2006-10-27 11:06 ` Erik Mouw
  0 siblings, 2 replies; 5+ messages in thread
From: ranjith kumar @ 2006-10-27 10:16 UTC (permalink / raw)
  To: linux-kernel

Hi,

          How to run an a.out file in a kernel module
             I tried to include
                                    system("./a.out");
     in the C file. But I got compilation errors.

Thanks in advance.

Send instant messages to your online friends http://uk.messenger.yahoo.com 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to run an a.out file in a kernel module
  2006-10-27 10:16 How to run an a.out file in a kernel module ranjith kumar
@ 2006-10-27 11:06 ` Jiri Slaby
  2006-10-27 11:06 ` Erik Mouw
  1 sibling, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2006-10-27 11:06 UTC (permalink / raw)
  To: ranjith kumar; +Cc: linux-kernel

ranjith kumar wrote:
> Hi,
> 
>           How to run an a.out file in a kernel module
>              I tried to include
>                                     system("./a.out");
>      in the C file. But I got compilation errors.

And what exactly do you want kernel to do?
If you want to create a process, see module loading procedure from kernel (i.e.
calling modprobe) -- request_module function or calling 'init=' program --
run_init_process.

regards,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to run an a.out file in a kernel module
  2006-10-27 10:16 How to run an a.out file in a kernel module ranjith kumar
  2006-10-27 11:06 ` Jiri Slaby
@ 2006-10-27 11:06 ` Erik Mouw
  2006-10-29 11:19   ` ranjith kumar
  1 sibling, 1 reply; 5+ messages in thread
From: Erik Mouw @ 2006-10-27 11:06 UTC (permalink / raw)
  To: ranjith kumar; +Cc: linux-kernel

On Fri, Oct 27, 2006 at 11:16:11AM +0100, ranjith kumar wrote:
>           How to run an a.out file in a kernel module
>              I tried to include
>                                     system("./a.out");
>      in the C file. But I got compilation errors.

Simple: you don't. There are a bunch of problems over here:

1) The system() call is a userland libc call and doesn't exist in the
   kernel
2) You can't be sure you're in user context
3) You don't know in what filesytem namespace you are

You could use call_usermodehelper() if you really need to call a
usermode helper, but usually it's a sign of bad design if you need to.


Erik

-- 
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to run an a.out file in a kernel module
  2006-10-27 11:06 ` Erik Mouw
@ 2006-10-29 11:19   ` ranjith kumar
  2006-10-29 12:31     ` Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: ranjith kumar @ 2006-10-29 11:19 UTC (permalink / raw)
  To: linux-kernel

Hi,
    1) What is the synatx of call_usermodehelper()
function?
        I found out that it takes 4 arguments. But
what values  we have to pass as argumets.
I did searched in internet. But could not find out.
Sorry to post this question.

2) How to print something  using C code such that it
will be displayed when corresponding a.out file is
called in a kernel module using call_usermodehelper()
function.

Thanks in advance.

--- Erik Mouw <erik@harddisk-recovery.com> wrote:

> On Fri, Oct 27, 2006 at 11:16:11AM +0100, ranjith
> kumar wrote:
> >           How to run an a.out file in a kernel
> module
> >              I tried to include
> >                                    
> system("./a.out");
> >      in the C file. But I got compilation errors.
> 
> Simple: you don't. There are a bunch of problems
> over here:
> 
> 1) The system() call is a userland libc call and
> doesn't exist in the
>    kernel
> 2) You can't be sure you're in user context
> 3) You don't know in what filesytem namespace you
> are
> 
> You could use call_usermodehelper() if you really
> need to call a
> usermode helper, but usually it's a sign of bad
> design if you need to.
> 
> 
> Erik
> 
> -- 
> +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70
> 370 12 90 --
> | Lab address: Delftechpark 26, 2628 XH, Delft, The
> Netherlands
> -
> 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/
> 



		
___________________________________________________________ 
All New Yahoo! Mail – Tired of Vi@gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to run an a.out file in a kernel module
  2006-10-29 11:19   ` ranjith kumar
@ 2006-10-29 12:31     ` Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2006-10-29 12:31 UTC (permalink / raw)
  To: ranjith kumar; +Cc: linux-kernel

Do NOT top-post.

ranjith kumar wrote:
> Hi,
>     1) What is the synatx of call_usermodehelper()
> function?
>         I found out that it takes 4 arguments. But
> what values  we have to pass as argumets.
> I did searched in internet. But could not find out.
> Sorry to post this question.

grep -r call_usermodehelper linux/

> 2) How to print something  using C code such that it
> will be displayed when corresponding a.out file is
> called in a kernel module using call_usermodehelper()
> function.

By adding printk to call_usermodehelper?

regards,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-29 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-27 10:16 How to run an a.out file in a kernel module ranjith kumar
2006-10-27 11:06 ` Jiri Slaby
2006-10-27 11:06 ` Erik Mouw
2006-10-29 11:19   ` ranjith kumar
2006-10-29 12:31     ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox