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