亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 1522 | 回復(fù): 1
打印 上一主題 下一主題

[內(nèi)核入門(mén)] kernel space module pid [復(fù)制鏈接]

論壇徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:49:03
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2016-03-18 21:37 |只看該作者 |倒序?yàn)g覽
本帖最后由 shihyu 于 2016-03-18 21:38 編輯
  1. #include <linux/kernel.h>
  2. #include <linux/init.h>
  3. #include <linux/module.h>
  4. #include <linux/version.h>
  5. #include <linux/kthread.h>

  6. MODULE_DESCRIPTION("Hello World !!");
  7. MODULE_AUTHOR("Bo-Yi Wu");
  8. MODULE_LICENSE("GPL");

  9. static int __init hello_init(void)
  10. {
  11.     printk(KERN_INFO "Hello, world\n");
  12.     printk(KERN_INFO "The process is \"%s\" (pid %i)\n", current->comm, current->pid);
  13.     return 0;
  14. }

  15. static void __exit hello_exit(void)
  16. {
  17.     printk(KERN_INFO " Goodbye The process is \"%s\" (pid %i)\n", current->comm, current->pid);
  18. }

  19. module_init(hello_init);
  20. module_exit(hello_exit);
復(fù)制代碼
insmod hello.ko
rmmod hello.ko

  1. [ 1815.161400] Hello, world
  2. [ 1815.162181] The process is "insmod" (pid 3180)
  3. [ 1820.855711]  Goodbye The process is "rmmod" (pid 3182)
復(fù)制代碼
為什么 hello_init  跟 hello_exit 的 kernel 的 pid 不同?

3180 跑完  hello_init 函數(shù)就死掉?

我用 ps | grep '3180' 找不到 , 還是  ps 無(wú)法查到 kernel pid ?


謝謝

論壇徽章:
2
寅虎
日期:2014-11-25 21:47:342015小元宵徽章
日期:2015-03-06 15:58:18
2 [報(bào)告]
發(fā)表于 2016-03-18 22:12 |只看該作者
為什么 hello_init  跟 hello_exit 的 kernel 的 pid 不同?
因?yàn)槟阋粋(gè)是insmod,一個(gè)是rmmod,pid當(dāng)然不同啦。
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP