Linux源代码中的MOUNT API在哪里实现?
我是Linux内核的新手,我从Github上的存储库中克隆了Linux源。我找不到文件sys/mount。
您知道这个文件位于源代码中吗?在哪里可以找到它的实施?
I am newbie for Linux kernel, I cloned the Linux source from its repo on GitHub. I cannot find the file sys/mount.h
nor the mount
function.
Do you know where is this file located in source code? Where can I find its implementation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不知道内核中的系统调用在哪里实现,则可以使用一系列步骤来找到它。您将需要将内核源下载到计算机上。
首先找到Syscall所需的参数数量。例如。 mount(2)需要五个参数。
由于安装座(2)需要5个参数,因此请搜索
syscall_define5(内核来源中的Mount
:这将需要一段时间才能运行,但最终会发现:
因此,您正在寻找的SYSCALL IS IS位于3026行上的In ./fs/namespace.c(我使用的Linux 4.19.99,因此内核上的线号可能会有所不同。)
If you don't know where a system call is implemented in the kernel, there's a general sequence of steps you can use to find it. You will need to download the kernel source to your machine.
Begin by finding the number of parameters the syscall requires. eg. mount(2) requires five parameters.
Since mount(2) requires 5 parameters, search for
SYSCALL_DEFINE5(mount
in the kernel source:This will take a while to run, but it will eventually find:
So, the syscall you're looking for is located at in ./fs/namespace.c on line 3026. (I'm using Linux 4.19.99, so the line number will probably be different on your kernel.)