xref: /illumos-gate/usr/src/man/man3proc/Psetrun.3proc (revision dcbf3bd6a1f1360fc1afcee9e22c6dcff7844bf2)
1.\"
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
5.\" 1.0 of the CDDL.
6.\"
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.
10.\"
11.\"
12.\" Copyright 2015 Joyent, Inc.
13.\"
14.Dd May 11, 2016
15.Dt PSETRUN 3PROC
16.Os
17.Sh NAME
18.Nm Psetrun ,
19.Nm Lsetrun
20.Nd run a stopped process or thread
21.Sh SYNOPSIS
22.Lb libproc
23.In libproc.h
24.Ft int
25.Fo Psetrun
26.Fa "struct ps_prochandle *P"
27.Fa "int sig"
28.Fa "int flags"
29.Fc
30.Ft int
31.Fo Lsetrun
32.Fa "struct ps_lwphandle *L"
33.Fa "int sig"
34.Fa "int flags"
35.Fc
36.Sh DESCRIPTION
37The
38.Fn Psetrun
39function resumes the stopped process handle
40.Fa P
41and transitions the process to running.
42If
43.Fa sig
44is non-zero, then the
45.Fn Psetrun
46function causes the signal to be delivered. See
47.Xr signal.h 3HEAD
48for a list of valid signal identifiers.
49.Pp
50The
51.Fa flags
52member modifies the behavior of the resumed handle. The following values
53may be combined by a bitwise-inclusive-OR:
54.Bl -tag -width Dv -offset indent
55.It Dv PRCSIG
56Clears the current signal, if any.
57.It Dv PRCFAULT
58Clears the current fault, if any.
59.It Dv PRSTEP
60Indicates that the thread should single-step over the next machine
61instruction and upon completion, inject a trap. For the specific
62mechanics of single-stepping and what traps or signals will be injected,
63see the
64.Sy PRSTEP
65section of
66.Xr proc 4 .
67.It Dv PRSABORT
68Indicates that the thread should abort the system call that it is
69currently executing. This is only valid if the thread is stopped because
70it is asleep or right before a system call. This will cause the system
71call to return
72.Er EINTR .
73.El
74.Pp
75If
76both
77.Dv PRCSIG
78is specified and
79.Fa sig
80is non-zero, then the
81.Dv PRCSIG
82request takes priority, and it will be treated as though
83.Fa sig
84was passed the argument
85.Sy 0 .
86.Pp
87When the process is resumed all extent tracing flags and register
88changes will be synchronized with the process. For more information on
89resuming a thread see the
90.Sy PCRUN
91section in
92.Xr proc 4 .
93.Pp
94Note, the
95.Fn Psetrun
96function is only valid for active processes. It will fail on process
97handles that refer to core files, zombie processes, and ELF objects.
98.Pp
99The
100.Fn Lsetrun
101function is equivalent to the
102.Fn Psetrun
103function, except rather than operating on a process it operates on a
104thread.
105.Fn Lsetrun
106causes the specified thread,
107.Fa L ,
108to resume execution. Whereas
109.Fn Psetrun
110causes all threads in the process to resume.
111.Sh RETURN VALUES
112Upon successful completion, the
113.Fn Psetrun
114and
115.Fn Lsetrun
116functions return
117.Sy 0 .
118Otherwise,
119.Sy -1
120is returned and
121.Sy errno
122is set to indicate the error.
123.Sh ERRORS
124For a full list of possible errors see the
125.Sy DIAGNOSTICS
126section in
127.Xr proc 4 .
128.Pp
129The
130.Fn Psetrun
131and
132.Fn Lsetrun
133functions will fail if:
134.Bl -tag -width Er
135.It Er EBUSY
136The process handle
137.Fa P
138is not currently stopped or it is not stopped due to an event of
139interest, a directed stop, or it is asleep in a system call.
140.El
141.Sh INTERFACE STABILITY
142.Sy Uncommitted
143.Sh MT-LEVEL
144See
145.Sy LOCKING
146in
147.Xr libproc 3LIB .
148.Sh SEE ALSO
149.Xr signal.h 3HEAD ,
150.Xr libproc 3LIB ,
151.Xr Pstatus 3PROC ,
152.Xr proc 4
153