HP-UX Reference (11i v2 03/08) - 2 System Calls (vol 5)

p
pstat(2) pstat(2)
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
inter-
faces are available only in the wide mode and for applications written in standard C and extended ANSI.
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]
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(),
pstat_getpsem(),orpstat_getnode() calls.
[EINVAL]
index is not a valid logical node id for pstat_getnode() call.
[EINVAL]
elemcount is less than or equal to zero for pstat_getpathname()
call.
[EINVAL] If
pstat_getfiledetails() is called for a socket other than AF_UNIX
family or
pstat_getpathname is called for a socket.
[EINVAL] If
pstat_getsocket() is called for a file which is not of type socket.
[EINVAL] If
pstat_getcommandline() is called with
pid less than zero or elem-
count not equal to one .
[EACCES] If uid!=0 and effective id does not match for calls
pstat_getfiledetails(), pstat_getsocket(),
pstat_getstream(), and pstat_getpathname().
[EOVERFLOW] Offset element is too large to store into the structure pointed to by the
buf argu-
ment.
[EOVERFLOW] For the
pstat_getfiledetails() call, 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.
Section 2244 Hewlett-Packard Company 10 HP-UX 11i Version 2: August 2003