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
40 can be obtained from the
48 argument must point to a valid pointer that will be used to store an
49 error code in the event that
51 is unable to successfully obtain a handle to the process. The possible
52 errors are defined below in the
54 section. The code may be transformed into a human readable string
56 .Xr Lgrab_error 3PROC .
58 The handle to the thread is valid until the
60 function is called, which also releases associated resources from the
61 handle. Only a single handle to a specific thread may exist at any
62 time. If the handle already exists and another caller attempts to grab
63 that thread, it will result in an error. The caller must call
65 before releasing the handle associated with
68 Unlike grabbing a process, grabbing a thread does not change the current
69 state of the thread. If it is running, it will remain running. If it is
70 stopped, it will remain stopped.
72 Upon successful completion, the
74 function returns a pointer to the control handle for the specified
75 thread. Otherwise, the
77 pointer is returned and
79 is set to indicate the error.
83 function will fail if:
86 Another handle already exists for the thread identified by
88 The handle need not exist in the current process and may exist in
91 The thread identified by
93 does not exist or has already become a zombie.
95 An unanticipated system error occurred while trying to create the
96 handle. When this occurs, then the value of
100 for more information and
102 for the list of possible errors.
104 .Sh INTERFACE STABILITY
112 .Xr Lgrab_error 3PROC ,