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

Plwp_getspymaster
get agent LWP spy master information

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Plwp_getspymaster(struct ps_prochandle *P, lwpid_t lwpid, psinfo_t *ps);

The Plwp_getspymaster() function returns information about the spy master that corresponds to the agent LWP for the thread lwpid in the process handle P.
The agent LWP allows another process to inject actions into the target process. When an agent LWP is created, it leverages an existing thread in the process and it also creates a record of whom created the agent, which is called the spy master. For more information on the agent LWP and the spy master, see proc(4).
If the thread identified lwpid has an agent LWP, the corresponding ps information (see proc(4) for the definition of the psinfo_t) will be filled into ps.
Note, process handles that correspond to a file, created by Pgrab_file(3PROC), cannot have an agent LWP created for them and thus cannot have any spy master information. In addition, core files from older releases may not have any data on the spy master.

Upon successful completion, the Plwp_getspymaster() returns 0 and updates ps. Otherwise, it returns -1, sets errno, and ps is not modified.

For a full list of possible errors also see the DIAGNOSTICS section in proc(4).
The Plwp_getpsinfo() function will fail if:
 
 
P refers to a file handle obtained through Pgrab_file(3PROC) or P does not have any information about the spy master.
 
 
The process handle P refers to a core file and the specified thread does not exist.
The thread, lwpid does not have an active agent, PR_AGENT is not set in the pr_flags member of the thread's status information.
 
 
The process handle P refers to an active process and the specified thread does not exist.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), proc(4)
May 11, 2016 illumos