PSTAT Interfaces

7
}
for (i = 0; i < count; i++) {
printf("\n Disk hardware path = %s",
pst[i].psd_hw_path.psh_name);
}
}
4.4 pstat_getdynamic()
Synopsis:
int pstat_getdynamic(struct pst_dynamic *buf, size_t elemsize, size_t elemcount, int index);
Description:
This call returns dynamic system variables, ones that may change frequently during
normal operation of the kernel. This includes such information, as the number of jobs in disk
wait, free memory pages, open logical volumes, etc. There is only one instance of this context.
Data up to a maximum of elemsize bytes are returned in the struct pst_dynamic pointed to by
buf. The elemcount parameter must be 1. The index parameter must be 0.
Return Value:
This call returns –1 on failure or 1 on success.
Errors:
EINVAL is set if elemcount is not equal to 1 or index is not equal to 0.
EINVAL is set if user’s size declaration is not valid.
EFAULT is set if buf is invalid.
Example:
#include <sys/pstat.h>
void main(void)
{
struct pst_dynamic pst;
int count;
/* Get information about the system dynamic variables */
count = pstat_getdynamic(&pst, sizeof(pst), 1, 0);
if (count == 1) {
printf("\n Active processors: %d, DNLC size: %d",
pst.psd_proc_cnt, pst.psd_dnlc_size);
} else {
perror("pstat_getdynamic()");
}
}
4.5 pstat_getfile() OBSOLETE
Synopsis:
int pstat_getfile(struct pst_fileinfo *buf, size_t elemsize, size_t elemcount, int index);
Description:
This call is now obsolete and is provided for backward compatibility. Use of the
pstat_getfile2() call is recommended. This call returns information about open files for a
specified process. For the specified process, there is one instance of this context for each open
file descriptor. For each instance, data up to a maximum of elemsize bytes are returned in the
structs pst_fileinfo pointed to by buf. The elemcount parameter specifies the number of structs
pst_fileinfo that are available at buf. The index parameter specifies the starting index within the