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