xref: /illumos-gate/usr/src/man/man3proc/pr_mmap.3proc (revision 6446bd46ed1b4e9f69da153665f82181ccaedad5)
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_MMAP 3PROC
16.Os
17.Sh NAME
18.Nm pr_mmap
19.Nd inject mmap system call into victim process
20.Sh SYNOPSIS
21.Lb libproc
22.In libproc.h
23.Ft int
24.Fo pr_mmap
25.Fa "struct ps_prochandle *P"
26.Fa "void *addr"
27.Fa "size_t len"
28.Fa "int prot"
29.Fa "int flags"
30.Fa "int fd"
31.Fa "off_t off"
32.Fc
33.Sh DESCRIPTION
34The
35.Fn pr_mmap
36function injects the
37.Xr mmap 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 mmap 2
47on the currently running process.
48.Pp
49The arguments
50.Fa addr ,
51.Fa len ,
52.Fa prot ,
53.Fa flags ,
54.Fa fd ,
55and
56.Fa off
57have the same meaning as in
58.Xr mmap 2 .
59See
60.Xr mmap 2
61for the full description and purpose of the
62.Sy mmap
63system call and its arguments.
64.Pp
65The
66.Fn pr_mmap
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_mmap
73function's return value is that described in
74.Xr mmap 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 mmap 2 .
87.Pp
88The
89.Fn pr_mmap
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 mmap 2 ,
109.Xr libproc 3LIB ,
110.Xr proc 5
111