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