There are two types of programming interfaces under Linux:
1) APIs for User Space Applications:
Linux provides API for user space applications (everything outside the kernel) called system calls. It is an interface between application and kernel.
Usually, we do not invoke system calls directly. Instead, we call wrapper methods like “exit()” provided by library like libc. For more information on system call and their implementations, please go through “System call” post.
2) APIs for Kernel Space Applications:
In order to make Kernel programming (writing modules/drivers) easier, Linux Kernel exports many methods including system call handlers. These methods are also called Kernel interface. To see these interfaces (exported symbols), you can run “cat /proc/kallsyms” command.
[root@linux ~]# grep sys_exit /proc/kallsyms
ffffffff810709f0 T sys_exit
“sys_exit” is an interface for kernel programmers which handle exit system call. From kernel module, we can directly call these system call handlers along with other kernel APIs.
Kernel application/programs in Linux are known as Kernel Module. These modules can be loaded and unloaded at runtime without rebooting the kernel. Once they get loaded into the memory, they become part of the kernel. Thus they can access all kernel exported methods directly.