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
25 .Dt SET_CONSTRAINT_HANDLER_S 3
28 .Nm set_constraint_handler_s ,
31 .Nd runtime-constraint violation handling
35 .Fd #define __STDC_WANT_LIB_EXT1__ 1
37 .Ft constraint_handler_t
38 .Fo set_constraint_handler_s
39 .Fa "constraint_handler_t handler"
43 .Fo (*constraint_handler_t)
44 .Fa "const char * restrict msg"
45 .Fa "void * restrict ptr"
48 .Ss Predefined Handlers
51 .Fa "const char * restrict msg"
52 .Fa "void * restrict ptr"
57 .Fa "const char * restrict msg"
58 .Fa "void * restrict ptr"
63 .Fn set_constraint_handler_s
64 function sets the runtime-constraint violation handler to be
67 The runtime-constraint handler is the callback function invoked when a library
68 function detects a runtime-constraint violation.
70 The arguments are as follows:
71 .Bl -tag -width "error"
73 A pointer to a character string describing the runtime-constraint violation.
79 If the function calling the handler has a return type declared as
81 the return value of the function is passed.
82 Otherwise, a positive value of type
87 Only the most recent handler registered with
88 .Fn set_constraint_handler_s
89 is called when a runtime-constraint violation occurs.
91 The implementation has a default constraint handler that is used if no calls to
93 .Fn set_constraint_handler_s
94 function have been made.
98 .Fn set_constraint_handler_s
101 pointer, the default handler becomes the current constraint handler.
107 are the standard-defined runtime-constraint handlers provided by the C library.
111 function writes the error message including the
120 is currently the default runtime-constraint handler.
124 simply returns to its caller.
127 .Fn set_constraint_handler_s
128 function returns a pointer to the previously registered handler, or
130 if none was previously registered.
134 function does not return to its caller.
138 function returns no value.
141 .Fn set_constraint_handler_s
146 This manual page was written by
147 .An Yuri Pankov Aq Mt yuripv@yuripv.net .