Linux – Where is the struct task_struct definition in the 2.6.30.5 Linux Kernel

linuxlinux-kernel

In the version 2.6.15 kernel, I got that I can rewrite the task_struct in the file (include/linux/sched.h),like:

struct task_struct {  
    unsigned did_exec:1;  
    pid_t pid;  
    pid_t tgid;  
    ...
    char hide;
}  

But, unfortunately, when I upgraded to the version 2.6.30.5, I looked through the same file, I just find a declaration of the task_struct, like:

struct task_struct;

And I have no idea which file I should refer to for the purpose of specifying my own task_struct? Can someone help me?

Best Answer

Use grep or any other search tool to look for the definition:

grep -r '^struct task_struct ' include

Or search online at LXR: http://lxr.linux.no/linux+v2.6.30.5/+search?search=task_struct

The structure is still defined in include/linux/sched.h. There's a forward declaration which is used in mutually recursive type definitions, and the definition is further down.

Related Question