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