提取task_struct属性

时间:2016-04-01 08:21:45

标签: struct process kernel-module stat

我正在尝试构建一个可以提取task_struct属性的内核模块。我尝试了task_struct成员here和统计成员here。但是,当我使用make命令创建模块时,我得到了大多数成员的错误,

‘struct task_struct’ has no member named ‘priority’

这是我如何做到的:

printk(KERN_INFO " process Information:\ncomm: %s \npid: %d \nppid: %d \nstate: %c \nprio: %d \nnice: %ld \npgrp: %d \nutime: %ld \npriority: %d \nprocessor: %d\nvsize: %lu \nrss: %lu \ntext (code): %ld\n", 
                pTask->comm, pTask->pid, pTask->pptr->ppid, pTask->state, pTask->prio, pTask->nice, task_pgrp_vnr(pTask), pTask->utime, pTask->priority, pTask->processor, pTask->Vsize, pTask->rss, pTask->text);

以下是我的代码中包含的库:

#include <linux/module.h> 
#include <linux/kernel.h> 
#include <linux/init.h> 
#include <linux/list.h>     
#include <linux/sched.h> 
#include <linux/cred.h>     
#include <linux/pid.h>

提示?从哪里可以得到这些成员?我需要包含哪些库?

0 个答案:

没有答案