Psetrun
,
Lsetrun
—
run a stopped process or thread
Process Control Library (libproc, -lproc)
#include
<libproc.h>
int
Psetrun
(
struct
ps_prochandle *P,
int sig,
int flags);
int
Lsetrun
(
struct
ps_lwphandle *L,
int sig,
int flags);
The
Psetrun
() function resumes the stopped
process handle
P and transitions the process
to running. If
sig is non-zero, then the
Psetrun
() function causes the signal to be
delivered. See
signal.h(3HEAD) for a list of
valid signal identifiers.
The
flags member modifies the behavior of the
resumed handle. The following values may be combined by a
bitwise-inclusive-OR:
-
-
PRCSIG
- Clears the current signal, if any.
-
-
PRCFAULT
- Clears the current fault, if any.
-
-
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
PRSTEP section of
proc(4).
-
-
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
EINTR
.
If both
PRCSIG
is specified and
sig is non-zero, then the
PRCSIG
request takes priority, and it will
be treated as though
sig was passed the
argument
0.
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
PCRUN section in
proc(4).
Note, the
Psetrun
() function is only valid
for active processes. It will fail on process handles that refer to core
files, zombie processes, and ELF objects.
The
Lsetrun
() function is equivalent to the
Psetrun
() function, except rather than
operating on a process it operates on a thread.
Lsetrun
() causes the specified thread,
L, to resume execution. Whereas
Psetrun
() causes all threads in the process
to resume.
Upon successful completion, the
Psetrun
() and
Lsetrun
() functions return
0. Otherwise,
-1 is
returned and
errno is set to indicate the error.
For a full list of possible errors see the
DIAGNOSTICS section in
proc(4).
The
Psetrun
() and
Lsetrun
() functions will fail if:
-
-
EBUSY
- The process handle 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.
Uncommitted
See
LOCKING in
libproc(3LIB).
signal.h(3HEAD),
libproc(3LIB),
Pstatus(3PROC),
proc(4)