find_get_pid 解析
来源:互联网 发布:linux打包解包 编辑:程序博客网 时间:2024/06/06 14:06
http://blog.sina.com.cn/s/blog_821c73630100x1sr.html
注解:
代码:
#include<linux/module.h>#include<linux/pid.h>#include<linux/sched.h>MODULE_LICENSE("GPL");static int __init find_get_pid_init(void);static void __exit find_get_pid_exit(void);int my_function(void *arg){ printk("<0> in the kernel thread function !\n"); return 0;}int __init find_get_pid_init(void){ int result; struct pid * kpid; printk("<0> into find_get_pid init.\n"); result = kernel_thread(my_function,NULL, CLONE_KERNEL); kpid = find_get_pid(result); printk("<0>the count of the pid is : %d\n", (int)(kpid->count.counter)); printk("<0>the level of the pid is : %d\n", kpid->level ); printk("<0>the pid of the find_get_pid is : %d\n",kpid->numbers[kpid->level].nr); printk("<0>the result of the kernel_thread is : %d\n",result); printk("<0>out find_get_pid_init.\n"); return 0;}void __exit find_get_pid_exit(void){ printk("<0> Goodbye find_getpid");}module_init(find_get_pid_init);module_exit(find_get_pid_exit);
结果:
提示:在新进程创建之初,进程描述符字段count的值为1,而函数find_get_pid()执行后,进程描述符字段count变为2
调用关系;
find_get_pid(int ns) | | find_vpid(int ns) | | find_pid_ns(int nr, struct pid_namespace*) | | get_pid() | | atomic_inc()
0 0
- find_get_pid 解析
- 进程管理API之find_get_pid
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析
- 解析[ ]
- 解析
- ffmpeg解析-----解析文件格式
- Xen解析 netfilter解析
- JSON解析,XML解析
- 硬解析 软解析
- 解析xml dom 解析
- hdu 1556 线段树
- c++第五次作业
- 复制带随机指针的链表
- android service,服务的正确姿势
- sharepoint 2013 excel services浏览excel文件 未能下载图表或图像
- find_get_pid 解析
- HDU4161 Iterated Difference
- UVA 11624 Fire!
- MNIST数据集转换为图像
- Nginx在zedboard中的移植
- Linux命令行下常用的快捷键
- 3D touch 初学
- select(poll)系统调用实现解析(一)
- NGUI的UISprite动态染色的一种方法