1 SET_CONSTRAINT_HANDLER_S(3C)                      Standard C Library Functions
   2 
   3 NAME
   4      set_constraint_handler_s, abort_handler_s, ignore_handler_s - runtime-
   5      constraint handling
   6 
   7 LIBRARY
   8      Standard C Library (libc, -lc)
   9 
  10 SYNOPSIS
  11      #define __STDC_WANT_LIB_EXT1__ 1
  12 
  13      #include <stdlib.h>
  14 
  15      constraint_handler_t
  16      set_constraint_handler_s(constraint_handler_t handler);
  17 
  18      void
  19      abort_handler_s(const char *restrict msg, void *restrict ptr,
  20          errno_t error);
  21 
  22      void
  23      ignore_handler_s(const char *restrict msg, void *restrict ptr,
  24          errno_t error);
  25 
  26 DESCRIPTION
  27      The set_constraint_handler_s() function sets the runtime-constraint
  28      handler to be handler.
  29 
  30      The runtime-constraint handler is the callback function invoked when a
  31      library function detects a runtime-constraint violation, having the
  32      following prototype:
  33 
  34            void (*constraint_handler_t)(const char *restrict msg,
  35                void *restrict ptr, errno_t error);
  36 
  37      The arguments are as follows:
  38 
  39      msg    A pointer to a character string describing the runtime-constraint
  40             violation.
  41 
  42      ptr    A NULL pointer.
  43 
  44      error  If the function calling the handler has a return type declared as
  45             errno_t, the return value of the function is passed.  Otherwise, a
  46             positive value of type errno_t is passed.
  47 
  48      Only the most recent handler registered with set_constraint_handler_s()
  49      is called when a runtime-constraint violation occurs.
  50 
  51      The implementation has a default constraint handler that is used if no
  52      calls to the set_constraint_handler_s() function have been made.  If the
  53      handler argument to set_constraint_handler_s() is a NULL pointer, the
  54      default handler becomes the current constraint handler.
  55 
  56      The abort_handler_s() and ignore_handler_s() are the standard-defined
  57      runtime-constraint handlers provided by the C library.
  58 
  59      The abort_handler_s() function writes the error message including the msg
  60      to stderr and calls the abort(3C) function.  The abort_handler_s() is
  61      currently the default runtime-constraint handler.
  62 
  63      The ignore_handler_s() simply returns to its caller.
  64 
  65 RETURN VALUES
  66      The set_constraint_handler_s() function returns a pointer to the
  67      previously registered handler, or NULL if none was previously registered.
  68 
  69      The abort_handler_s() function does not return to its caller.
  70 
  71      The ignore_handler_s() function returns no value.
  72 
  73 INTERFACE STABILITY
  74      Standard
  75 
  76 MT-LEVEL
  77      Safe
  78 
  79 STANDARDS
  80      The set_constraint_handler_s() function conforms to ISO/IEC 9899:2011
  81      ("ISO C11").
  82 
  83 illumos                         August 12, 2017                        illumos