---
name: "abort_handler_s"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/abort_handler_s"
---

# abort\_handler\_s(3)

runtime-constraint violation handling

## NAME

**set\_constraint\_handler\_s**, **abort\_handler\_s**, **ignore\_handler\_s** – runtime-constraint violation handling

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#define \_\_STDC\_WANT\_LIB\_EXT1\_\_ 1**

**#include \<stdlib.h\>**

*constraint\_handler\_t*\

**set\_constraint\_handler\_s**(*constraint\_handler\_t handler*);

### Handler Prototype

*typedef* *void*\

**(\*constraint\_handler\_t)**(*const char \* restrict msg*, *void \* restrict ptr*, *errno\_t error*);

### Predefined Handlers

*void*\

**abort\_handler\_s**(*const char \* restrict msg*, *void \* restrict ptr*, *errno\_t error*);

*void*\

**ignore\_handler\_s**(*const char \* restrict msg*, *void \* restrict ptr*, *errno\_t error*);

## DESCRIPTION

The **set\_constraint\_handler\_s**() function sets the runtime-constraint violation handler to be *handler*.

The runtime-constraint handler is the callback function invoked when a library function detects a runtime-constraint violation.

The arguments are as follows:

- *msg*

  A pointer to a character string describing the runtime-constraint violation.

- *ptr*

  A NULL pointer.

- *error*

  If the function calling the handler has a return type declared as *errno\_t*, the return value of the function is passed. Otherwise, a positive value of type *errno\_t* is passed.

Only the most recent handler registered with **set\_constraint\_handler\_s**() is called when a runtime-constraint violation occurs.

The implementation has a default constraint handler that is used if no calls to the **set\_constraint\_handler\_s**() function have been made. If the *handler* argument to **set\_constraint\_handler\_s**() is a NULL pointer, the default handler becomes the current constraint handler.

The **abort\_handler\_s**() and **ignore\_handler\_s**() are the standard-defined runtime-constraint handlers provided by the C library.

The **abort\_handler\_s**() function writes the error message including the *msg* to stderr and calls the [abort(3)](/abort/3.md) function. The **abort\_handler\_s**() is currently the default runtime-constraint handler.

The **ignore\_handler\_s**() simply returns to its caller.

## RETURN VALUES

The **set\_constraint\_handler\_s**() function returns a pointer to the previously registered handler, or NULL if none was previously registered.

The **abort\_handler\_s**() function does not return to its caller.

The **ignore\_handler\_s**() function returns no value.

## STANDARDS

The **set\_constraint\_handler\_s**() function conforms to ISO/IEC 9899:2011 (“ISO C11”) K.3.6.1.1.

## AUTHORS

This manual page was written by Yuri Pankov ⟨*yuripv@yuripv.net*⟩.
