PSTAT Interfaces

6
EINVAL is set if the user is in narrow more.
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_crashinfo pst;
int count;
/* Get information about the first crash dump configuration. */
count = pstat_getcrashinfo(&pst, sizeof(pst), 1, 0);
if (count > 0) {
printf(“\nSize of total dump area: %d”, pst.psc_totalsize);
} else {
perror("pstat_getcrashinfo()");
}
}
4.3 pstat_getdisk()
Synopsis:
int pstat_getdisk(struct pst_diskinfo *buf, size_t elemsize, size_t elemcount, int index);
Description:
This call returns information about disks configured in the system. There is one instance
of this context for each disk configured. For each instance, data up to a maximum of elemsize
bytes are returned in the structs pst_diskinfo pointed to by buf. The elemcount parameter
specifies the number of structs pst_diskinfo that are available at buf. The index parameter
specifies the starting index within the context of disks.
Return Value:
This call returns –1 on failure or number of instances copied to buf on success.
Errors:
EINVAL is set if elemcount is not greater than or equal to 1 or index is not greater than or
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_diskinfo pst[10];
int i, count;
/* Get information about disks configured in the system. */
count = pstat_getdisk(pst, sizeof(struct pst_diskinfo),
sizeof(pst) / sizeof(struct pst_diskinfo), 0);
if (count < 0) {
perror("pstat_getdisk()");
return;