i used to get a list of processs under linux by enumerating the /proc file system, since it had plain-text files that i can read data from (stat, status, exe link....) but thats not the case on solaris, i tried porting my tools to Oracle Solaris 11 (my first solaris) but it wont work, i tried accessing the /proc folder manually, but couldn't find anything readable, but ps -fu user
works 开发者_StackOverflow中文版!
is it possible that someone can point me on how to get a list of processes uneder solaris? im coding in gcc btw.
thanks.
Unlike Linux, Solaris /proc is providing binary data, not text one.
Solaris has an extensive and detailed manual page proc(4) describing what the different files under a process number hierarchy contain, how to access them and what structures to use in order to get their content.
This manual page is of course also accessible locally with man -s 4 proc
Similar to this: How to get process info programmatically in C/C++ from a Solaris system?
You want the interface described by /usr/include/procfs.h and /usr/include/sys/procfs.h to decode the binary data in /proc
精彩评论