Unleashed v1.4
[unleashed.git] / share / man / man3proc / pr_stat.3proc
blobe85dc4b092e47cb98abf231db745faaa64abac41
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_STAT 3PROC
16 .Os
17 .Sh NAME
18 .Nm pr_fstat ,
19 .Nm pr_lstat ,
20 .Nm pr_stat
21 .Nd inject stat system call into victim process
22 .Sh SYNOPSIS
23 .Lb libproc
24 .In libproc.h
25 .Ft int
26 .Fo pr_fstat
27 .Fa "struct ps_prochandle *P"
28 .Fa "int fd"
29 .Fa "struct stat *buf"
30 .Fc
31 .Ft int
32 .Fo pr_lstat
33 .Fa "struct ps_prochandle *P"
34 .Fa "const char *path"
35 .Fa "struct stat *buf"
36 .Fc
37 .Ft int
38 .Fo pr_stat
39 .Fa "struct ps_prochandle *P"
40 .Fa "const char *path"
41 .Fa "struct stat *buf"
42 .Fc
43 .Sh DESCRIPTION
44 The
45 .Fn pr_stat ,
46 .Fn pr_lstat ,
47 and
48 .Fn pr_fast
49 functions inject the
50 .Xr stat 2 ,
51 .Xr lstat 2 ,
52 and
53 .Xr fstat 2
54 system calls respectively into the target process
55 .Fa P
56 by means of the agent LWP.
57 If the process handle
58 .Fa P
59 is the value
60 .Dv NULL
61 then this will be equivalent to calling
62 .Xr stat 2 ,
63 .Xr lstat 2 ,
65 .Xr fstat 2
66 on the currently running process.
67 .Pp
68 The arguments
69 .Fa path ,
70 and
71 .Fa buf
72 to the
73 .Fn pr_stat
74 function have the same meaning as in
75 .Xr stat 2 .
76 See
77 .Xr stat 2
78 for the full description and purpose of the
79 .Sy stat
80 system call and its arguments.
81 .Pp
82 The arguments
83 .Fa fd ,
84 and
85 .Fa buf
86 to the
87 .Fn pr_fstat
88 function have the same meaning as in
89 .Xr fstat 2 ,
90 see
91 .Xr fstat 2
92 for the full description and purpose of the
93 .Sy fstat
94 system call and its arguments.
95 .Pp
96 The arguments
97 .Fa path ,
98 and
99 .Fa buf
100 to the
101 .Fn pr_lstat
102 function have the same meaning as in
103 .Xr lstat 2 ,
105 .Xr lstat 2
106 for the full description and purpose of the
107 .Sy lstat
108 system call and its arguments.
111 .Fn pr_stat ,
112 .Fn pr_lstat ,
114 .Fn pr_fstat
115 functions only work on active processes.
116 Process handles that correspond to core files, zombie processes, or ELF objects
117 do not support system call injection.
118 .Sh RETURN VALUES
119 Upon successful completion, the
120 .Fn pr_stat
121 function's return value is that described in
122 .Xr stat 2 .
123 Otherwise,
124 .Sy -1
125 is returned and
126 .Sy errno
127 is set to
128 .Er ENOSYS
129 to indicate that the system call could not be injected.
130 .Sh ERRORS
131 For the full list of errors see the
132 .Sy ERRORS
133 section in
134 .Xr stat 2 .
137 .Fn pr_stat
138 function will fail if:
139 .Bl -tag -width Er
140 .It Er ENOSYS
141 An error occurred while trying to invoke the agent LWP and inject a
142 system call in the process handle
143 .Fa P
144 or the process handle
145 .Fa P
146 does not support system call injection.
148 .Sh INTERFACE STABILITY
149 .Sy Uncommitted
150 .Sh MT-LEVEL
152 .Sy LOCKING
154 .Xr libproc 3LIB .
155 .Sh SEE ALSO
156 .Xr stat 2 ,
157 .Xr libproc 3LIB ,
158 .Xr proc 4