Q: Kernel system calls

Q: Kernel system calls

Post by Harshad Parek » Fri, 12 Sep 1997 04:00:00

Quote:> 1) Can a kernel module use system calls? meaning: is there some
>    kernel implementation of an interface, which gives device
>    drivers and modules functionality similar to system calls
>    for user processes (the ones which are relevant to the kernel) ?
> Bye,
> David.

All system calls that user processes invoke finally map down to a
well defined kernel routine. From the kernel module you may directly
invoke these routine. However, make sure that you also perform the
necessary intialization/setup that syscall path may have performed.

I had used this approach in SunOS 4.0.1 long back to create a file and
write in the file, all from within the kernel module.



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 {

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


2. Where is forward(5) man page?

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

4. cciss hardware raid info

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

6. using Linux+PPP instead of Compuserveā€²s Internet Dialer ?

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

8. Booting NT, FreeBSD & Linux ?

9. system call to get calling processes tty?

10. Calling a Loadable System Call

11. System Call, Library Call and Process Size

12. Reentrant system calls (can be called from signal handler)

13. calling system calls