1*61180Sbostic.\" Copyright (c) 1990, 1991, 1993 2*61180Sbostic.\" The Regents of the University of California. All rights reserved. 342098Sbostic.\" 442098Sbostic.\" This code is derived from software contributed to Berkeley by 550282Sbostic.\" Chris Torek and the American National Standards Committee X3, 650282Sbostic.\" on Information Processing Systems. 750282Sbostic.\" 842098Sbostic.\" %sccs.include.redist.man% 942098Sbostic.\" 10*61180Sbostic.\" @(#)atexit.3 8.1 (Berkeley) 06/04/93 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