PROC_ARG_PSINFO(3PROC) Process Control Library Functions PROC_ARG_PSINFO(3PROC)
NAME
proc_arg_psinfo,
proc_arg_xpsinfo - process ps information utility function
LIBRARY
Process Control Library (libproc, -lproc)
SYNOPSIS
#include <libproc.h> pid_t proc_arg_psinfo(
const char *arg,
int oflag,
psinfo_t *psp,
int *perr);
pid_t proc_arg_xpsinfo(
const char *arg,
int oflag,
psinfo_t *psp,
int *perr,
const char **lwps);
DESCRIPTION
The
proc_arg_psinfo() and
proc_arg_xpsinfo() functions are utility
functions which process an argument that may refer to a currently active
process or core file and attempts to obtain the
ps(1) information from the
process or core and fills it into
psp.
The string
arg contains the name of something to try and open. How it is
interpreted depends on the value of
oflag. The following values may be
passed in as a bitwise-exclusive-OR for
oflag:
PR_ARG_PIDS Allows
arg to specify process IDs and /proc arguments.
PR_ARG_CORES Allows
arg to specify core files.
PR_ARG_ANY Encompasses all of the previous opens.
The argument
perr must be a non-NULL pointer and in the event that the
proc_arg_psinfo() or
proc_arg_xpsinfo() functions fail, then
perr will be
updated with a more detailed error number.
If the
lwps argument is non-NULL, then if there is a thread specification
present in
arg, it will be validated to see if it is a valid range and then
a pointer to the start of the thread specification will be stored in
lwps.
For more information on determining process range validity, see
proc_lwp_range_valid(3PROC) for more information on valid and invalid tread
specifications.
RETURN VALUES
Upon successful completion, the
proc_arg_psinfo() and
proc_arg_xpsinfo()
functions return the process identifier and fill in
psp with the ps
information of the process. Otherwise,
-1 is returned and
perr is filled
in with the error's details.
ERRORS
For a full list of additional errors, see the
ERRORS section in
Pgrab_core(3PROC).
G_BADLWPS
arg contains an invalid thread specification.
G_NOCORE PR_ARG_CORES was set and no core file could be found
corresponding to
arg.
G_NOPROC PR_ARG_PIDS was set and no process could be found
corresponding to
arg.
G_NOPROCORCORE Both PR_ARG_CORES and PR_ARG_NOPROC were set and no
process or core file could be found corresponding to
arg.
INTERFACE STABILITY
UncommittedMT-LEVEL MT-SafeSEE ALSO
ps(1),
libproc(3LIB),
Pgrab(3PROC),
Pgrab_core(3PROC),
Prelease(3PROC),
proc_lwp_range_valid(3PROC),
proc(5)illumos November 27, 2023 illumos