pstat.2 (2010 09)

p
pstat(2) pstat(2)
[ENOBUFS] For
pstat_getsocket()
, the operation was terminated due to unavailability of buffer
space.
[ENOENT] For
pstat_getfile2()
, pstat_getfiledetails()
, pstat_getpathname()
,
pstat_getsocket()
,orpstat_getstream()
, the file was not found, or it was
closed.
For
pstat_getmpathname()
, the specified file system was not found or the file sys-
tem did not have DNLC entries.
[ENOSTR]
pstat_getstream()
was called for a le that is neither a stream nor a stream-based
pipe or socket.
[ENOSYS] The requested pstat function is not implemented or not configured in the system.
[EOVERFLOW]
The offset element is too large to store into the structure pointed to by the buf parameter.
[EOVERFLOW]
For
pstat_getfiledetails()
, a value to be stored would overflow one of the
members of the
pst_filedetails
structure. The psfd_valid member indicates
the field that overflowed.
[EOVERFLOW]
For
pstat_getpathname()
, the elemcount parameter is not 1 greater than the length
of the path name to be returned.
[ESRCH] The process in question was not found or was exiting. For
pstat_getlv()
,
pstat_getmsg(), pstat_getproc()
, pstat_getprocvm(),
pstat_getpset(), pstat_getsem()
,orpstat_getshm(), elemcount was 0,
specifying the single-item short-cut, and no item matched the selection criteria in index .
For example,
PID for pstat_getproc()
.
EXAMPLES
All of these examples are compiled with the
_PSTAT64 flag. All examples have the following prolog.
The define of _PSTAT64 is placed before the inclusion of the <sys/pstat.h>
header so that it takes
effect in that file.
#ifndef _PSTAT64
#define _PSTAT64
#endif
#include <sys/pstat.h>
#include <sys/unistd.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
Example 1
Get global information from
pstat_getstatic().
main()
{
struct pst_static pst;
(void)memset(&pst,0,sizeof(struct pst_static));
if (pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0) == 1)
(void)printf("page size is %lld bytes\n", pst.page_size);
else
perror("pstat_getstatic");
}
Example 2
Get information about all processors, first obtaining number of processor context instances.
main()
{
HP-UX 11i Version 3: September 2010 17 Hewlett-Packard Company 17