PSTAT Interfaces

10
psfd_lo_nodeid are unique ids representing the opened 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 AF_UNIX family type.
Return Value:
This call returns –1 on failure or 1 on success.
Errors:
EFAULT is set if buf or fid points to invalid address.
ENOENT is set if the specified file is not found or closed.
EINVAL is set if the user’s size declaration is invalid.
EINVAL is set if the fid corresponds to a socket other than AF_UNIX family.
ESRCH is the specified process is not found.
EACESS is set if there is no effective UID match.
EOVERFLOW is set if a value to be stored overflows one of the members of the pst_filedetails
structure. The psfd_valid member indicates the field that overflowed.
Example:
#include <sys/pstat.h>
void main(void)
{
struct pst_fileinfo2 psf;
struct pst_filedetails psfdetails;
int count, fd;
fd = open("/stand/vmunix", O_RDONLY);
count = pstat_getfile2(&psf, sizeof(psf), 0, fd, getpid());
if (count == 1) {
count = pstat_getfiledetails(&psfdetails,
sizeof(psfdetails),
&psf.psf_fid);
if (count == 1) {
if ((psfdetails.psfd_hi_fileid == psf.psf_hi_fileid)&&
(psfdetails.psfd_lo_fileid == psf.psf_lo_fileid)&&
(psfdetails.psfd_hi_nodeid == psf.psf_hi_nodeid)&&
(psfdetails.psfd_lo_nodeid == psf.psf_lo_nodeid)){
printf("Success\n");
} else {
printf("State changed\n");
}
} else {
perror("pstat_getfiledetails()");
}
} else {
perror("pstat_getfile2");
}
close(fd);
}
4.8 pstat_getipc()
Synopsis:
int pstat_getipc(struct pst_ipcinfo *buf, size_t elemsize, size_t elemcount, int index);
Description: