HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)
p
pstat(2) pstat(2)
buf to be filled in. The index parameter specifies the starting index within the context of swap areas.
PSTAT FUNCTION
Name
pstat_getvminfo()
- get information about the virtual memory subsystem
Synopsis
#include <sys/pstat.h>
int pstat_getvminfo(
struc
tpst_vminfo * buf ,
size_t elemsize,
size_t
elemcount,
int
index
);
Description
pstat_getvminfo()
returns information about the virtual memory subsystem. There is one global
instance of this context. Up to a maximum of elemsize bytes of data is returned in the
pst_vminfo
structure pointed to by buf. The elemcount parameter must be 1. The index parameter must be
0.
RETURN VALUE
Upon successful completion, the various pstat functions (for example,
pstat_getprocessor()
)return
the number of instances, which could be 0, filled in at the address provided by the user.
pstat_getcommandline()
, however, returns the number of characters of the process command line
returned at the address provided by the user and
pstat_getpath
name() returns the number of charac-
ters of the file path name returned at the address provided by the user. Otherwise, a value of
-1 is
returned and
errno is set to indicate the error.
EOVERFLOW Error
It is possible for a given field of a pstat structure to be too narrow to contain correctly the data that the ker-
nel is instructed to provide. For example, over time, the growth of physical memory on the system may
become too large to be contained in the pstat field that reports it. For this purpose, a pstat data structure
may contain fields whose purpose it is to indicate whether other fields in that data structure contain valid
data; there may be associated macros for use in interpreting those fields. Within a given pstat data struc-
ture, each such field is known as a validity vector for that structure, and each such macro is known as a
validity macro associated with that data structure.
If the call completes successfully, the validity vectors of the structures returned need not be checked. How-
ever, if a call returns an error with [EOVERFLOW] set, the last structure returned as a result of the call
contains at least one data item that exceeded the value that can be stored in the corresponding field. This
structure may still contain some fields with valid data. All preceding structures were filled in by the ker-
nel. Since the number of structures returned by the kernel is not directly available to the application in
this case, the application must infer how many structures the kernel has filled in, by the following method.
To determine which structure resulted in the error return with [EOVERFLOW] set, the application
must examine pstat structures sequentially, beginning with the first such structure requested from
the kernel. The pstat structure that has at least one validity vector not equal to -1 is the structure
that caused the error return with [EOVERFLOW] set and is the last structure filled in by the kernel
for this pstat call.
For those pstat functions that return at most only one structure, such as pstat_getdynamic(),
an error return with [EOVERFLOW] set means that the only structure requested is the structure that
caused the error return with [EOVERFLOW].
Once the structure that caused the error return with [EOVERFLOW] has been determined, the particular
fields of that structure that do not contain valid data can be determined as follows. Please note that all
preceding structures were filled in by the kernel, and fields from those structures need not be checked in
this manner.
Such fields can be determined using the validity macros explicitly defined for the corresponding
pst_* data structure and the corresponding validity vector for that particular structure. These vali-
dity macros correspond to one specific field within the given pst_* data structure. If the bitwise
AND of a particular validity macro with its corresponding validity vector evaluates to 0, the field
corresponding to that validity macro does not contain valid data. Otherwise, that field contains valid
HP-UX 11i Version 3: February 2007 − 15 − Hewlett-Packard Company 305