pstat(2) pstat(2) NAME pstat: pstat_getcommandline(), pstat_getcrashdev(), pstat_getcrashinfo(), pstat_getdisk(), pstat_getio(), pstat_getdynamic(), pstat_getfile2(), pstat_getfiledetails(), pstat_getipc(), pstat_getlv(), pstat_getlwp(), pstat_getmpathname(), pstat_getmsg(), pstat_getnode(), pstat_getpathname(), pstat_getpmq(), pstat_getproc(), pstat_getprocessor(), pstat_getprocvm(), pstat_getpsem(), pstat_getpset(), pstat_getsem(), pstat_getshm(), pstat_getsocket(), pstat_getstable(), pstat_getstatic(),
pstat(2) pstat(2) Context Static Dynamic VM IPC Stable Store Crash Dumps Processor Disk IO Object Swap Dump Areas Node Locality Command Line Process LW Process Process VM Process Loc.
pstat(2) pstat(2) In general, no attempt is made to provide consistency between two instances of pstat contexts. This is true even if these two instances are obtained via the same pstat_get*() call. It is also true that two pstat function calls that return the same instance of a pstat context may not be consistent with each other due to changes in the kernel data that occurred between the two calls.
pstat(2) pstat(2) size_t elemcount , int pid ); Description pstat_getcommandline() returns the command line of the process specified in the pid parameter. Up to a maximum of elemsize -1 bytes is returned in the buffer buf, if the elemsize is less than or equal to the size of the process command line. If the elemsize is greater than the size of process command line, only the available number of bytes are returned. Up to a maximum of 1020 characters of the process command line is stored.
pstat(2) pstat(2) ); Description pstat_getdisk() returns information specific to a particular disk. There is one instance of this context for each disk opened in the system. Unused, closed disks may not have a context and the number of contexts may not match the number of disks configured into the system. For each instance requested, up to a maximum of elemsize bytes of data is returned in the pst_diskinfo structures pointed to by buf.
pstat(2) pstat(2) Synopsis #include int pstat_getfile2( struct pst_fileinfo2 *buf , size_t elemsize , size_t elemcount , int index , pid_t pid ); Description pstat_getfile2() returns information specific to a particular open file for a specified process. For the specified process, there is one instance of this context for each open file descriptor. For each instance requested, up to a maximum of elemsize bytes of data is returned in the pst_fileinfo2 structures pointed to by buf .
pstat(2) pstat(2) Synopsis #include int pstat_getipc( struct pst_ipcinfo *buf , size_t elemsize , size_t elemcount , int index ); Description pstat_getipc() returns information about the System V IPC subsystem. There is one global instance of this context. This data may change while the system is running due to administrative changes in the associated kernel tunables. Up to a maximum of elemsize bytes of data is returned in the pst_ipcinfo structure pointed to by buf.
pstat(2) pstat(2) requested, up to a maximum of elemsize bytes of data is returned in the lwp_status structure pointed to by buf. The elemcount parameter specifies the number of lwp_status structures that are available at buf to be filled in. The index parameter specifies the starting index within the context of LWPs in a process. If pid is set to -1 and elemcount is greater than 0, elemcount entries of system LWP information are returned to the caller program.
pstat(2) pstat(2) Name pstat_getmsg() - get information for a System V message queue Synopsis #include int pstat_getmsg( struct pst_msginfo *buf , size_t elemsize , size_t elemcount , int index ); Description pstat_getmsg() returns information specific to a particular System V message queue. There is one instance of this context for each System V message queue on the system.
pstat(2) pstat(2) On success, the function returns the length of the path name copied starting at the location specified by buf . If the path name is not available in the system cache, 0 is returned and errno is not set. On other failures, the value of -1 is returned and errno is set indicating the cause of the failure. This call does not work for sockets. PSTAT FUNCTION Name pstat_getpmq() - get information for a POSIX message queue Synopsis #include
pstat(2) pstat(2) Description pstat_getprocessor() returns information specific to a particular processor (the only processor on a uniprocessor system). There is one instance of this context for each processor on the system. For each instance requested, up to a maximum of elemsize bytes of data is returned in the pst_processor structures pointed to by buf. The elemcount parameter specifies the number of pst_processor structures that are available at buf to be filled in.
pstat(2) pstat(2) PSTAT FUNCTION Name pstat_getpset() - get information for a processor set Synopsis #include int pstat_getpset( struct pst_pset *buf , size_t elemsize , size_t elemcount , int index ); Description pstat_getpset() returns information specific to a particular processor set. There is one instance of this context for each processor set on the system. For each instance requested, up to a maximum of elemsize bytes of data is returned in the pst_pset structure pointed by buf.
pstat(2) pstat(2) structures pointed to by buf . The elemcount parameter specifies the number of pst_shminfo structures that are available at buf to be filled in. The index parameter specifies the starting index within the context of System V shared memory segments. As a shortcut, information for a single shared memory segment can be obtained by setting elemcount to 0 and setting index to the shmid of that shared memory segment.
pstat(2) pstat(2) Synopsis #include int pstat_getstatic( struct pst_static *buf , size_t elemsize , size_t elemcount , int index ); Description pstat_getstatic() returns information about the system. Although this data usually does not change frequently, it may change while the system is running due to manually or automatically generated administrative changes in the associated kernel tunables, online addition/deletion of resources, or other events.
pstat(2) pstat(2) Synopsis #include int pstat_getswap( struct pst_swapinfo *buf , size_t elemsize , size_t elemcount , int index ); Description pstat_getswap() returns information specific to a particular swap area. There is one instance of this context for each swap area (block or file system) configured into the system. For each instance requested, up to a maximum of elemsize bytes of data is returned in the pst_swapinfo structures pointed to by buf.
pstat(2) pstat(2) for this pstat call. For those pstat functions that return at most only one structure, such as pstat_getdynamic(), an error return with [EOVERFLOW] set means that the only structure requested is the structure that caused the error return with [EOVERFLOW]. Once the structure that caused the error return with [EOVERFLOW] has been determined, the particular fields of that structure that do not contain valid data can be determined as follows.
pstat(2) pstat(2) [ENOBUFS] For pstat_getsocket(), the operation was terminated due to unavailability of buffer space. [ENOENT] For pstat_getfile2(), pstat_getfiledetails(), pstat_getpathname(), pstat_getsocket(), or pstat_getstream(), the file was not found, or it was closed. For pstat_getmpathname(), the specified file system was not found or the file system did not have DNLC entries. [ENOSTR] pstat_getstream() was called for a file that is neither a stream nor a stream-based pipe or socket.
pstat(2) pstat(2) struct pst_dynamic psd; struct pst_processor *psp; (void)memset(&psd,0,sizeof(struct pst_dynamic)); if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) == 1) { size_t nspu = psd.
pstat(2) pstat(2) } else perror("pstat_getdynamic"); } Example 4A Get information about all processes, 10 at a time. We do it this way since the current count of active processes is unknown.
pstat(2) pstat(2) count = 0; } else if ((ret == -1) && (errno == EOVERFLOW)) { /* EOVERFLOW case: at least one Process context hit it, so we find the one that caused this error. Neither of the fields we are interested in has a validity macro defined, so we just count the number of structures returned to us */ for (i=0;i
pstat(2) pstat(2) size_t num_shm = psi.psi_shmmni; pss = (struct pst_shminfo *) malloc(num_shm * sizeof(struct pst_shminfo)); (void)memset(pss,0,num_shm*sizeof(struct pst_shminfo)); if (pstat_getshm(pss, sizeof(struct pst_shminfo), num_shm, 0) != -1) { int i; (void)printf("owner\tkey\tsize\n"); for (i = 0; i < num_shm; i++) { /* skip inactive segments */ if (!(pss[i].psh_flags & PS_SHM_ALLOC)) continue; (void)printf("%lld\t%#llx\t%llu\n", pss[i].psh_uid, pss[i].psh_key, pss[i].
pstat(2) pstat(2) Example 8 Acquire information about a specific LWP. main() { struct lwp_status lwpbuf; int count; /* * get information for LWP whose lwpid is 4321 within * a process whose pid is 1234. */ count = pstat_getlwp(&lwpbuf, sizeof(struct lwp_status), 0, 4321, 1234); if ((count == -1) && (errno == ESRCH)) perror("pstat_getlwp(): cannot find given lwpid or pid"); else if (count == -1) perror("pstat_getlwp()"); else { /* process data from the call... */ (void)printf("processing lwp data...
pstat(2) pstat(2) Example 9B Acquire protocol information of an XTI or a TLI TCP/UDP end-point. Build this example with the following command: cc -D_PSTAT_STREAM_GET_XPORT -o example9B example9B.c -lxti #include #include #include #include #include #include #include #include
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].
pstat(2) pstat(2) (psfstream[0].val.head.pst_lo_fileid == psf.psf_lo_fileid) && (psfstream[0].val.head.pst_hi_nodeid == psf.psf_hi_nodeid) && (psfstream[0].val.head.pst_lo_nodeid == psf.psf_lo_nodeid)) { printf("Success\n"); printf("The major number of the stream is %lld\n", psfstream[0].val.head.pst_dev_major); } else { printf("State changed\n"); } } else { perror("pstat_getstream()"); } } else { perror("pstat_getfile2"); } close(fd); } Example 11 Acquire detailed information about a socket.
pstat(2) pstat(2) Example 12 Acquire path name information about an open file. main() { struct pst_fileinfo2 psf; char filename[20]; int rv, count, fd; (void)memset(&psf,0,sizeof(psf)); (void)memset(filename,0,sizeof(filename)); fd = open("/etc/passwd", O_RDONLY); rv = pstat_getfile2(&psf, sizeof(psf), 0, fd, getpid()); if (rv == 1) { /* * Ask for path name information. */ count = pstat_getpathname(filename, 20, &(psf.
pstat(2) pstat(2) 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("path names not found in system cache\n"); } else { perror("pstat_getmpathname()"); } } else { perror("pstat_getfile2"); } close(fd); } Example 14 Acquire the extended command line for the process.
(Notes) A (Notes) pA 28 Hewlett-Packard Company −1− HP-UX 11i Version 3: September 2010