HP-UX Reference (11i v2 04/09) - 2 System Calls (vol 5)

p
pstat(2) pstat(2)
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);
}
/*
* Example 13: Acquire the extended commandline for the process
*/
main()
{
char cmdline[1024];
int rv;
rv = pstat_getcommandline(cmdline, sizeof(cmdline),1, getpid());
if(rv<0){
perror("pstat_getcommandline()");
} else {
printf("Commandline : %s \n",cmdline);
}
}
WARNINGS
Some parts of the program status may not get updated when a process becomes a zombie. An example is
that the cpu percentage is not updated because the process is not expected to be scheduled to run after
entering the zombie state.
AUTHOR
The
pstat routines were developed by HP.
FILES
/usr/include/sys/pstat.h
Contains detailed descriptions of context data structures and fields.
SEE ALSO
iostat(1), ps(1), top(1), vmstat(1), crashconf(1M), fuser(1M), vgdisplay(1M), crashconf(2), mq_open(2),
msgctl(2), pstat_getproclocality(2), pstat_getlocality(2), sem_open(2), semctl(2), shmctl(2), stat(2),
Section 2256 Hewlett-Packard Company 17 HP-UX 11i Version 2: September 2004