PSTAT Interfaces
27
This call returns information about the virtual memory. There is only one instance of this
context. Data up to a maximum of elemsize bytes are returned in the struct pst_vminfo pointed
to by buf. The elemcount parameter must be 1. The index parameter must be 0.
Return Value:
On success, the call returns 1. On failure, value of -1 is returned and errno is set
indicating the cause of the failure.
Errors:
• EINVAL is set if elemcount is not 1 or index is not 0.
• EINVAL is set if the user's size declaration isn't valid.
• EFAULT is set if buf points to an invalid address.
Example:
#include <sys/pstat.h>
void main(void)
{
struct pst_vminfo pst;
int count;
count = pstat_getvminfo(&pst, sizeof(pst), 1, 0);
if (count == 1) {
printf("\n Rate of faults: %d\n", pst.psv_rfaults);
} else {
perror("pstat_getvminfo()");
}
}
5. Binary Compatibility
This section describes pstat wrappers’ commitment to software compatibility, in terms of
currently supported and future versions of HP-UX. The specific calling convention of passing the
expected data structure size is used in order to allow for future expansion of the interface, while
preserving source and binary compatibility for programs written using the pstat interfaces. Three
rules are followed to allow existing applications to continue to execute from release to release of
the operating system.
1. New data for a context are added to the end of that context's data structure.
2. Old, obsolete data members are not deleted from the data structure.
3. The operating system honors the elemsize parameter of the call and only returns the first
elemsize bytes of the context data, even if the actual data structure has since been enlarged.
In this way, an application which passes its compile-time size of the context's data structure
(for example, sizeof(struct pst_processor) for the per-processor context) as the elemsize
parameter will continue to execute on future operating system releases without recompilation,
even those that have larger context data structures. If the program is recompiled, it will continue
to execute on that and future releases. Note that the reverse is not true: a program using the pstat
interfaces compiled on, say, HP-UX release 10.0 will not work on HP-UX release 9.0.