2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2018 Nexenta Systems, Inc.
15 .Dt SET_CONSTRAINT_HANDLER_S 3C
18 .Nm set_constraint_handler_s ,
21 .Nd runtime-constraint handling
25 .Fd #define __STDC_WANT_LIB_EXT1__ 1
27 .Ft constraint_handler_t
28 .Fo set_constraint_handler_s
29 .Fa "constraint_handler_t handler"
33 .Fa "const char *restrict msg"
34 .Fa "void *restrict ptr"
39 .Fa "const char *restrict msg"
40 .Fa "void *restrict ptr"
45 .Fn set_constraint_handler_s
46 function sets the runtime-constraint handler to be
49 The runtime-constraint handler is the callback function invoked when a library
50 function detects a runtime-constraint violation, having the following prototype:
51 .Bd -literal -offset indent
52 void (*constraint_handler_t)(const char *restrict msg,
53 void *restrict ptr, errno_t error);
56 The arguments are as follows:
57 .Bl -tag -width "error"
59 A pointer to a character string describing the runtime-constraint violation.
65 If the function calling the handler has a return type declared as
67 the return value of the function is passed.
68 Otherwise, a positive value of type
73 Only the most recent handler registered with
74 .Fn set_constraint_handler_s
75 is called when a runtime-constraint violation occurs.
77 The implementation has a default constraint handler that is used if no calls to
79 .Fn set_constraint_handler_s
80 function have been made.
84 .Fn set_constraint_handler_s
87 pointer, the default handler becomes the current constraint handler.
93 are the standard-defined runtime-constraint handlers provided by the C library.
97 function writes the error message including the
106 is currently the default runtime-constraint handler.
110 simply returns to its caller.
113 .Fn set_constraint_handler_s
114 function returns a pointer to the previously registered handler, or
116 if none was previously registered.
120 function does not return to its caller.
124 function returns no value.
125 .Sh INTERFACE STABILITY
131 .Fn set_constraint_handler_s