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 PSYSENTRY 3PROC
16.Os
17.Sh NAME
18.Nm Psysentry ,
19.Nm Psysexit
20.Nd set system call entry and exit actions
21.Sh LIBRARY
22.Lb libproc
23.Sh SYNOPSIS
24.In libproc.h
25.Ft int
26.Fo Psysentry
27.Fa "struct ps_prochandle *P"
28.Fa "int which"
29.Fa "int stop"
30.Fc
31.Ft int
32.Fo Psysexit
33.Fa "struct ps_prochandle *P"
34.Fa "int which"
35.Fa "int stop"
36.Fc
37.Sh DESCRIPTION
38The
39.Fn Psysentry
40and
41.Fn Psysexit
42functions controls what actions the process handle
43.Fa P
44should take upon executing a system call.
45.Pp
46The system allows a process to be stopped on both entry and exit of a
47system call.
48For information on the state of the process when it is stopped due to system
49call tracing, see the
50.Sy PCSENTRY
51and
52.Sy PCSEXIT
53sections of
54.Xr proc 5 .
55.Pp
56The value of the
57.Fa stop
58parameter controls whether or not the system call listed in
59.Fa which
60causes the process to stop.
61A value of non-zero indicates the process should stop;
62a value of 0 indicates it should not.
63.Pp
64The value of
65.Fa which
66indicates which system call the change applies to.
67A value of 0 applies to all system calls.
68Note, the system does not supply a stable mapping from system call names to
69identifiers.
70.Pp
71These functions only apply to actively running processes.
72They do not function on handles that refer to core files, zombie processes,
73or ELF objects.
74.Sh RETURN VALUES
75Upon successful completion, the
76.Fn Psysentry
77and
78.Fn Psysexit
79functions return the previous disposition of the system call --
80.Sy 0
81if it was not set to stop and
82.Sy 1
83if it was --
84and the system call state is updated.
85Otherwise,
86.Sy -1
87is returned,
88.Dv errno
89is updated with the error that occurred, and the system call state is
90not updated.
91.Sh ERRORS
92The
93.Fn Psysentry
94and
95.Fn Psysexit
96functions will fail if:
97.Bl -tag -width Er
98.It Er EINVAL
99The value of
100.Fa which
101is invalid, e.g. it is less than zero or greater than the largest defined
102system call.
103.It Er ENOENT
104The handle
105.Fa P
106refers to a process that is a zombie, a core file, or an ELF object.
107.El
108.Sh INTERFACE STABILITY
109.Sy Uncommitted
110.Pp
111Note, while the
112.Fn Psysentry
113and
114.Fn Psysexit
115functions are uncommitted, the mapping of system calls to system call
116numbers is
117.Sy Not-an-Interface
118and may change at any time.
119.Sh MT-LEVEL
120See
121.Sy LOCKING
122in
123.Xr libproc 3LIB .
124.Sh SEE ALSO
125.Xr libproc 3LIB ,
126.Xr proc 5 ,
127.Xr attributes 7
128