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