PSTAT Interfaces
13
(1) elemsize is > 0 or <= actual size of the kernel's version
(2) index >= 0
(3) if pid >= 0, elemcount >= 0
(4) if pid == -1, elemcount > 0
• ESRCH is set if the specific-PID (Process Identification number) shortcut is used and there is
no active process with that PID.
• EFAULT is set of buf points to invalid address.
Example:
#include <sys/pstat.h>
void main(void)
{
struct lwp_status lwpbuf;
/*
* Get information for LWP whose lwpid is 4321 within
* a process whose pid is 1234.
*/
count = pstat_getlwp(buf, sizeof(struct lwp_status), 0, 4321,
1234);
if (count == -1) {
perror("pstat_getlwp()");
} else {
. . . . . .
}
}
4.11 pstat_getmpathname()
Synopsis:
int pstat_getmpathname(struct pst_mpathnode *buf, size_t elemsize, size_t elemcount,
int index, struct psfsid *fsid);
Description:
This call returns entries from the system cache of recent directory and file names looked
up (DNLC) for a specified file system. The fsid parameter uniquely identifies the file system. This
fsid should be the psf_fsid field of a psfileid structure obtained from calls to pstat_getfile2(),
pstat_getproc(), or pstat_getprocvm(). The index parameter specifies the starting entry within the
chain of DNLC entries to be returned for the specified file system. The elemcount parameter
specifies the number of DNLC entries to be returned. Typically, the index parameter will be
specified as zero and the elemcount parameter will be equal to the dnlc size obtained through
pstat_getdynamic() call. For each call, data up to a maximum of elemsize bytes are returned in
the structs pst_mpathnode pointed to by buf.
Reverse pathname lookup can be performed by searching the entries for one that has a
psr_file member equal to the psr_parent member of the current entry. This is done until an entry
with a NULL psr_parent entry is located, which indicates that the entry for the root of the file
system has been found. The pathname from the root of the file system is formed by prefixing the
names given by the psr_name member of each of the entries found during the process. If desired,
the full pathname can then be formed by concatenating the pathname to the mount point of the
file system.
Use of this function is limited to UID == 0.