xref: /illumos-gate/usr/src/man/man3proc/pr_exit.3proc (revision 2e10def11ef1a50c25efa2444482670e6b0654ff)
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 PR_CREAT 3PROC
16.Os
17.Sh NAME
18.Nm pr_exit
19.Nd inject exit system call into victim process
20.Sh SYNOPSIS
21.Lb libproc
22.In libproc.h
23.Ft int
24.Fo pr_exit
25.Fa "struct ps_prochandle *P"
26.Fa "int status"
27.Fc
28.Sh DESCRIPTION
29The
30.Fn pr_exit
31function injects the
32.Xr exit 2
33system call into the target process
34.Fa P
35by means of the agent LWP.
36If the process handle
37.Fa P
38is
39.Dv NULL
40then this is equivalent to calling
41.Xr exit 2
42on the currently running process.
43.Pp
44The argument
45.Fa status
46has the same meaning as in
47.Xr exit 2 .
48See
49.Xr exit 2
50for the full description and purpose of the
51.Sy exit
52system call and its arguments.
53.Pp
54The
55.Fn pr_exit
56function only works on active processes.
57Process handles that correspond to core files, zombie processes, or ELF objects
58do not support system call injection.
59.Sh RETURN VALUES
60Upon successful completion, the
61.Fn pr_exit
62function's return value is that described in
63.Xr exit 2 .
64Otherwise,
65.Sy -1
66is returned and
67.Sy errno
68is set to
69.Er ENOSYS
70to indicate that the system call could not be injected.
71.Pp
72If the
73.Fn pr_exit
74function is called with the value of
75.Fa P
76set to
77.Dv NULL ,
78then the function will not return.
79.Sh ERRORS
80For the full list of errors see the
81.Sy ERRORS
82section in
83.Xr exit 2 .
84.Pp
85The
86.Fn pr_exit
87function will fail if:
88.Bl -tag -width Er
89.It Er ENOSYS
90An error occurred while trying to invoke the agent LWP and inject a
91system call in the process handle
92.Fa P
93or the process handle
94.Fa P
95does not support system call injection.
96.El
97.Sh INTERFACE STABILITY
98.Sy Uncommitted
99.Sh MT-LEVEL
100See
101.Sy LOCKING
102in
103.Xr libproc 3LIB .
104.Sh SEE ALSO
105.Xr exit 2 ,
106.Xr libproc 3LIB ,
107.Xr proc 4
108