]> git.saurik.com Git - apple/libc.git/blob - stdlib/FreeBSD/atexit.3.patch
Libc-763.13.tar.gz
[apple/libc.git] / stdlib / FreeBSD / atexit.3.patch
1 --- atexit.3.bsdnew 2009-11-13 14:11:47.000000000 -0800
2 +++ atexit.3 2009-11-13 14:11:47.000000000 -0800
3 @@ -32,46 +32,69 @@
4 .\" @(#)atexit.3 8.1 (Berkeley) 6/4/93
5 .\" $FreeBSD: src/lib/libc/stdlib/atexit.3,v 1.11 2007/01/09 00:28:09 imp Exp $
6 .\"
7 -.Dd September 6, 2002
8 +.Dd May 20, 2008
9 .Dt ATEXIT 3
10 .Os
11 .Sh NAME
12 .Nm atexit
13 .Nd register a function to be called on exit
14 -.Sh LIBRARY
15 -.Lb libc
16 .Sh SYNOPSIS
17 .In stdlib.h
18 .Ft int
19 -.Fn atexit "void (*function)(void)"
20 +.Fn atexit "void (*func)(void)"
21 +#ifdef UNIFDEF_BLOCKS
22 +.Ft int
23 +.Fn atexit_b "void (^block)(void)"
24 +#endif
25 .Sh DESCRIPTION
26 The
27 .Fn atexit
28 function
29 -registers the given
30 -.Fa function
31 +registers the function
32 +.Fa func
33 to be called at program exit, whether via
34 .Xr exit 3
35 or via return from the program's
36 .Fn main .
37 Functions so registered are called in reverse order;
38 no arguments are passed.
39 +#ifdef UNIFDEF_BLOCKS
40 +.Pp
41 +The
42 +.Fn atexit_b
43 +function is like
44 +.Fn atexit
45 +except the callback is a block pointer instead of a function pointer.
46 +.Bd -ragged -offset indent
47 +Note: The
48 +.Fn Block_copy
49 +function (defined in
50 +.In Blocks.h )
51 +is used by
52 +.Fn atexit_b
53 +to make a copy of the block, especially for the case when a stack-based
54 +block might go out of scope when the subroutine returns.
55 +.Ed
56 +#endif
57 .Pp
58 -These functions must not call
59 +These callbacks must not call
60 .Fn exit ;
61 if it should be necessary to terminate the process while in such a
62 function, the
63 .Xr _exit 2
64 function should be used.
65 -(Alternatively, the function may cause abnormal
66 +(Alternatively, the callbacks may cause abnormal
67 process termination, for example by calling
68 .Xr abort 3 . )
69 .Pp
70 -At least 32 functions can always be registered,
71 -and more are allowed as long as sufficient memory can be allocated.
72 +At least 32 callbacks can always be registered;
73 +more are allowed as long as sufficient memory can be allocated.
74 .\" XXX {ATEXIT_MAX} is not implemented yet
75 .Sh RETURN VALUES
76 -.Rv -std atexit
77 +#ifdef UNIFDEF_BLOCKS
78 +.ds ATEXIT_B atexit_b
79 +#endif
80 +.Rv -std atexit \*[ATEXIT_B]
81 .Sh ERRORS
82 .Bl -tag -width Er
83 .It Bq Er ENOMEM