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