xref: /illumos-gate/usr/src/man/man3c/quick_exit.3c (revision ea4c6b78cebe2a3687fa43deeedf6212a124d817)
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 3C
38that allows for registered functions to be called before terminating.
39Like
40.Xr _Exit 3C ,
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. Functions that are registered with
55.Fn at_quick_exit
56should not make use of
57.Xr longjump 3C
58and related functions.
59.Pp
60After calling all registered functions, the
61.Fn quick_exit
62function will terminate the calling program and its exit status will be
63.Fa status .
64.Sh RETURN VALUES
65The
66.Fn quick_exit
67function does not return.
68.Pp
69The
70.Fn at_quick_exit
71function returns
72.Sy 0
73on success. Otherwise, a non-zero error value is returned to indicate
74failure.
75.Sh ERRORS
76The
77.Fn at_quick_exit
78function may fail if:
79.Bl -tag -width Er
80.It Er ENOMEM
81Insufficient storage space is available.
82.El
83.Sh INTERFACE STABILITY
84.Sy Standard
85.Sh MT-LEVEL
86.Sy Safe
87.Sh SEE ALSO
88.Xr _Exit 3C ,
89.Xr atexit 3C ,
90.Xr exit 3C ,
91.Xr attributes 5 ,
92.Xr standards 5
93