1 .\" Copyright 2018 Yuri Pankov <yuripv@yuripv.net>
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
13 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
16 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .Dt SET_CONSTRAINT_HANDLER_S 3
30 .Nm set_constraint_handler_s ,
33 .Nd runtime-constraint violation handling
37 .Fd #define __STDC_WANT_LIB_EXT1__ 1
39 .Ft constraint_handler_t
40 .Fo set_constraint_handler_s
41 .Fa "constraint_handler_t handler"
45 .Fo (*constraint_handler_t)
46 .Fa "const char * restrict msg"
47 .Fa "void * restrict ptr"
50 .Ss Predefined Handlers
53 .Fa "const char * restrict msg"
54 .Fa "void * restrict ptr"
59 .Fa "const char * restrict msg"
60 .Fa "void * restrict ptr"
65 .Fn set_constraint_handler_s
66 function sets the runtime-constraint violation handler to be
69 The runtime-constraint handler is the callback function invoked when a library
70 function detects a runtime-constraint violation.
72 The arguments are as follows:
73 .Bl -tag -width "error"
75 A pointer to a character string describing the runtime-constraint violation.
81 If the function calling the handler has a return type declared as
83 the return value of the function is passed.
84 Otherwise, a positive value of type
89 Only the most recent handler registered with
90 .Fn set_constraint_handler_s
91 is called when a runtime-constraint violation occurs.
93 The implementation has a default constraint handler that is used if no calls to
95 .Fn set_constraint_handler_s
96 function have been made.
100 .Fn set_constraint_handler_s
103 pointer, the default handler becomes the current constraint handler.
109 are the standard-defined runtime-constraint handlers provided by the C library.
113 function writes the error message including the
122 is currently the default runtime-constraint handler.
126 simply returns to its caller.
129 .Fn set_constraint_handler_s
130 function returns a pointer to the previously registered handler, or
132 if none was previously registered.
136 function does not return to its caller.
140 function returns no value.
143 .Fn set_constraint_handler_s
148 This manual page was written by
149 .An Yuri Pankov Aq Mt yuripv@yuripv.net .