xref: /illumos-gate/usr/src/man/man3c/quick_exit.3c (revision 94ddd0900a8838f62bba15e270649a42f4ef9f81)
1.\"
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
5.\" 1.0 of the CDDL.
6.\"
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.
10.\"
11.\"
12.\" Copyright 2016 Joyent, Inc.
13.\"
14.Dd "Mar 26, 2016"
15.Dt QUICK_EXIT 3C
16.Os
17.Sh NAME
18.Nm at_quick_exit ,
19.Nm quick_exit
20.Nd terminate a running process with minimal teardown
21.Sh SYNOPSIS
22.In stdlib.h
23.Ft int
24.Fo at_quick_exit
25.Fa "void (*func)(void)"
26.Fc
27.Ft _Noreturn void
28.Fo quick_exit
29.Fa "int status"
30.Fc
31.Sh DESCRIPTION
32The
33.Fn quick_exit
34and
35.Fn at_quick_exit
36functions provide a veneer around
37.Xr _Exit 2
38that allows for registered functions to be called before terminating.
39Like
40.Xr _Exit 2 ,
41standard library termination is not done.
42.Xr atexit 3C
43functions are not called and various standard termination that occurs
44when calling
45.Xr exit 3C
46may not occur.
47.Pp
48Functions that are registered with
49.Fn at_quick_exit
50will be called in reverse order upon calling
51.Fn quick_exit .
52Functions registered with
53.Fn at_quick_exit
54will not be called at any other time.
55Functions that are registered with
56.Fn at_quick_exit
57should not make use of
58.Xr longjmp 3C
59and related functions.
60.Pp
61After calling all registered functions, the
62.Fn quick_exit
63function will terminate the calling program and its exit status will be
64.Fa status .
65.Sh RETURN VALUES
66The
67.Fn quick_exit
68function does not return.
69.Pp
70The
71.Fn at_quick_exit
72function returns
73.Sy 0
74on success.
75Otherwise, a non-zero error value is returned to indicate failure.
76.Sh ERRORS
77The
78.Fn at_quick_exit
79function may fail if:
80.Bl -tag -width Er
81.It Er ENOMEM
82Insufficient storage space is available.
83.El
84.Sh INTERFACE STABILITY
85.Sy Standard
86.Sh MT-LEVEL
87.Sy Safe
88.Sh SEE ALSO
89.Xr _Exit 2 ,
90.Xr atexit 3C ,
91.Xr exit 3C ,
92.Xr attributes 5 ,
93.Xr standards 5
94