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