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