Including sys/procfs.h
was done by older code using the ioctl-based proc interface. Not to break these programs, the psinfo
structure is currently kept undefined by default.
As you want to use the new interface, the simpler way to overcome this issue is to use this include statement:
#include <procfs.h>
which is documented in /usr/include/sys/procfs.h
:
/*
* This definition is temporary. Structured proc is the preferred API,
* and the older ioctl-based interface will be removed in a future version
* of Solaris. Until then, by default, including <sys/procfs.h> will
* provide the older ioctl-based /proc definitions. To get the structured
* /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
* to be 1 before including <sys/procfs.h>.
*/
Of course, predefining _STRUCTURED_PROC
to 1
like documented too will also work as you experienced.