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