|
|
1.1 root 1: .\" Copyright (c) 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" This code is derived from software contributed to Berkeley by
5: .\" Chris Torek.
6: .\"
7: .\" Redistribution and use in source and binary forms are permitted
8: .\" provided that: (1) source distributions retain this entire copyright
9: .\" notice and comment, and (2) distributions including binaries display
10: .\" the following acknowledgement: ``This product includes software
11: .\" developed by the University of California, Berkeley and its contributors''
12: .\" in the documentation or other materials provided with the distribution
13: .\" and in all advertising materials mentioning features or use of this
14: .\" software. Neither the name of the University nor the names of its
15: .\" contributors may be used to endorse or promote products derived
16: .\" from this software without specific prior written permission.
17: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18: .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20: .\"
21: .\" @(#)atexit.3 5.1 (Berkeley) 5/15/90
22: .\"
23: .TH ATEXIT 3 "May 15, 1990"
24: .UC 7
25: .SH NAME
26: atexit \- register a function to be called on exit
27: .SH SYNOPSIS
28: .B #include <stdlib.h>
29: .PP
30: .B "atexit(void (*function)())
31: .SH DESCRIPTION
32: .B Atexit
33: registers the given
34: .I function
35: to be called at program exit, whether via
36: .IR exit (3)
37: or via return from the program's
38: .BR main .
39: Functions so registered are called in reverse order;
40: no arguments are passed.
41: At least 32 functions can always be registered,
42: and more are allowed as long as sufficient memory can be allocated.
43: .SH RETURN VALUE
44: .B Atexit
45: returns 0 on success, \-1 on error.
46: .SH ERRORS
47: .TP
48: [ENOMEM]
49: No memory was available to add the function to the list.
50: The existing list of functions is unmodified.
51: .SH SEE ALSO
52: exit(3)
53: .SH STANDARDS
54: .B Atexit
55: conforms to ANSI X3.159-1989 (``ANSI C'').
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.