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