HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)

p
pstat(2) pstat(2)
Notes
A wide (64 bit) version of the pstat
interfaces are available for narrow (32 bit) applications to use. A nar-
row application could use the flag
-D_PSTAT64
at compile time to switch to the wide interfaces. Using
this compiler flag in a narrow application is equivalent to using the default interfaces on a wide system.
Refer to the
pstat header file to see how the various structures would look like when the
-D_PSTAT64
flag is used.
The pstat_getlwp , pstat_getcrashinfo
, pstat_getcrashdev
, and pstat_getnode
interfaces are available only in the wide mode and for applications written in standard C and extended
ANSI.
Security Restrictions
Some or all of the actions associated with this system call are subject to compartmental restrictions. This
restriction applies when attempting to get information on message queues, semaphores or processes which
are in a different compartment. See compartments (5) for more information about compartmentalization on
systems that support that feature.
Compartmental restrictions can be overridden if the process possesses the
COMMALLOWED privilege
(PRIV_COMMALLOWED). Processes owned by the superuser may not have this privilege. Processes
owned by any user may have this privilege, depending on system configuration. See privileges(5) for more
information about privileged access on systems that support fine-grained privileges.
RETURN VALUE
Upon successful completion,
pstat() and the various wrapper routines (for example,
pstat_getprocessor()
) return the number of instances filled in at the address buf.
pstat_getcommandline()
, however, returns the number of characters of the process commandline
returned in the
buf parameter. Otherwise, a value of -1 is returned and errno is set to indicate the
error.
ERRORS
The
pstat functions fail if any of the following conditions are encountered:
[EFAULT] buf/fid points to an invalid address.
[ESRCH] Process in question is not found or exiting. For the
pstat_getproc(),
pstat_getprocvm()
, pstat_getlv() , pstat_getsem(),
pstat_getmsg(), pstat_getpset()
, and pstat_getshm() calls,
elemcount was 0, specifying the single-item short-cut, and no item matched
the selection criteria in index (for example, PID for pstat_getproc()
).
[ENOENT] For calls
pstat_getfile()
, pstat_getfile2(),
pstat_getfiledetails()
, pstat_getsocket(),
pstat_getstream()
, pstat_getpathname() [ENOENT] is returned if
the file is not found, or it is closed. For
pstat_getmpathname()
call,
[ENOENT] is returned if the specified file system is not found or if the file sys-
tem does not have DNLC entries.
[EINVAL] For the
pstat_getproc()
, pstat_getprocvm(), pstat_getlv()
,
pstat_getsem(), pstat_getmsg(), pstat_getshm()
,
pstat_getpset(), pstat_getfile(),orpstat_getfile2()
calls,
elemcount was not zero, and index was less than zero.
[EINVAL] elemsize is less than or equal to zero or elemsize is larger than the size of
the associated data structure (for example, elemsize>sizeof(struct
pst_processor
) for the pstat_getprocessor() call).
[EINVAL] elemsize is less than or equal to zero or elemsize is larger than the size of
the associated data structure (for example, elemsize>sizeof(struct
pst_stream
) for the pstat_getstream() call).
[EINVAL] elemcount is not 1 or index is not zero for the pstat_getstatic()
,
pstat_getdynamic(), pstat_getvminfo()
, pstat_getipc(),
pstat_getstable(),orpstat_getcrashinfo() calls.
[EINVAL] elemcount is not greater than or equal to 1 or index is not greater than or
equal to zero for the pstat_getprocessor(), pstat_getdisk(),
pstat_getswap(), pstat_getcrashdev(), pstat_getpmq(),
HP-UX 11i Version 2: December 2007 Update 10 Hewlett-Packard Company 283