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 PSETWAPT 3PROC
  16 .Os
  17 .Sh NAME
  18 .Nm Psetwapt
  19 .Nd set a watchpoint in a process
  20 .Sh SYNOPSIS
  21 .Lb libproc
  22 .In libproc.h
  23 .Ft int
  24 .Fo Psetwapt
  25 .Fa "struct ps_prochandle *P"
  26 .Fa "const prwatch_t *wp"
  27 .Fc
  28 .Sh DESCRIPTION
  29 The
  30 .Fn Psetwapt
  31 function adds a watchpoint to the process handle
  32 .Fa P .
  33 Allowing the hardware to generate a trap when the specified area is
  34 accessed.
  35 The watchpoint's parameters are described in
  36 .Fa wp .
  37 For more information on watchpoints and the
  38 .Sy prwatch_t
  39 structure, see the
  40 .Sy PCWATCH
  41 section in
  42 .Xr proc 4 .
  43 The watched area will persist until a subsequent call to
  44 .Xr Pdelwapt 3PROC .
  45 .Pp
  46 Note, only active processes support watchpoints.
  47 It is an error to call this function on process handles that correspond to core
  48 files, zombie processes, or files.
  49 .Sh RETURN VALUES
  50 Upon successful completion, the
  51 .Fn Psetwapt
  52 function returns
  53 .Sy 0
  54 and installs the watchpoint in
  55 .Fa P .
  56 Otherwise,
  57 .Sy -1
  58 is returned and
  59 .Sy errno
  60 is set.
  61 .Sh ERRORS
  62 For a full list of possible errors see the
  63 .Sy DIAGNOSTICS
  64 section in
  65 .Xr proc 4 .
  66 .Pp
  67 The
  68 .Fn Psetwapt
  69 function will fail if:
  70 .Bl -tag -width Er
  71 .It Er ENOENT
  72 .Fa P
  73 does not refer to an active process.
  74 .El
  75 .Sh INTERFACE STABILITY
  76 .Sy Uncommitted
  77 .Sh MT-LEVEL
  78 See
  79 .Sy LOCKING
  80 in
  81 .Xr libproc 3LIB .
  82 .Sh SEE ALSO
  83 .Xr libproc 3LIB ,
  84 .Xr Pdelwapt 3PROC ,
  85 .Xr proc 4