pstat.2 (2010 09)

p
pstat(2) pstat(2)
Synopsis
#include <sys/pstat.h>
int pstat_getswap(
struct pst_swapinfo *buf,
size_t elemsize ,
size_t elemcount ,
int index
);
Description
pstat_getswap()
returns information specific to a particular swap area. There is one instance of this
context for each swap area (block or file system) configured into the system. For each instance requested,
up to a maximum of elemsize bytes of data is returned in the
pst_swapinfo structures pointed to by
buf. The elemcount parameter specifies the number of
pst_swapinfo structures that are available at
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(
structpst_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 char-
acters 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
kernel 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 structure, 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.
However, 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
kernel. 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
HP-UX 11i Version 3: September 2010 15 Hewlett-Packard Company 15