Find the answer to your Linux question:
Results 1 to 2 of 2
Hello everyone, I needed to access a process information through a program. I know I can use the information give in /proc/[pid]/ but I was trying to go for the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    27

    Question Unable to find task_struct{} structure in /usr/include/linux/sched.h


    Hello everyone,

    I needed to access a process information through a program. I know I can use the information give in /proc/[pid]/ but I was trying to go for the other option, by using task_struct structure. All the programs or examples that I have found by searching just include the file <linux/sched.h> but that file doesn't seem to contain any such declaration.

    Apparently, the same header file contains the structure (and is a lot bigger too) in the src code /usr/src/linux-<kernel version>/include/linux/sched.h

    Could anyone tell me why this difference? And how should I use it? Compiling the code after including it throws tremendous amount of errors, because of the included <linux/*> header files in it.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    11,159
    The stuff in /usr/include/linux will be for user-space programs only, so you won't find stuff like the task_struct structure, etc. there. These constructs are only in the kernel headers which is why you find them in /usr/src/linux..../include/linux, which is where the kernel headers will be found that are necessary for writing kernel modules, drivers, etc.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •