xref: /freebsd/lib/libc/stdlib/atexit.h (revision 662909a7800d5634772b89ca1509765dda837508)
1662909a7SPeter Wemm /*-
2662909a7SPeter Wemm  * Copyright (c) 1990, 1993
3662909a7SPeter Wemm  *	The Regents of the University of California.  All rights reserved.
4662909a7SPeter Wemm  *
5662909a7SPeter Wemm  * Redistribution and use in source and binary forms, with or without
6662909a7SPeter Wemm  * modification, are permitted provided that the following conditions
7662909a7SPeter Wemm  * are met:
8662909a7SPeter Wemm  * 1. Redistributions of source code must retain the above copyright
9662909a7SPeter Wemm  *    notice, this list of conditions and the following disclaimer.
10662909a7SPeter Wemm  * 2. Redistributions in binary form must reproduce the above copyright
11662909a7SPeter Wemm  *    notice, this list of conditions and the following disclaimer in the
12662909a7SPeter Wemm  *    documentation and/or other materials provided with the distribution.
13662909a7SPeter Wemm  * 3. All advertising materials mentioning features or use of this software
14662909a7SPeter Wemm  *    must display the following acknowledgement:
15662909a7SPeter Wemm  *	This product includes software developed by the University of
16662909a7SPeter Wemm  *	California, Berkeley and its contributors.
17662909a7SPeter Wemm  * 4. Neither the name of the University nor the names of its contributors
18662909a7SPeter Wemm  *    may be used to endorse or promote products derived from this software
19662909a7SPeter Wemm  *    without specific prior written permission.
20662909a7SPeter Wemm  *
21662909a7SPeter Wemm  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22662909a7SPeter Wemm  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23662909a7SPeter Wemm  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24662909a7SPeter Wemm  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25662909a7SPeter Wemm  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26662909a7SPeter Wemm  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27662909a7SPeter Wemm  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28662909a7SPeter Wemm  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29662909a7SPeter Wemm  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30662909a7SPeter Wemm  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31662909a7SPeter Wemm  * SUCH DAMAGE.
32662909a7SPeter Wemm  *
33662909a7SPeter Wemm  *	@(#)atexit.h	8.2 (Berkeley) 7/3/94
34662909a7SPeter Wemm  */
35662909a7SPeter Wemm 
36662909a7SPeter Wemm /* must be at least 32 to guarantee ANSI conformance */
37662909a7SPeter Wemm #define	ATEXIT_SIZE	32
38662909a7SPeter Wemm 
39662909a7SPeter Wemm struct atexit {
40662909a7SPeter Wemm 	struct atexit *next;		/* next in list */
41662909a7SPeter Wemm 	int ind;			/* next index in this table */
42662909a7SPeter Wemm 	void (*fns[ATEXIT_SIZE])();	/* the table itself */
43662909a7SPeter Wemm };
44662909a7SPeter Wemm 
45662909a7SPeter Wemm extern struct atexit *__atexit;	/* points to head of LIFO stack */
46