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