usr/src/lib/libsigsegv/sigsegv_register.3
changeset 0 b34509ac961f
child 11 87960ed158f9
equal deleted inserted replaced
-1:000000000000 0:b34509ac961f
       
     1 '\" te
       
     2 .\"
       
     3 .\" CDDL HEADER START
       
     4 .\"
       
     5 .\" The contents of this file are subject to the terms of the
       
     6 .\" Common Development and Distribution License (the "License").
       
     7 .\" You may not use this file except in compliance with the License.
       
     8 .\"
       
     9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
    10 .\" or http://www.opensolaris.org/os/licensing.
       
    11 .\" See the License for the specific language governing permissions
       
    12 .\" and limitations under the License.
       
    13 .\"
       
    14 .\" When distributing Covered Code, include this CDDL HEADER in each
       
    15 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    16 .\" If applicable, add the following below this CDDL HEADER, with the
       
    17 .\" fields enclosed by brackets "[]" replaced with your own identifying
       
    18 .\" information: Portions Copyright [yyyy] [name of copyright owner]
       
    19 .\"
       
    20 .\" CDDL HEADER END
       
    21 .\"
       
    22 .\" Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
       
    23 .\" Use is subject to license terms.
       
    24 .\"
       
    25 .\" ident	"@(#)sigsegv_register.3	1.1	09/03/05 SMI"
       
    26 .\"
       
    27 .TH sigsegv_register 3 "13 Jan 2009" "SunOS 5.11"
       
    28 .SH NAME
       
    29 sigsegv_init, sigsegv_register, sigsegv_unregister, sigsegv_dispatch \- LOCAL SIGSEGV HANDLERS
       
    30 .SH SYNOPSIS
       
    31 #include <\fBsigsegv.h\fR>
       
    32 .sp
       
    33 void \fBsigsegv_init\fR (\fIsigsegv_dispatcher* dispatcher\fR);
       
    34 .sp
       
    35 void* \fBsigsegv_register\fR (\fIsigsegv_dispatcher* dispatcher\fR,
       
    36 .RS +24
       
    37 \fIvoid* address\fR, \fIunsigned long len\fR,
       
    38 \fIsigsegv_area_handler_t handler\fR,
       
    39 \fIvoid* handler_arg\fR);
       
    40 .RE
       
    41 .sp
       
    42 void \fBsigsegv_unregister\fR (\fIsigsegv_dispatcher* dispatcher\fR,
       
    43 .RS +25
       
    44 \fIvoid* ticket\fR);
       
    45 .RE
       
    46 .sp
       
    47 int \fBsigsegv_dispatch\fR (\fIsigsegv_dispatcher* dispatcher\fR,
       
    48 .RS +22
       
    49 \fIvoid* fault_address\fR);
       
    50 .RE
       
    51 .sp
       
    52 .SH DESCRIPTION
       
    53 .sp
       
    54 .LP
       
    55 The set of functions permit to define different \fBSIGSEGV\fR policies on different address ranges.
       
    56 .sp
       
    57 .LP
       
    58 \fBSigsegv_init\fR initializes a sigsegv_dispatcher structure.
       
    59 .sp
       
    60 .LP
       
    61 \fBSigsegv_register\fR adds a local SIGSEGV handler to a sigsegv_dispatcher structure. It will cover the interval [address..address+len-1]. Returns a "ticket" that can be used to remove the handler later.
       
    62 .sp
       
    63 .LP
       
    64 \fBSigsegv_unregister\fR removes a local SIGSEGV handler.
       
    65 .sp
       
    66 .LP
       
    67 \fBSigsegv_dispatch\fR call the local SIGSEGV handler responsible for the given fault address. Return the handler's return value. 0 means that no handler has been found, or that a handler was found but declined responsibility.
       
    68 .sp
       
    69 
       
    70 .SH OPERANDS
       
    71 .sp
       
    72 .LP
       
    73 typedef struct \fBsigsegv_dispatcher\fR {
       
    74 .RS +5
       
    75 void* tree;
       
    76 .RE
       
    77 }sigsegv_dispatcher;
       
    78 .sp
       
    79 .LP
       
    80 \fISigsegv_dispatcher\fR represents a table of memory areas (address range intervals), with an local SIGSEGV handler for each.
       
    81 .sp
       
    82 .LP
       
    83 The \fIaddress\fR represents the address of the memory area, and the \fIlen\fR represents the length of the memory area.
       
    84 .sp
       
    85 .LP
       
    86 typedef int (*\fBsigsegv_area_handler_t\fR) (\fIvoid* fault_address,\fR
       
    87 .RS +39
       
    88 \fIvoid* user_arg\fR);
       
    89 .RE
       
    90 .sp
       
    91 \fIsigsegv_area_handler_t\fR is the type of a local SIGSEGV handler. The fault address is passed as argument. The second argument is fixed arbitrary user data. The return value should be nonzero if the handler has done its job and no other handler should be called, or 0 if the handler declines responsibility for the given address.
       
    92 .sp
       
    93 .LP
       
    94 The \fIhandler_arg\fR is the second argument of the \fBsigsegv_area_handler_t\fR.
       
    95 .sp
       
    96 .SH EXIT STATUS
       
    97 .sp
       
    98 .LP
       
    99 Sigsegv_dispatcher returns the handler's return value. 0 means that no handler has been found, or that a handler was found but declined responsibility.
       
   100 .sp
       
   101 .SH ATTRIBUTES
       
   102 See
       
   103 .BR attributes(5)
       
   104 for descriptions of the  following  attributes:
       
   105 .sp
       
   106 .TS
       
   107 tab() box;
       
   108 cw(2.75i) |cw(2.75i) 
       
   109 lw(2.75i) |lw(2.75i) 
       
   110 .
       
   111 ATTRIBUTE TYPEATTRIBUTE VALUE
       
   112 _
       
   113 AvailabilitySUNWlibsigsegv
       
   114 _
       
   115 Interface StabilityUncommitted
       
   116 _
       
   117 StandardSee \fBstandards\fR(5).
       
   118 .TE
       
   119 
       
   120 .SH SEE ALSO
       
   121 .sp
       
   122 .LP
       
   123 \fBattributes\fR(5), \fBsigsegv\fR(3), \fBstandards\fR(5)
       
   124 
       
   125 .SH NOTES
       
   126 The libsigsegv project is located at http://libsigsegv.sourceforge.net.
       
   127 .sp
       
   128 Source for libsigsegv is available on http://opensolaris.org.