HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)

p
pstat(2) pstat(2)
size_t elemsize,
size_t
elemcount,
int
index,
pid_t
pid
);
Description
pstat_getfile2()
returns information specific to a particular open file for a specified process. For the
specified process, there is one instance of this context for each open file descriptor. For each instance
requested, up to a maximum of elemsize bytes of data is returned in the
pst_fileinfo2
structures
pointed to by buf. The elemcount parameter specifies the number of
pst_fileinfo2
structures that are
available at buf to be filled in. The index parameter specifies the starting index within the context of open
files for the specified process: It is the file descriptor number with which to begin. The pid parameter
specifies the process ID.
As a shortcut, information for a single file within the specified process can be obtained by setting elemcount
to
0 and setting the index to the file descriptor number.
The
pst_fileinfo2 structure contains both a
psf_offset and psf_offset64 element. The
psf_offset element can correctly store a 32-bit value, whereas the psf_offset64 element can store
a 64-bit value. pstat_getfile2()
will fill in both psf_offset and psf_offset64 if the value
can be correctly stored in both elements. If the offset is too large to be correctly stored in
psf_offset ,
then
psf_offset will contain a -1. No error will be set in this case.
PSTAT FUNCTION
Name
pstat_getfiledetails()
- get detailed information for an open file
Synopsis
#include <sys/pstat.h>
int pstat_getfiledetails(
struct pst_filedetails *
buf,
size_t
elemsize,
struct pst_fid *
fid
);
Description
pstat_getfiledetails()
returns detailed information specific to a particular open file. For a
specified open file, there is only one instance of this context. For each call, up to a maximum of elemsize
bytes of data is returned in the
pst_filedetails
structure pointed to by buf. The fid parameter
uniquely identifies the file. This fid is obtained from calls to
pstat_getfile2()
,
pstat_getproc() or
pstat_getprocvm(). The pst_filedetails
structure contains informa-
tion equivalent to the stat(2) call. The use of this function is limited to UID 0 or an effective UID match.
An effective UID match occurs when the effective or real UID of the calling thread matches the effective or
real UID of the target process and the target process has not done a setuid or a setgid.
The structure members
psfd_mode, psfd_ino, psfd_dev, psfd_uid, psfd_gid, psfd_atime ,
psfd_mtime , psfd_ctime will have meaningful values for regular files, character or block special files,
and pipes. The value of the member psfd_nlink will be set to number of links to the file. The member
psfd_rdev will have meaningful value for character or block special files, while the psfd_size is valid
for regular files. The members psfd_hi_fileid, psfd_lo_fileid
, psfd_hi_nodeid, and
psfd_lo_nodeid are unique IDs representing the open file. These IDs together are used to match the
corresponding IDs returned from the pstat_getfile2(). This call does not work for sockets other
than the AF_UNIX family type.
PSTAT FUNCTION
Name
pstat_getipc() - get information about the System V IPC subsystem
Synopsis
#include <sys/pstat.h>
int pstat_getipc(
struct pst_ipcinfo *
buf,
296 Hewlett-Packard Company 6 HP-UX 11i Version 3: February 2007