143051d27SRobert Mustacchi.\" 243051d27SRobert Mustacchi.\" This file and its contents are supplied under the terms of the 343051d27SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0. 443051d27SRobert Mustacchi.\" You may only use this file in accordance with the terms of version 543051d27SRobert Mustacchi.\" 1.0 of the CDDL. 643051d27SRobert Mustacchi.\" 743051d27SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this 843051d27SRobert Mustacchi.\" source. A copy of the CDDL is also available via the Internet at 943051d27SRobert Mustacchi.\" http://www.illumos.org/license/CDDL. 1043051d27SRobert Mustacchi.\" 1143051d27SRobert Mustacchi.\" 1243051d27SRobert Mustacchi.\" Copyright 2015 Joyent, Inc. 1343051d27SRobert Mustacchi.\" 1443051d27SRobert Mustacchi.Dd May 11, 2016 1543051d27SRobert Mustacchi.Dt PFAULT 3PROC 1643051d27SRobert Mustacchi.Os 1743051d27SRobert Mustacchi.Sh NAME 1843051d27SRobert Mustacchi.Nm Pfault 1943051d27SRobert Mustacchi.Nd enable and disable the tracing of faults 20ab618543SJohn Levon.Sh LIBRARY 2143051d27SRobert Mustacchi.Lb libproc 22ab618543SJohn Levon.Sh SYNOPSIS 2343051d27SRobert Mustacchi.In libproc.h 2443051d27SRobert Mustacchi.Ft "int" 2543051d27SRobert Mustacchi.Fo Pfault 2643051d27SRobert Mustacchi.Fa "struct ps_prochandle *P" 2743051d27SRobert Mustacchi.Fa "int which" 2843051d27SRobert Mustacchi.Fa "int stop" 2943051d27SRobert Mustacchi.Fc 3043051d27SRobert Mustacchi.Sh DESCRIPTION 3143051d27SRobert MustacchiThe 3243051d27SRobert Mustacchi.Fn Pfault 3343051d27SRobert Mustacchifunction controls what the process 3443051d27SRobert Mustacchi.Fa P 3543051d27SRobert Mustacchishould do on faults. 3643051d27SRobert Mustacchi.Pp 3743051d27SRobert MustacchiA fault is a hardware event that occurs in the context of a running 3872d3dbb9SYuri Pankovprocess and thread. 3972d3dbb9SYuri PankovA hardware fault may occur because an illegal instruction was executed, 4072d3dbb9SYuri Pankova breakpoint or watchpoint was encountered, or an arithmetic exception occurred, 4172d3dbb9SYuri Pankovamong others. 4272d3dbb9SYuri PankovThe full list of faults is available in both 43*bbf21555SRichard Lowe.Xr proc 5 4443051d27SRobert Mustacchiand 4543051d27SRobert Mustacchi.In sys/fault.h . 4643051d27SRobert Mustacchi.Pp 4743051d27SRobert MustacchiFor each hardware fault, a process may be configured to stop the thread 4872d3dbb9SYuri Pankovthat encountered it when it occurs. 4972d3dbb9SYuri PankovThe value of the 5043051d27SRobert Mustacchi.Fa stop 5143051d27SRobert Mustacchiparameter controls whether or not the listed fault in 5243051d27SRobert Mustacchi.Fa which 5372d3dbb9SYuri Pankovwill cause the thread to trap. 5472d3dbb9SYuri PankovA value of 1 indicates the thread should stop; a value of 0 indicates it should 5572d3dbb9SYuri Pankovnot. 5643051d27SRobert Mustacchi.Pp 5743051d27SRobert MustacchiThe value of 5843051d27SRobert Mustacchi.Fa which 5972d3dbb9SYuri Pankovindicates which hardware fault the change applies to. 6072d3dbb9SYuri PankovHowever, if the value of 6143051d27SRobert Mustacchi.Fa which 6243051d27SRobert Mustacchiis zero, then it applies to all faults. 6343051d27SRobert Mustacchi.Pp 6443051d27SRobert MustacchiThe 6543051d27SRobert Mustacchi.Fn Pfault 6672d3dbb9SYuri Pankovfunction only applies to actively running processes. 6772d3dbb9SYuri PankovIt does not function on handles that refer to core files, zombie processes, or 6872d3dbb9SYuri PankovELF objects. 6943051d27SRobert Mustacchi.Sh RETURN VALUES 7043051d27SRobert MustacchiUpon successful completion, the 7143051d27SRobert Mustacchi.Fn Pfault 7243051d27SRobert Mustacchifunction returns the old disposition of the fault -- 7343051d27SRobert Mustacchi.Sy 0 7443051d27SRobert Mustacchiif it was not set to stop and 7543051d27SRobert Mustacchi.Sy 1 7643051d27SRobert Mustacchiif it was -- 7772d3dbb9SYuri Pankovand the fault state is updated. 7872d3dbb9SYuri PankovOtherwise, 7943051d27SRobert Mustacchi.Sy -1 8043051d27SRobert Mustacchiis returned, 8143051d27SRobert Mustacchi.Dv errno 8243051d27SRobert Mustacchiis updated with the error that occurred, and the fault state is not 8343051d27SRobert Mustacchiupdated. 8443051d27SRobert Mustacchi.Sh ERRORS 8543051d27SRobert MustacchiThe 8643051d27SRobert Mustacchi.Fn Pfault 8743051d27SRobert Mustacchifunction will fail if: 8843051d27SRobert Mustacchi.Bl -tag -width Er 8943051d27SRobert Mustacchi.It Er EINVAL 9043051d27SRobert MustacchiThe value of 9143051d27SRobert Mustacchi.Fa which 9243051d27SRobert Mustacchiis invalid, e.g. it is less than zero or greater than the largest defined 9343051d27SRobert Mustacchifault. 9443051d27SRobert Mustacchi.It Er ENOENT 9543051d27SRobert MustacchiThe handle 9643051d27SRobert Mustacchi.Fa P 9743051d27SRobert Mustacchirefers to a process that is a zombie, a core file, or a file. 9843051d27SRobert Mustacchi.El 9943051d27SRobert Mustacchi.Sh INTERFACE STABILITY 10043051d27SRobert Mustacchi.Sy Uncommitted 10143051d27SRobert Mustacchi.Sh MT-LEVEL 10243051d27SRobert MustacchiSee 10343051d27SRobert Mustacchi.Sy LOCKING 10443051d27SRobert Mustacchiin 10543051d27SRobert Mustacchi.Xr libproc 3LIB . 10643051d27SRobert Mustacchi.Sh SEE ALSO 10743051d27SRobert Mustacchi.Xr libproc 3LIB , 108*bbf21555SRichard Lowe.Xr proc 5 109