HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)

p
pstat(2) pstat(2)
if (count == -1)
perror("pstat_getlwp()");
else
...
}
/*
* Example 8: Acquire detailed information about a specific file
*/
main()
{
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);
}
/*
* Example 9: Acquire detailed information about a stream
*/
main()
{
struct pst_fileinfo2 psf;
struct pst_stream psfstream[3];
int rv, count, fd;
fd = open("/dev/echo", O_RDONLY);
rv = pstat_getfile2(&psf, sizeof(psf), 0, fd, getpid());
if (rv == 1) {
/*
* Ask for 3 structures (head + module(s) + driver).
* If there are no modules, we expect 2 structures (head, driver)
* If there is 1 module, we expect 3 structures (head, module,
* driver)
* If there is more than 1 module, we expect 3 structures
* (head, modules).
*/
Section 2250 Hewlett-Packard Company 13 HP-UX 11i Version 1: September 2005