正在加载图片...
用户如何获得一个进程的pid o getpid,getppid -get process identification (注意:返回tgid) 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. asmlinkage long sys_getpid(void)( return task_tgid_vnr(current); / asmlinkage long sys_getppid(void){ pid task_tgid_vnr(current->real_parent); +。+ 东香兰(xlanchenoustc,ed.cm)(计异丸应 L1nux操作系统分标Chapter 0注在管理 Decenber 23.2014 10/95. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 用户如何获得一个进程的pid getpid, getppid - get process identification (注意:返回tgid) . 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. */ asmlinkage long sys_getpid(void) { return task_tgid_vnr(current); }/ ... asmlinkage long sys_getppid(void) { ... pid = task_tgid_vnr(current->real_parent); ... } 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室 Linux操作系统分析Chapter 9 进程管理 @计算机学院嵌入式系统实验室@苏州研究院中国科学技术大学Fall 2014) December 23, 2014 10 / 95
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有