1 PFAULT(3PROC)          Process Control Library Functions         PFAULT(3PROC)
   2 
   3 NAME
   4      Pfault - enable and disable the tracing of faults
   5 
   6 LIBRARY
   7      Process Control Library (libproc, -lproc)
   8 
   9 SYNOPSIS
  10      #include <libproc.h>
  11 
  12      int
  13      Pfault(struct ps_prochandle *P, int which, int stop);
  14 
  15 DESCRIPTION
  16      The Pfault() function controls what the process P should do on faults.
  17 
  18      A fault is a hardware event that occurs in the context of a running
  19      process and thread.  A hardware fault may occur because an illegal
  20      instruction was executed, a breakpoint or watchpoint was encountered, or
  21      an arithmetic exception occurred, among others.  The full list of faults
  22      is available in both proc(4) and <sys/fault.h>.
  23 
  24      For each hardware fault, a process may be configured to stop the thread
  25      that encountered it when it occurs.  The value of the stop parameter
  26      controls whether or not the listed fault in which will cause the thread
  27      to trap.  A value of 1 indicates the thread should stop; a value of 0
  28      indicates it should not.
  29 
  30      The value of which indicates which hardware fault the change applies to.
  31      However, if the value of which is zero, then it applies to all faults.
  32 
  33      The Pfault() function only applies to actively running processes.  It
  34      does not function on handles that refer to core files, zombie processes,
  35      or ELF objects.
  36 
  37 RETURN VALUES
  38      Upon successful completion, the Pfault() function returns the old
  39      disposition of the fault -- 0 if it was not set to stop and 1 if it was
  40      -- and the fault state is updated.  Otherwise, -1 is returned, errno is
  41      updated with the error that occurred, and the fault state is not updated.
  42 
  43 ERRORS
  44      The Pfault() function will fail if:
  45 
  46      EINVAL             The value of which is invalid, e.g. it is less than
  47                         zero or greater than the largest defined fault.
  48 
  49      ENOENT             The handle P refers to a process that is a zombie, a
  50                         core file, or a file.
  51 
  52 INTERFACE STABILITY
  53      Uncommitted
  54 
  55 MT-LEVEL
  56      See LOCKING in libproc(3LIB).
  57 
  58 SEE ALSO
  59      libproc(3LIB), proc(4)
  60 
  61 illumos                          May 11, 2016                          illumos