pstat.2 (2010 09)

p
pstat(2) pstat(2)
(psfstream[i].val.head.pst_hi_nodeid ==
psf.psf_hi_nodeid) &&
(psfstream[i].val.head.pst_lo_nodeid ==
psf.psf_lo_nodeid)) {
printf(""Success\n"");
printf(""The major number of the stream is %d\n"",
psfstream[i].val.head.pst_dev_major);
if (psfstream[i].pst_extn_flags &
PS_STR_XPORT_DATA) {
if (psfstream[i].pst_str_xport_protocol ==
PS_STR_XPORT_TCP_PROTO) {
printf(""TCP max hiwat %d\n"",
psfstream[i].pst_str_xport_obufsz);
printf(""Local port number is %d\n"",
((struct sockaddr_in *)
(psfstream[i].pst_str_xport_boundaddr))
->sin_port);
printf(""TCP protocol state %d\n"",
psfstream[i].pst_str_xport_pstate);
}
}
} else {
printf(""State changed\n"");
}
} else {
perror(""pstat_getstream()"");
}
} else {
perror(""pstat_getfile2"");
}
close(fd);
}
Example 10
Acquire detailed information about a stream.
main()
{
struct pst_fileinfo2 psf;
struct pst_stream psfstream[3];
int rv, count, fd;
(void)memset(&psf,0,sizeof(psf));
(void)memset(&psfstream,0,sizeof(psfstream));
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).
*/
count = pstat_getstream(psfstream, sizeof(struct pst_stream), 3, 0
,&(psf.psf_fid));
if (count > 0) {
if ((psfstream[0].val.head.pst_hi_fileid ==
psf.psf_hi_fileid) &&
24 Hewlett-Packard Company 24 HP-UX 11i Version 3: September 2010