next up previous contents
Next: Appendix - Code Listing Up: Netlink Sockets - Overview Previous: What happens in the   Contents

Appendix - System calls

A system call works on the basis of a defined transition from User Mode to System Mode. In Linux, this is done by calling the interrupt 0x80, together with the actual register values and the number of the system call. The kernel (in system mode) calls a kernel function out of the _sys_call_table table in arch/i386/kernel/entry.S. The conversion from a function used by a program to the system call is carried out in the C library. The actual work of the system calls is taken care of by the interrupt routine, this starts at the entry address _system_call() held in arch/i386/kernel/entry.S. When the interrupt service routine returns, the return value is read from the appropriate transfer register and the library function terminates.

As an example, there is a single system call sys_socket_call() that allows the entire programming of the sockets. The corresponding sections of the code are:

This is the entry in the sys_call_table for resolving the system call.

ENTRY(sys_call_table)

    .long SYMBOL_NAME(sys_socketcall)

The number and name of the system call is defined in include/asm-i386/unistd.h as

	#define __NR_socketcall     102


next up previous contents
Next: Appendix - Code Listing Up: Netlink Sockets - Overview Previous: What happens in the   Contents
Gowri Dhandapani
1999-10-03