HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
p
pstat(2) pstat(2)
rv = pstat_getfile2(&psf, sizeof(psf), 0, fd, getpid());
if (rv == 1) {
/*
* Ask for pathname information.
*/
count = pstat_getpathname(filename, 20, &(psf.psf_fid));
if (count > 0) {
if (strncmp("/etc/passwd", filename, count) == 0) {
printf("Success\n");
} else {
printf("Error encountered\n");
}
} else if (count == 0) {
printf("pathname not found in system cache\n");
} else {
perror("pstat_getpathname()");
}
} else {
perror("pstat_getfile2");
}
close(fd);
}
/*
* Example 12: Acquire multiple pathname information for a file
* system
*/
main()
{
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 {
Section 2−−232 − 15 − HP-UX Release 11i: December 2000
___
___