/* *file : test.c *author : davidlin *date : 2014-12-07pm *Email : [email protected] or [email protected] *world : the city of sz, in china *ver : 000.000.001 *history : editor time do &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;*&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;1) linpeng 2014-12-07 created This file! &nBSP;&NBSP;&NBSP;&NBSP;&NBSP;*&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;2) */ #include <linux/init.h> #include <linux/list.h># include <linux/module.h> #include <linux/sched.h>static int list_init (void) { struct task_struct *task; Task = null; for_each_process (Task) { &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;PRINTK ("pid = %d\n", task->pid); } return 0;} Static void list_exit (void) {&NBSP;&NBSP;&NBSP;&NBSP;PRINTK ("kernel macro: for_each_process exit\n ");} Module_init (List_init); Module_exit (List_exit); Module_author ("Linpeng1577"); Module_description ("Kernel 2.6 macro study"); Module_licenes (GPL);
Linux kernel programming: Linux2.6 Kernel Source Parsing _ process traversal