I was wondering if anyone could tell me how to include linux source headers into a C program. Right now the header files for my linux version are stored in /usr/src/linux-headers-2.6.28-15/include, but I've noticed that many sites have said they were located in /usr/src/linux or /usr/include/linux but I don't have a /usr/src/linux directory.
Paticularly, I was trying to find the task_struct definition which is supposedly located in sched.h. One site told me it was in /usr/include/linux which it was, however it didn't contain the definition of task_struct. Another site told me it was in /usr/src/linux but I had no such directory so I looked in /usr/src/linux-headers-2.6.28-15/include and there was another sched.h that contained the definition of task_struct. However, the site contained some code snippets that included the sched.h file in this manner
#include <linux/sched.h>
However, when I do this, it points me to the sched.h in my /usr/include directory which doesn't contain the task_struct definition. So am I suppose to include it like this?
#include </usr/src/linux-header-2.6.28-15/include>
Or am I suppose to make a symbolic link from /usr/src/linux to usr/src/linux-header-2.6.28-15/include? Or do I copy the headers from usr/src/linux-header-2.6.28-15/include to /usr/include/linux? I don't know, I'm confused, and if someone could clarify I would appreciate it.
By the way the site I was looking at was this one: Learning about Linux Processes LG #133
If you look at the 7th code listing, they include the header as linux/sched.h