2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2015 Joyent, Inc.
19 .Nd obtain a handle to control a thread
23 .Ft "struct ps_lwphandle *"
25 .Fa "struct ps_prochandle *P"
32 function obtains a control handle to the thread identified by
34 residing under the process
36 This handle is then passed as argument to other
41 can be obtained from the
49 argument must point to a valid pointer that will be used to store an
50 error code in the event that
52 is unable to successfully obtain a handle to the process.
53 The possible errors are defined below in the
56 The code may be transformed into a human readable string through the use of
57 .Xr Lgrab_error 3PROC .
59 The handle to the thread is valid until the
61 function is called, which also releases associated resources from the handle.
62 Only a single handle to a specific thread may exist at any time.
63 If the handle already exists and another caller attempts to grab
64 that thread, it will result in an error.
67 before releasing the handle associated with
70 Unlike grabbing a process, grabbing a thread does not change the current
72 If it is running, it will remain running.
73 If it is stopped, it will remain stopped.
75 Upon successful completion, the
77 function returns a pointer to the control handle for the specified thread.
80 pointer is returned and
82 is set to indicate the error.
86 function will fail if:
89 Another handle already exists for the thread identified by
91 The handle need not exist in the current process and may exist in
94 The thread identified by
96 does not exist or has already become a zombie.
98 An unanticipated system error occurred while trying to create the handle.
99 When this occurs, then the value of
104 for more information and
106 for the list of possible errors.
108 .Sh INTERFACE STABILITY
116 .Xr Lgrab_error 3PROC ,