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