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