A system call in the kernel

A system call in the kernel

Post by Michael J Clar » Sat, 30 Jun 2001 02:20:10



Any ideas on hot to easily call an outside program from the kernel (like
system(), exec()....)  Is this possible?  Thanks

Mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

A system call in the kernel

Post by Richard B. Johnso » Sat, 30 Jun 2001 02:40:07



> Any ideas on hot to easily call an outside program from the kernel (like
> system(), exec()....)  Is this possible?  Thanks

> Mike
> -

Look through the drivers and check upon "kernel_thread()". This shares
the process context of 'init' so you can do a lot of "user-mode" things
in the kernel. But.... beware.... User mode stuff should be done in
user-mode, not in the kernel.

Cheers,
* Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://www.veryComputer.com/
Please read the FAQ at  http://www.veryComputer.com/

 
 
 

A system call in the kernel

Post by Brian Gers » Sat, 30 Jun 2001 03:00:17



> Any ideas on hot to easily call an outside program from the kernel (like
> system(), exec()....)  Is this possible?  Thanks

Check exec_usermodehelper in kmod.c

--

                                Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. Kernel Extension(system call) loaded but could not call it !!!!

Hi ,
can anybody tell me why I am unable to call my own system call.

/* This is the kernel extension I wrote */

testcall_entry(int cmd, struct uio *uio)
{

   if (cmd == CFG_INIT) {
      if (pincode(testcall_entry) != 0) { /* pin the kernel ext into
memory */
         return(ENOMEM);                  /* report error  */
         }
      }
   else {
      unpincode(testcall_entry);
   }
   return(0);

/* These are the steps I followed to compile the extension */
cc -c -O -qlist -qsource testcall.c
ld -e testcall_entry -T512 -H512 -bI:./testcall.exp -bI:./kernex.exp
testcall.o -o testcall

/* this is a test system call */
int testcall()
{
        return 10;

Yes I did load the kernel extension and it was loaded successfully and
gave me kmid also.

/* This is a sample file to test system call */
main ()

{
        int val = 0;

        printf ("value before testcall %d\n",val);
        val = testcall ();
        printf ("value after testcall %d\n",val);

/* This is what I use to compile this program */
cc -bI:./kernex.exp -bI:./testcall.exp sample.c

/* This is the error it gives  when I run the a.out file */
exec(): 0509-036 Cannot load program a.out because of the following
errors:
        0509-023 Symbol testcall in a.out is not defined.
        0509-026 System error: Cannot run a file that does not have a
valid format.

Nilesh

2. wuarchive ftpd on AIX ???

3. How I could add a new system call to linux or modify a system calls

4. Linux-FT from Computer Shopper (UK) CD - castrated version?

5. How to use open system call in a new system call

6. Blur problem with X-Window

7. "Interrupted system call" at "low level" - system calls

8. unix shell script question ?

9. Security from outside call-ins

10. Need System Call to return %MEM (kernel mem) used by process

11. Adding system calls to the kernel....

12. system call to get calling processes tty?

13. How to make kernel calls to SCO XENIX System V?