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