STEP 1: Add a field named can_pick in task_struct. Now we want to export it to user space by proc file system.
struct task_struct{
...
int can_pick;
...
}
|
STEP 2: change to kernel source tree, in fs/proc/base.c, add following code at proper line.
2633 INF("can_pick", S_IRUGO, proc_pid_can_pick),
|
and,
367 static int proc_pid_src_cpu(struct task_struct *task, char *buffer)
368 {
369 return sprintf(buffer,"%d\n",task->src_cpu);
370 }
|
STEP 3: compile kernel. cat /proc/xxx/can_pick.
阅读(782) | 评论(1) | 转发(0) |