Hi,
I am trying to get a the process cpu usage from the /proc file recently, on the Solaris 5.10. But met some rookie issue which i need some help. for below program, compiler complains that pstatus_t is undefined, although both type are defined in the procfs.h.
\#include <sys/procfs.h>
int main\(\)
\{
struct pstatus *pstatus_p;
pstatus_t *pstatus_p2;
\}
Errors as below:
$ cc pstatus.c
"pstatus.c", line 6: undefined symbol: pstatus_t
"pstatus.c", line 6: undefined symbol: pstatus_p
cc: acomp failed for pstatus.c
$ gcc pstatus.c
In file included from /nfs/other/prod_solaris/wh/dtd/sparc-SunOS5/gcc/3.4.3/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.3/include/sys/signal.h:44,
from /usr/include/sys/old_procfs.h:28,
from /usr/include/sys/procfs.h:29,
from pstatus.c:1:
/usr/include/sys/siginfo.h:259: error: parse error before "ctid_t"
/usr/include/sys/siginfo.h:292: error: parse error before '}' token
/usr/include/sys/siginfo.h:294: error: parse error before '}' token
/usr/include/sys/siginfo.h:390: error: parse error before "ctid_t"
/usr/include/sys/siginfo.h:398: error: conflicting types for '__fault'
/usr/include/sys/siginfo.h:267: error: previous declaration of '__fault' was here
/usr/include/sys/siginfo.h:404: error: conflicting types for '__file'
/usr/include/sys/siginfo.h:273: error: previous declaration of '__file' was here
/usr/include/sys/siginfo.h:420: error: conflicting types for '__prof'
/usr/include/sys/siginfo.h:287: error: previous declaration of '__prof' was here
/usr/include/sys/siginfo.h:424: error: conflicting types for '__rctl'
/usr/include/sys/siginfo.h:291: error: previous declaration of '__rctl' was here
/usr/include/sys/siginfo.h:426: error: parse error before '}' token
/usr/include/sys/siginfo.h:428: error: parse error before '}' token
/usr/include/sys/siginfo.h:432: error: parse error before "k_siginfo_t"
/usr/include/sys/siginfo.h:437: error: parse error before '}' token
In file included from /usr/include/sys/old_procfs.h:28,
from /usr/include/sys/procfs.h:29,
from pstatus.c:1:
I can sure that the cc and gcc works fine with other programs. Would you please take a look at this issue and provide your suggestion. Thanks in adv.