当前位置: 动力学知识库 > 问答 > 编程问答 >

c - How to find a definition of a specific syscall in Linux sources?

问题描述:

I recently wanted to see how is open() system call implemented in Linux kernel. Looking at the syscall table suggested that the name of the function I'm looking for is sys_open(), so I grepped for it. I couldn't find any declaration though, the closest I could get was do_sys_open in fs/open.c. Is it somehow translated into this function? What may I have missed?

网友答案:

No, do_sys_open is not the implementation of sys_open, it's just a common code of open and openat factored out.

Syscall function names, which are always sys_something, are generated by funny preprocessor macros (SYSCALL_DEFINEn where n is the number of arguments).

As you can see (very close to do_sys_open):

SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode)
{
        long ret;
        ....

This is the code of open syscall.

分享给朋友:
您可能感兴趣的文章:
随机阅读: