Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include<linux/module.h>
  2. #include<linux/sched/signal.h>
  3. #include<linux/string.h>
  4. static int __init findProcess_init(void)
  5. {
  6. struct task_struct *p;
  7.  
  8. for_each_process(p) {
  9. if(strcmp(p->comm,"a.out")==0)
  10. {
  11. printk(KERN_INFO "Process name is: %s, and its pid is: %i. \n",p->comm, p->pid);
  12. pr_alert("xD");
  13.  
  14. }
  15. }
  16. return 0;
  17. }
  18.  
  19. static void __exit findProcess_exit(void)
  20. {
  21. struct task_struct *p;
  22.  
  23. for_each_process(p) {
  24. if(strcmp(p->comm,"a.out")==0)
  25. {
  26. printk(KERN_INFO "Process name is: %s, and its pid is: %i. \n",p->comm, p->pid);
  27. pr_alert("xD");
  28.  
  29. }
  30. }
  31. printk(KERN_ALERT"findProcess exit\n");
  32. }
  33. module_init(findProcess_init);
  34. module_exit(findProcess_exit);
  35. MODULE_LICENSE("GPL");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement