xref: /illumos-gate/usr/src/man/man3proc/Psetflags.3proc (revision fe4627ef755b7c263f91a0e6f07cdca5d7083501)
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 PSETFLAGS 3PROC
16.Os
17.Sh NAME
18.Nm Psetflags
19.Nm Punsetflags
20.Nd set and unset process flags
21.Sh SYNOPSIS
22.Lb libproc
23.In libproc.h
24.Ft int
25.Fo Psetflags
26.Fa "struct ps_prochandle *P"
27.Fa "long flags"
28.Fc
29.Ft int
30.Fo Punsetflags
31.Fa "struct ps_prochandle *P"
32.Fa "long flags"
33.Fc
34.Sh DESCRIPTION
35The
36.Fn Psetflags
37and
38.Fn Punsetflags
39functions manipulate the process flags for the process handle
40.Fa P .
41The process flags determine how the process behaves in the face of
42various actions. For example, setting the
43.Sy PR_FORK
44flag indicates that the tracing flags of the process and the
45inherit-on-fork mode should be set on children. A full list of the
46process flags is available in the
47.Sy PCSET
48section in
49.Xr proc 4 .
50.Pp
51The
52.Fn Psetflags
53function sets the flags specified in
54.Fa flags
55by doing a bitwise-inclusive-OR with the previously set flags.
56.Pp
57The
58.Fn Punsetflags
59function removes the flags specified in
60.Fa flags
61from the tracing flags of the process. Items not listed in
62.Fa flags
63will remain.
64.Pp
65To see the current set of flags active on the process, check the
66.Sy pr_flags
67member of the
68.Sy pstatus_t
69for the process. It can be obtained through the
70.Xr Pstatus 3PROC
71function.
72.Pp
73Note, attempting to modify the process flags only works on active
74processes. Attempting to call these functions of process handles
75corresponding to core files, zombie processes, or files, will result in
76an error.
77.Sh RETURN VALUES
78Upon successful completion, the
79.Fn Psetflags
80and
81.Fn Punsetflags
82functions return
83.Sy 0 .
84Otherwise,
85.Sy -1
86is returned
87and
88.Sy errno
89is set to indicate the error.
90.Sh ERRORS
91For a full list of possible errors see the
92.Sy DIAGNOSTICS
93section in
94.Xr proc 4 .
95.Sh INTERFACE STABILITY
96.Sy Uncommitted
97.Sh MT-LEVEL
98See
99.Sy LOCKING
100in
101.Xr libproc 3LIB .
102.Sh SEE ALSO
103.Xr libproc 3LIB ,
104.Xr Pstatus 3PROC ,
105.Xr proc 4
106