xref: /csrg-svn/lib/libc/stdlib/atexit.3 (revision 50282)
148350Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California.
242098Sbostic.\" All rights reserved.
342098Sbostic.\"
442098Sbostic.\" This code is derived from software contributed to Berkeley by
5*50282Sbostic.\" Chris Torek and the American National Standards Committee X3,
6*50282Sbostic.\" on Information Processing Systems.
7*50282Sbostic.\"
842098Sbostic.\" %sccs.include.redist.man%
942098Sbostic.\"
10*50282Sbostic.\"     @(#)atexit.3	5.3 (Berkeley) 06/29/91
1142098Sbostic.\"
1248350Scael.Dd
1348350Scael.Dt ATEXIT 3
1448350Scael.Os
1548350Scael.Sh NAME
1648350Scael.Nm atexit
1748350Scael.Nd register a function to be called on exit
1848350Scael.Sh SYNOPSIS
1948350Scael.Fd #include <stdlib.h>
2048350Scael.Ft int
2148350Scael.Fn atexit "void (*function)(void)"
2248350Scael.Sh DESCRIPTION
2348350ScaelThe
2448350Scael.Fn atexit
2548350Scaelfunction
2642098Sbosticregisters the given
2748350Scael.Ar function
2842098Sbosticto be called at program exit, whether via
2948350Scael.Xr exit 3
3042098Sbosticor via return from the program's
3148350Scael.Em main .
3242098SbosticFunctions so registered are called in reverse order;
3342098Sbosticno arguments are passed.
3442098SbosticAt least 32 functions can always be registered,
3542098Sbosticand more are allowed as long as sufficient memory can be allocated.
3648350Scael.Sh RETURN VALUES
3748350Scael.Rv -std atexit
3848350Scael.Sh ERRORS
3948350Scael.Bl -tag -width [ENOMEM]
4048350Scael.It Bq Er ENOMEM
4142098SbosticNo memory was available to add the function to the list.
4242098SbosticThe existing list of functions is unmodified.
4348350Scael.El
4448350Scael.Sh SEE ALSO
4548350Scael.Xr exit 3
4648350Scael.Sh STANDARDS
4748350ScaelThe
4848350Scael.Fn atexit
4948350Scaelfunction
5048350Scaelconforms to
5148350Scael.St -ansiC .
52