HP-UX 11i September 2003 Release Notes

Programming
Miscellaneous
Chapter 15
301
data structures change from release to release, this access method is fragile, incurring a
high maintenance cost. To insulate these applications from the release-to-release
variability in private kernel data structures, HP-UX 11i provides the enhanced pstat
system call and a new set of wrappers.
The pstat interface is designed to allow future expansion of the interface, while
preserving source and binary compatibility of programs written using pstat wrappers.
The pstat interface is available in both 64-bit and 32-bit versions. Replacing the
/dev/kmem access with calls to pstat wrappers will eliminate the need to re-release
applications with each new HP-UX release.
Currently, the pstat() system call provides information about various system contexts,
such as static, dynamic, virtual memory, process, open files, etc. HP-UX provides a
number of libc wrappers (pstat_get()*) and corresponding structures (struct
pst_()*) to get information from the kernel using pstat(). As part of this
enhancement, new pstat() wrappers and corresponding structures are added and some
existing ones are extended.
Compatibility is significantly improved by introducing a well documented interface that
guarantees binary compatibility for kernel intrusive applications between releases.
There is no impact to legacy behavior of current pstat() services.
There is no impact to application performance as compared to obtaining the data from
/dev/kmem. No impact to system performance is expected from these pstat extensions.
NOTE This release includes an enhanced version of pstat(). This version repairs some
existing defects by adding more fields in pst_status struct to return process children
usage information. The pstat (2) manpage reflects this added functionality. The
enhancement poses no problem for 11.0 executables running on 11.0 Extension Pack or
11i, nor for any executables running on 11.0 Extension Pack, as long as they do not rely
on the additional functionality.
Note, however, relocatable objects may incorrectly presume that the size of returned
information is the same pre- and post-patch. It is possible to determine the size of
information returned. pstat() users can use the size return value of the system call to
maintain relocatable object compatibility and portability across the proposed change.
This is documented in the manpage.
pstat() is not part of an industry standard, but was designed to accommodate changes
of this nature while maintaining compatibility with earlier versions.
New Modules
The following table shows new pstat modules and the purpose of each:
Table 15-1 New pstat Modules
pstat_getfile2() Provides information about open files of a process
pstat_getfiledetails() Provides stat equivalent information
pstat_getsocket() Provides detailed socket information
pstat_getstream() Provides detailed stream information