linux - Show the list of running processes in C -


can suggest me system call retrieves current running processes? (i have write c function top)

i tried read proc/ folder not in case.

the only way on linux access /proc/ pseudo-file system. remember /proc/ files not "real" files on disk, i/o (i.e. reading /proc/ files) quite fast.

read proc(5) man page.

you use libprocps reading /proc/

the ps , top (and htop etc...) commands using /proc/; if want use them inside program (which may bad idea) use popen(3) (to output) not system(3)

so running processes use readdir on /proc/ , read /proc/*/stat files, remembering status r etc... etc...


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -