pstat.2 (2010 09)
p
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. However, the pstat indexing tech-
nique represents a general attempt by the pstat interfaces to ensure that two instances of a pstat context
with different indices represent different objects.
Backward Compatibility
The pstat functions have a specific calling convention of passing the expected data structure size into the
function as a parameter in order to allow for future expansion of the interface, while preserving back-
wards source and object compatibility for programs written using the pstat interfaces. Three rules are
followed to allow existing applications to continue to execute from release to release of the operating sys-
tem.
• New data for a context are added to the end of that context’s data structure.
• Old, obsolete data members are not deleted from the data structure.
• The operating system honors the elemsize parameter of the call and only returns the first elemsize
bytes of the context data, even if the actual data structure has since been enlarged.
In this way, an application that passes its compile-time size of the context’s data structure (for example,
sizeof(struct pst_processor)
for the Processor context) as the elemsize parameter will con-
tinue to execute on future operating system releases without recompilation, even those that have larger
context data structures. If the program is recompiled, it will also continue to execute on that and future
releases. Note that the reverse is not true: a program using the pstat interfaces compiled on, for exam-
ple, HP-UX 11i Version 2 will not necessarily work on HP-UX 11i Version 1.
Programming Model Considerations
While the pstat functional interfaces,
pstat_get*(), and their pstat data that are available to applica-
tions compiled using the ILP32 programming model are source-compatible with the same applications
written using the LP64 programming model, the corresponding
pst_* structures in each of these pro-
gramming models may differ in size. To accomodate applications written in standard C and extended
ANSI C that must still use the ILP32 programming model, the structures are provided in a transitional
mode. Such an application can use the flag
-D_PSTAT64 at compile time to switch to using these transi-
tional structures. Using this compiler flag on such an application is equivalent to using the pstat inter-
faces on an application using the LP64 programming model.
The use of the pstat functional interfaces for applications using the ILP32 programming model without
defining the
-D_PSTAT64 compiler flag is deprecated. Furthermore, some pstat functions are available
only for applications using the LP64 programming model and for applications written in standard C and
extended ANSI C that use the ILP32 programming model and that define -D_PSTAT64
. The pstat func-
tions
pstat_getlwp(),
pstat_getcrashinfo(), and pstat_getlocality()
are some of the
pstat functions that fall into this category.
Security Restrictions
Some or all of the actions associated with this system call are subject to compartmental restrictions. This
restriction applies when attempting to get information on message queues, semaphores or processes
which are in a different compartment. See compartments (5) for more information about compartmentali-
zation on systems that support that feature.
Compartmental restrictions can be overridden if the process possesses the
COMMALLOWED privilege
(PRIV_COMMALLOWED). Processes owned by the superuser may not have this privilege. Processes
owned by any user may have this privilege, depending on system configuration. See privileges (5) for
more information about privileged access on systems that support fine-grained privileges.
PSTAT FUNCTION
Name
pstat_getcommandline() - get command line of a process
Synopsis
#include <sys/pstat.h>
int pstat_getcommandline(
char *buf,
size_t elemsize ,
HP-UX 11i Version 3: September 2010 − 3 − Hewlett-Packard Company 3