Merge commit 'b31ca922c7346747131aed07c0c171ec2f573aac' into merges
[unleashed.git] / share / man / man3c / quick_exit.3c
blob6d39cc66f6297d2121194ce2a7ce06f0f366eaf3
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
32 The
33 .Fn quick_exit
34 and
35 .Fn at_quick_exit
36 functions provide a veneer around
37 .Xr _Exit 2
38 that allows for registered functions to be called before terminating.
39 Like
40 .Xr _Exit 2 ,
41 standard library termination is not done.
42 .Xr atexit 3C
43 functions are not called and various standard termination that occurs
44 when calling
45 .Xr exit 3C
46 may not occur.
47 .Pp
48 Functions that are registered with
49 .Fn at_quick_exit
50 will be called in reverse order upon calling
51 .Fn quick_exit .
52 Functions registered with
53 .Fn at_quick_exit
54 will not be called at any other time.
55 Functions that are registered with
56 .Fn at_quick_exit
57 should not make use of
58 .Xr longjmp 3C
59 and related functions.
60 .Pp
61 After calling all registered functions, the
62 .Fn quick_exit
63 function will terminate the calling program and its exit status will be
64 .Fa status .
65 .Sh RETURN VALUES
66 The
67 .Fn quick_exit
68 function does not return.
69 .Pp
70 The
71 .Fn at_quick_exit
72 function returns
73 .Sy 0
74 on success.
75 Otherwise, a non-zero error value is returned to indicate failure.
76 .Sh ERRORS
77 The
78 .Fn at_quick_exit
79 function may fail if:
80 .Bl -tag -width Er
81 .It Er ENOMEM
82 Insufficient 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