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_fstat64 , 20.Nm pr_lstat , 21.Nm pr_lstat64 , 22.Nm pr_stat , 23.Nm pr_stat64 24.Nd inject stat system call into victim process 25.Sh SYNOPSIS 26.Lb libproc 27.In libproc.h 28.Ft int 29.Fo pr_fstat 30.Fa "struct ps_prochandle *P" 31.Fa "int fd" 32.Fa "struct stat *buf" 33.Fc 34.Ft int 35.Fo pr_fstat64 36.Fa "struct ps_prochandle *P" 37.Fa "int fd" 38.Fa "struct stat64 *buf" 39.Fc 40.Ft int 41.Fo pr_lstat 42.Fa "struct ps_prochandle *P" 43.Fa "const char *path" 44.Fa "struct stat *buf" 45.Fc 46.Ft int 47.Fo pr_lstat64 48.Fa "struct ps_prochandle *P" 49.Fa "const char *path" 50.Fa "struct stat64 *buf" 51.Fc 52.Ft int 53.Fo pr_stat 54.Fa "struct ps_prochandle *P" 55.Fa "const char *path" 56.Fa "struct stat *buf" 57.Fc 58.Ft int 59.Fo pr_stat64 60.Fa "struct ps_prochandle *P" 61.Fa "const char *path" 62.Fa "struct stat64 *buf" 63.Fc 64.Sh DESCRIPTION 65The 66.Fn pr_stat , 67.Fn pr_lstat , 68and 69.Fn pr_fast 70functions inject the 71.Xr stat 2 , 72.Xr lstat 2 , 73and 74.Xr fstat 2 75system calls respectively into the target process 76.Fa P 77by means of the agent LWP. 78If the process handle 79.Fa P 80is the value 81.Dv NULL 82then this will be equivalent to calling 83.Xr stat 2 , 84.Xr lstat 2 , 85or 86.Xr fstat 2 87on the currently running process. 88.Pp 89The arguments 90.Fa path , 91and 92.Fa buf 93to the 94.Fn pr_stat 95function have the same meaning as in 96.Xr stat 2 . 97See 98.Xr stat 2 99for the full description and purpose of the 100.Sy stat 101system call and its arguments. 102.Pp 103The arguments 104.Fa fd , 105and 106.Fa buf 107to the 108.Fn pr_fstat 109function have the same meaning as in 110.Xr fstat 2 , 111see 112.Xr fstat 2 113for the full description and purpose of the 114.Sy fstat 115system call and its arguments. 116.Pp 117The arguments 118.Fa path , 119and 120.Fa buf 121to the 122.Fn pr_lstat 123function have the same meaning as in 124.Xr lstat 2 , 125see 126.Xr lstat 2 127for the full description and purpose of the 128.Sy lstat 129system call and its arguments. 130.Pp 131The 132.Fn pr_stat , 133.Fn pr_lstat , 134and 135.Fn pr_fstat 136functions only work on active processes. 137Process handles that correspond to core files, zombie processes, or ELF objects 138do not support system call injection. 139.Pp 140The 141.Fn pr_stat64 , 142.Fn pr_fstat64 , 143and 144.Fn pr_lstat64 145functions are equivalent to 146.Fn pr_stat , 147.Fn pr_fstat , 148and 149.Fn pr_lstat 150respectively; however, rather than having the stat information be subject to the 151data model of the target process, they always provide 64-bit stat information. 152See 153.Xr lf64 5 154for more information. 155.Sh RETURN VALUES 156Upon successful completion, the 157.Fn pr_stat 158function's return value is that described in 159.Xr stat 2 . 160Otherwise, 161.Sy -1 162is returned and 163.Sy errno 164is set to 165.Er ENOSYS 166to indicate that the system call could not be injected. 167.Sh ERRORS 168For the full list of errors see the 169.Sy ERRORS 170section in 171.Xr stat 2 . 172.Pp 173The 174.Fn pr_stat 175function will fail if: 176.Bl -tag -width Er 177.It Er ENOSYS 178An error occurred while trying to invoke the agent LWP and inject a 179system call in the process handle 180.Fa P 181or the process handle 182.Fa P 183does not support system call injection. 184.El 185.Sh INTERFACE STABILITY 186.Sy Uncommitted 187.Sh MT-LEVEL 188See 189.Sy LOCKING 190in 191.Xr libproc 3LIB . 192.Sh SEE ALSO 193.Xr stat 2 , 194.Xr libproc 3LIB , 195.Xr proc 4 , 196.Xr lf64 5 197