|LGRAB(3PROC)||Process Control Library Functions||LGRAB(3PROC)|
struct ps_lwphandle *
Lgrab(struct ps_prochandle *P,
lwpid_t lwpid, int *perr);
Lgrab() function obtains a control handle to the thread identified by lwpid residing under the process P. This handle is then passed as argument to other libproc routines. The lwpid can be obtained from the pr_lwpid member of the lwpstatus_t structure.
The perr argument must point to a valid
pointer that will be used to store an error code in the event that
Lgrab() is unable to successfully obtain a handle to
the process. The possible errors are defined below in the
ERRORS section. The code may be transformed
into a human readable string through the use of
The handle to the thread is valid until the
Lfree(3PROC) function is called,
which also releases associated resources from the handle. Only a single
handle to a specific thread may exist at any time. If the handle already
exists and another caller attempts to grab that thread, it will result in an
error. The caller must call
Lfree() before releasing
the handle associated with P.
Unlike grabbing a process, grabbing a thread does not change the current state of the thread. If it is running, it will remain running. If it is stopped, it will remain stopped.
Lgrab() function returns a pointer to the control handle for the specified thread. Otherwise, the
NULLpointer is returned and perr is set to indicate the error.
Lgrab() function will fail if:
|May 11, 2016||OmniOS|