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