PFAULT(3PROC) Process Control Library Functions PFAULT(3PROC)

Pfault
enable and disable the tracing of faults

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Pfault(struct ps_prochandle *P, int which, int stop);

The Pfault() function controls what the process P should do on faults.
A fault is a hardware event that occurs in the context of a running process and thread. A hardware fault may occur because an illegal instruction was executed, a breakpoint or watchpoint was encountered, or an arithmetic exception occurred, among others. The full list of faults is available in both proc(4) and <sys/fault.h>.
For each hardware fault, a process may be configured to stop the thread that encountered it when it occurs. The value of the stop parameter controls whether or not the listed fault in which will cause the thread to trap. A value of 1 indicates the thread should stop; a value of 0 indicates it should not.
The value of which indicates which hardware fault the change applies to. However, if the value of which is zero, then it applies to all faults.
The Pfault() function only applies to actively running processes. It does not function on handles that refer to core files, zombie processes, or ELF objects.

Upon successful completion, the Pfault() function returns the old disposition of the fault -- 0 if it was not set to stop and 1 if it was -- and the fault state is updated. Otherwise, -1 is returned, errno is updated with the error that occurred, and the fault state is not updated.

The Pfault() function will fail if:
 
 
The value of which is invalid, e.g. it is less than zero or greater than the largest defined fault.
 
 
The handle P refers to a process that is a zombie, a core file, or a file.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), proc(4)
May 11, 2016 illumos