From f2333122a9df3eabfc4726054516232128b455a6 Mon Sep 17 00:00:00 2001 From: gatieme Date: Thu, 12 May 2016 00:38:24 +0800 Subject: [PATCH] ... --- .../{ => data_structure}/kfifo/.test.ko.cmd | 0 .../kfifo/.test.mod.o.cmd | 0 .../{ => data_structure}/kfifo/.test.o.cmd | 0 .../kfifo/.tmp_versions/test.mod | 0 .../{ => data_structure}/kfifo/Makefile | 0 .../{ => data_structure}/kfifo/Module.symvers | 0 .../kernel/{ => data_structure}/kfifo/kfifo.c | 0 .../{ => data_structure}/kfifo/kfifo_test.c | 0 .../{ => data_structure}/kfifo/modules.order | 0 .../kernel/{ => data_structure}/kfifo/test.c | 0 .../{ => data_structure}/kfifo/test.mod.c | 0 study/kernel/process/task/Makefile | 2 +- study/kernel/process/task/find/find_task.c.1 | 104 ------------------ .../process/task/{find => find_task}/Makefile | 0 .../task/{find => find_task}/find_task.c | 6 +- .../task/{list => list_process}/Makefile | 0 .../{list => list_process}/list_process.c | 0 17 files changed, 4 insertions(+), 108 deletions(-) rename study/kernel/{ => data_structure}/kfifo/.test.ko.cmd (100%) rename study/kernel/{ => data_structure}/kfifo/.test.mod.o.cmd (100%) rename study/kernel/{ => data_structure}/kfifo/.test.o.cmd (100%) rename study/kernel/{ => data_structure}/kfifo/.tmp_versions/test.mod (100%) rename study/kernel/{ => data_structure}/kfifo/Makefile (100%) rename study/kernel/{ => data_structure}/kfifo/Module.symvers (100%) rename study/kernel/{ => data_structure}/kfifo/kfifo.c (100%) rename study/kernel/{ => data_structure}/kfifo/kfifo_test.c (100%) rename study/kernel/{ => data_structure}/kfifo/modules.order (100%) rename study/kernel/{ => data_structure}/kfifo/test.c (100%) rename study/kernel/{ => data_structure}/kfifo/test.mod.c (100%) delete mode 100644 study/kernel/process/task/find/find_task.c.1 rename study/kernel/process/task/{find => find_task}/Makefile (100%) rename study/kernel/process/task/{find => find_task}/find_task.c (97%) rename study/kernel/process/task/{list => list_process}/Makefile (100%) rename study/kernel/process/task/{list => list_process}/list_process.c (100%) diff --git a/study/kernel/kfifo/.test.ko.cmd b/study/kernel/data_structure/kfifo/.test.ko.cmd similarity index 100% rename from study/kernel/kfifo/.test.ko.cmd rename to study/kernel/data_structure/kfifo/.test.ko.cmd diff --git a/study/kernel/kfifo/.test.mod.o.cmd b/study/kernel/data_structure/kfifo/.test.mod.o.cmd similarity index 100% rename from study/kernel/kfifo/.test.mod.o.cmd rename to study/kernel/data_structure/kfifo/.test.mod.o.cmd diff --git a/study/kernel/kfifo/.test.o.cmd b/study/kernel/data_structure/kfifo/.test.o.cmd similarity index 100% rename from study/kernel/kfifo/.test.o.cmd rename to study/kernel/data_structure/kfifo/.test.o.cmd diff --git a/study/kernel/kfifo/.tmp_versions/test.mod b/study/kernel/data_structure/kfifo/.tmp_versions/test.mod similarity index 100% rename from study/kernel/kfifo/.tmp_versions/test.mod rename to study/kernel/data_structure/kfifo/.tmp_versions/test.mod diff --git a/study/kernel/kfifo/Makefile b/study/kernel/data_structure/kfifo/Makefile similarity index 100% rename from study/kernel/kfifo/Makefile rename to study/kernel/data_structure/kfifo/Makefile diff --git a/study/kernel/kfifo/Module.symvers b/study/kernel/data_structure/kfifo/Module.symvers similarity index 100% rename from study/kernel/kfifo/Module.symvers rename to study/kernel/data_structure/kfifo/Module.symvers diff --git a/study/kernel/kfifo/kfifo.c b/study/kernel/data_structure/kfifo/kfifo.c similarity index 100% rename from study/kernel/kfifo/kfifo.c rename to study/kernel/data_structure/kfifo/kfifo.c diff --git a/study/kernel/kfifo/kfifo_test.c b/study/kernel/data_structure/kfifo/kfifo_test.c similarity index 100% rename from study/kernel/kfifo/kfifo_test.c rename to study/kernel/data_structure/kfifo/kfifo_test.c diff --git a/study/kernel/kfifo/modules.order b/study/kernel/data_structure/kfifo/modules.order similarity index 100% rename from study/kernel/kfifo/modules.order rename to study/kernel/data_structure/kfifo/modules.order diff --git a/study/kernel/kfifo/test.c b/study/kernel/data_structure/kfifo/test.c similarity index 100% rename from study/kernel/kfifo/test.c rename to study/kernel/data_structure/kfifo/test.c diff --git a/study/kernel/kfifo/test.mod.c b/study/kernel/data_structure/kfifo/test.mod.c similarity index 100% rename from study/kernel/kfifo/test.mod.c rename to study/kernel/data_structure/kfifo/test.mod.c diff --git a/study/kernel/process/task/Makefile b/study/kernel/process/task/Makefile index d82bf8c..f6eb2f6 100644 --- a/study/kernel/process/task/Makefile +++ b/study/kernel/process/task/Makefile @@ -1,6 +1,6 @@ ROOT=$(shell pwd) -DIRS=list find +DIRS=list_process find_task all: diff --git a/study/kernel/process/task/find/find_task.c.1 b/study/kernel/process/task/find/find_task.c.1 deleted file mode 100644 index 6de53bc..0000000 --- a/study/kernel/process/task/find/find_task.c.1 +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - > File Name: process.c - > Author: GatieMe - > Mail: gatieme@163.com - > Created Time: 2016年04月01日 星期五 21时09分29秒 - ************************************************************************/ - - - -#include -#include -#include - -#include - - -/* -* find_task_by_pid maybe not supported -* O(n) is fine :) -*/ -struct task_struct * findTaskByPid(pid_t pid) -{ - struct task_struct *task = NULL; - - return NULL; -} - -/* - * show the task info - */ -void getTaskinfo(struct task_struct *task) -{ - -} - -//#define METHOD 2 -static unsigned int METHOD = 1; -module_param(METHOD, uint,0400); - -static unsigned int PID = 1; -module_param(PID, uint,0400); -static int find_task_init(void) -{ - struct task_struct *task = NULL, *pTask = NULL; - struct list_head *pos = NULL; - char *method = NULL; - - task = &init_task; - - printk(KERN_ALERT"PID\tCOMM\tADDR\n"); - - - switch(METHOD) - { - case 1 : - method = "list_for_each"; - list_for_each(pos, &task->tasks) - { - pTask = list_entry(pos, struct task_struct, tasks ); - if(pTask->pid == (pid_t)PID) - { - printk(KERN_ALERT "%d\t%s\t%p\n", pTask->pid, pTask->comm, pTask); - break; - } - } - - break; - case 2 : - method = "for_each_process"; - for_each_process(task) - { - if(task->pid == PID) - { - printk(KERN_ALERT "%d\t%s\t%p\n", task->pid, task->comm, task); - break; - } - } - break; - case 3 : - method = "list_for_each_entry"; - list_for_each_entry(pTask, &task->tasks, tasks) - { - if(pTask->pid == PID) - { - printk(KERN_ALERT "%d\t%s\t%p\n", pTask->pid, pTask->comm, pTask); - } - } - } - printk("the method is %s", method); - return 0; -} - -static void find_task_exit(void) -{ - printk(KERN_ALERT "GOOD BYE:find_task!!\n"); -} - - - -module_init(find_task_init); -module_exit(find_task_exit); - -MODULE_AUTHOR("gatieme"); -MODULE_LICENSE("GPL"); diff --git a/study/kernel/process/task/find/Makefile b/study/kernel/process/task/find_task/Makefile similarity index 100% rename from study/kernel/process/task/find/Makefile rename to study/kernel/process/task/find_task/Makefile diff --git a/study/kernel/process/task/find/find_task.c b/study/kernel/process/task/find_task/find_task.c similarity index 97% rename from study/kernel/process/task/find/find_task.c rename to study/kernel/process/task/find_task/find_task.c index 20de012..4e6bfd5 100644 --- a/study/kernel/process/task/find/find_task.c +++ b/study/kernel/process/task/find_task/find_task.c @@ -84,12 +84,12 @@ void findTaskByPid(int pid) } } printk("the method is %s", method); - return 0; } static int init_find_task(void) { - + findTaskByPid(PID); + return 0; } static void exit_find_task(void) @@ -99,7 +99,7 @@ static void exit_find_task(void) -module_init(init_find_taskt); +module_init(init_find_task); module_exit(exit_find_task); MODULE_AUTHOR("gatieme"); diff --git a/study/kernel/process/task/list/Makefile b/study/kernel/process/task/list_process/Makefile similarity index 100% rename from study/kernel/process/task/list/Makefile rename to study/kernel/process/task/list_process/Makefile diff --git a/study/kernel/process/task/list/list_process.c b/study/kernel/process/task/list_process/list_process.c similarity index 100% rename from study/kernel/process/task/list/list_process.c rename to study/kernel/process/task/list_process/list_process.c