HELP for task struct

Submitted by Anonymous
on January 18, 2006 - 5:30am

Can anybody help me

How to find out task list running currently in system using kernel data structure (output like ps -a command)? ( in c programme)

libproc

on
January 18, 2006 - 8:21am

Have you tried libproc (distributed with procps)? You won't get nearer to the actual data than scanning /proc (whose purpose is exactly this, exporting PROCess data to user space) and libproc does this for you. There may be other libs for this task. The format of /proc is system dependent, so don't access it yourself, if you expect your program to run under Solaris, BSD, MacOSX or similar.

The easiest and probably most portable way is to actually start "ps -a" as a child process and parse the output.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.