Operating system 其中系统调用函数“;sys_getpid”;是否位于linux内核中?
我正在内核中搜索“getpid”函数,但是找不到实际的函数 应该是这样的:Operating system 其中系统调用函数“;sys_getpid”;是否位于linux内核中?,operating-system,linux-kernel,kernel,Operating System,Linux Kernel,Kernel,我正在内核中搜索“getpid”函数,但是找不到实际的函数 应该是这样的: asmlinkage long sys_getpid(void) { return current-> tgetid; } 我能找到的只是系统调用表,而不是这个系统调用的实际实现 内核版本为:3.0.20 提前感谢。实际定义在kernel/timer.c中: /** * sys_getpid - return the thread group id of the current process * * No
asmlinkage long sys_getpid(void)
{
return current-> tgetid;
}
我能找到的只是系统调用表,而不是这个系统调用的实际实现
内核版本为:3.0.20
提前感谢。实际定义在
kernel/timer.c
中:
/**
* sys_getpid - return the thread group id of the current process
*
* Note, despite the name, this returns the tgid not the pid. The tgid and
* the pid are identical unless CLONE_THREAD was specified on clone() in
* which case the tgid is the same in all threads of the same group.
*
* This is SMP safe as current->tgid does not change.
*/
SYSCALL_DEFINE0(getpid)
{
return task_tgid_vnr(current);
}
task\u tgid\u vnr
是include/linux/sched.h
中的一个静态内联文件,很抱歉,我仍然无法找到此文件。在不同的目录(arch)中有很多timer.c。我需要看哪一个?kernel\u source\u dir/kernel/timer.c
,如上所述。kernel 3.0.20中kernel\u source\u dir的根目录中没有这样的目录。我还有2.6.32.56,我可以在你说的目录中看到这个timer.c文件,但是我在3.0.20的根目录中也找不到这样一个名为kernel的目录。至少在以下版本中有这样一个目录:linux-3.0.3-gentoo/kernel/timer.c linux-3.1.0-gentoo/kernel/timer.c linux-3.1.4-gentoo/kernel/timer.c linux-3.5-gentoo/kernel/timer.c linux-3.1.6-gentoo/kernel/timer.c linux-3.2.1-gentoo/kernel/timer.clinux-3.2.5-gentoo/kernel/timer.c——我相信它也出现在所有2.6版本中。请确保您有完整的内核源代码提取。您也可以在网上看到源代码,例如:谢谢Mat,我认为我的内核缺少一些目录。