PROC_ARG_PSINFO(3PROC) Process Control Library Functions PROC_ARG_PSINFO(3PROC)

proc_arg_psinfo, proc_arg_xpsinfoprocess ps information utility function

Process Control Library (libproc, -lproc)

#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);

The () and () 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:

Allows arg to specify process IDs and /proc arguments.
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 () or () 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.

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, is returned and perr is filled in with the error's details.

For a full list of additional errors, see the ERRORS section in Pgrab_core(3PROC).

arg contains an invalid thread specification.
was set and no core file could be found corresponding to arg.
was set and no process could be found corresponding to arg.
Both PR_ARG_CORES and PR_ARG_NOPROC were set and no process or core file could be found corresponding to arg.

ps(1), libproc(3LIB), Pgrab(3PROC), Pgrab_core(3PROC), Prelease(3PROC), proc_lwp_range_valid(3PROC), proc(5)

November 27, 2023 OmniOS