PSTAT Interfaces

14
Return Value:
On success, the function returns the number of DNLC entries copied. In case of failure,
the value of -1 is returned and errno is set indicating the cause of the failure.
Errors:
EPERM is set if UID != 0.
EFAULT is set if buf or fsid point to invalid address.
EINVAL is set if elemcount is not greater than or equal to 1 or index is not greater than or
equal to 0.
EINVAL is set if the user's size declaration isn't valid.
ENOENT is set if the specified file system is not found or does not have DNLC entries.
Example:
#include <sys/pstat.h>
void main(void)
{
struct pst_fileinfo2 psf;
struct pst_mpathnode mpath_buf[20];
int i, rv, count, fd;
pid_t target;
target = getpid();
fd = open("/etc/passwd", O_RDONLY);
rv = pstat_getfile2(&psf, sizeof(psf), 0, fd, target);
if (rv == 1) {
/*
* Ask for multiple pathname information.
*/
count = pstat_getmpathname(mpath_buf,
sizeof(struct pst_mpathnode),
20, 0, &(psf.psf_id.psf_fsid));
if (count > 0) {
for (i = 0; i < count; i++) {
printf(“component %d: %s\n”,
i, mpath_buf[i].psr_name);
}
} else if (count == 0) {
printf("pathnames not found in system cache\n");
} else {
perror("pstat_getmpathname()");
}
} else {
perror("pstat_getfile2");
}
close(fd);
}
4.12 pstat_getmsg()
Synopsis:
int pstat_getmsg(struct pst_msginfo *buf, size_t elemsize, size_t elemcount, int index);
Description: