Explain System Call initialization and invocation include as

Explain System Call initialization and invocation (include as many details and function calls as you can).

Solution

System Calls.

                           System calls is an programmatic approach in which a system program requests a service from the kernal of the operating system is to executed on. It was an basic interface in between an application and the Kernal.

Below mentioned are the types of System Call.

1. Process Control

2. File Manipulation

3. Device Manipulation

4. Infomation Maintenance

5. Communication

6. Protection.

System Call Invocation.

                                   Generally system calls are identified by their numbers. System calls can\'t be directly called from the process. Instead, they are called indirectly through interrupt and looked up in an interrupt table. So when you define a new system call you\'ll have to enter a new entry in this table.

You can do this by editing the file linux/arch/i386/kernel/entry.s

Inside it will be like

   . data

     Entry (sys_call_table)

    .long SYMBOL_NAME(sys_ni_call)

    .long SYMBOL_NAME(sys_exit)

    . . .

    .long SYMBOL_NAME(sys_vfork)

Once after the \"SYS_VFORK\" line add your entries for your new systme calls, with the word \"sys_\" pretended.

To execute new system call use the following.

.long SYMBOL_NAME(sys_myservice)

At the end of your new system calls you should add #define with prefix\"_NR_\". It will be like

#define_NR_myservice

System Call Initialization:

                                            Suppose if need a global variable that your new system call will use, which would be a case for implementing new process synchronization primitive, it is mandatory to initialize the variable at system bootup time.

Here you\'ve to add your own init function with return type VOID followed by keyword \'_init\'.

And then you\'ve to add 2 lines

        linux/init/main.c

It is to invoke your initialization function at the bootup

Example

myservice.h

...

#include<linux/init.h>

. . .

void_init myservice_init(void);

myservice.c

. . .

void_init myservice_init(void)

{

/*need to initialize the global variable used by myservice*/

}

linux/init/main.c

. . .

extern void myservice_init(void);

. . .

myservice_init();

Explain System Call initialization and invocation (include as many details and function calls as you can).SolutionSystem Calls. System calls is an programmatic
Explain System Call initialization and invocation (include as many details and function calls as you can).SolutionSystem Calls. System calls is an programmatic

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site