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

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

Post by Nilesh Pate » Sat, 27 May 2000 04:00:00



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);

Quote:}

/* 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;

Quote:}

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);

Quote:}

/* 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

 
 
 

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

Post by anthony to » Mon, 29 May 2000 04:00:00


[...]

Quote:>/* 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

Shouldn't that be -bE:./testcall.exp? Assuming that testcall.exp
has testcall exported and int testcall() is in testcall.o

 
 
 

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

Post by Gary R. Hoo » Thu, 01 Jun 2000 04:00:00



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

> /* 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

You might also lose the -H and -T options.  They're not necessary on
AIX 4.x.  As another post stated, try -bE:testcall.exp

--
Gary R. Hook / AIX Kernel Development, IBM / These opinions are _MINE_
________________________________________________________________________
A piece of canvas is only the beginning
It takes on character with every loving stroke
This thing of beauty is the passion of an artist's heart
By God's design, we are a skin kaleidoscope    "Colored people", dc Talk