Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<linux/module.h>
- #include<linux/sched/signal.h>
- #include<linux/string.h>
- static int __init findProcess_init(void)
- {
- struct task_struct *p;
- for_each_process(p) {
- if(strcmp(p->comm,"a.out")==0)
- {
- printk(KERN_INFO "Process name is: %s, and its pid is: %i. \n",p->comm, p->pid);
- pr_alert("xD");
- }
- }
- return 0;
- }
- static void __exit findProcess_exit(void)
- {
- struct task_struct *p;
- for_each_process(p) {
- if(strcmp(p->comm,"a.out")==0)
- {
- printk(KERN_INFO "Process name is: %s, and its pid is: %i. \n",p->comm, p->pid);
- pr_alert("xD");
- }
- }
- printk(KERN_ALERT"findProcess exit\n");
- }
- module_init(findProcess_init);
- module_exit(findProcess_exit);
- MODULE_LICENSE("GPL");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement