Defining System Calls


SYSCALL_DEFINE0(getpid)
{
        return task_tgid_vnr(current); // returns current->tgid
}

Expands into

asmlinkage long sys_getpid(void)

The asmlinkage modifier tells the compiler to look only on the stack for this function’s arguments. This is a required modifier for all system calls.

getpid() system call is defined as sys_getpid() in the kernel. This is the naming convention taken with all system calls in Linux: System call bar() is implemented in the kernel as function sys_bar().

results matching ""

    No results matching ""