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