在2.6.15版本的内核中,我可以在文件(include/linux/ task_struct /h)中重写,如下所示:
struct task_struct {
unsigned did_exec:1;
pid_t pid;
pid_t tgid;
...
char hide;
} 但是,不幸的是,当我升级到2.6.30.5版本时,我查看了同一个文件,只找到了task_struct的一个声明,比如:
struct task_struct;我不知道我应该引用哪个文件来指定我自己的task_struct?有人能帮我吗?
发布于 2012-01-30 23:34:32
使用grep或任何其他搜索工具查找定义:
grep -r '^struct task_struct ' include或在LXR:http://lxr.linux.no/linux+v2.6.30.5/+search?search=task_结构在线搜索
该结构仍在include/linux/sched.h中定义。在相互递归类型定义中使用的是一个前向申报,而定义则进一步下降。
发布于 2012-01-30 04:18:05
我在用Debian挤压。在/usr/src/linux-headers-2.6.32-5-common-vserver/include/linux/sched.h中,我在对应于当前内核的头中看到了一个定义。定义以
struct task_struct {
volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
void *stack;
atomic_t usage;
unsigned int flags; /* per process flags, defined below */
unsigned int ptrace;
int lock_depth; /* BKL lock depth */HTH。
https://unix.stackexchange.com/questions/30356
复制相似问题