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