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