.\" -*- coding: UTF-8 -*- .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified 1993-03-29, David Metcalfe .\" Modified 1993-07-24, Rik Faith (faith@cs.unc.edu) .\" Modified 2003-10-25, Walter Harms .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH ATEXIT 3 "9. června 2020" Linux "Linux \- příručka programátora" .SH JMÉNO atexit \- registruje funkci, která se má vyvolat při ukončení procesu .SH POUŽITÍ .nf \fB#include \fP .PP \fBint atexit(void (*\fP\fIfunction\fP\fB)(void));\fP .fi .SH POPIS Funkce \fBatexit\fP() zařadí \fIfunction\fP do seznamu funkcí, které jsou vyvolány při normálním ukončení programu, ať už funkcí \fBexit\fP(3) nebo návratem z funkce \fBmain\fP. Funkce takto registrované jsou volány v obráceném pořadí jejich registrace; nejsou jim poskytnuty žádné argumenty. .PP The same function may be registered multiple times: it is called once for each registration. .PP .\" POSIX.1-2001, POSIX.1-2008 POSIX.1 vyžaduje, aby implementace dovolovala minimálně \fBATEXIT_MAX\fP(32) registrací takovýchto funkcí. Skutečný počet možných registrací podporovaných v dané implementaci je možné zjistit pomocí \fBsysconf\fP(3). .PP Při vytvoření procesu pomocí \fBfork\fP(2), zdědí potomek registrace svých rodičů. Při úspěšném volání funkce \fBexec\fP(3), jsou všechny registrace odstraněny. .SH "NÁVRATOVÉ HODNOTY" Funkce \fBatexit\fP() vrací hodnotu 0, byla\-li úspěšná, jinak je vrácena nenulová hodnota. .SH ATRIBUTY Vysvětlení pojmů použitých v této části viz \fBattributes\fP(7). .TS allbox; lb lb lb l l l. Rozhraní Atribut Hodnota T{ \fBatexit\fP() T} Thread safety MT\-Safe .TE .sp 1 .SH "SPLŇUJE STANDARDY" POSIX.1\-2001, POSIX.1\-2008, C89, C99, SVr4, 4.3BSD. .SH POZNÁMKY Funkce registrované pomocí \fBatexit\fP() (a \fBon_exit\fP(3)) nejsou volány, pokud je proces abnormálně ukončen, například kvůli doručení signálu. .PP If one of the registered functions calls \fB_exit\fP(2), then any remaining functions are not invoked, and the other process termination steps performed by \fBexit\fP(3) are not performed. .PP .\" POSIX.1-2001, POSIX.1-2008 .\" This can happen on OpenBSD 4.2 for example, and is documented .\" as occurring on FreeBSD as well. .\" Glibc does "the Right Thing" -- invocation of the remaining .\" exit handlers carries on as normal. POSIX.1 says that the result of calling \fBexit\fP(3) more than once (i.e., calling \fBexit\fP(3) within a function registered using \fBatexit\fP()) is undefined. On some systems (but not Linux), this can result in an infinite recursion; portable programs should not invoke \fBexit\fP(3) inside a function registered using \fBatexit\fP(). .PP The \fBatexit\fP() and \fBon_exit\fP(3) functions register functions on the same list: at normal process termination, the registered functions are invoked in reverse order of their registration by these two functions. .PP .\" In glibc, things seem to be handled okay According to POSIX.1, the result is undefined if \fBlongjmp\fP(3) is used to terminate execution of one of the functions registered using \fBatexit\fP(). .SS "Linuxová poznámka" Od verze glibc 2.2.3, mohou být \fBatexit\fP() (a \fBon_exit\fP(3)) použity uvnitř sdílených knihoven, aby spouštěly funkce, které jsou volány, je\-li knihovna uvolněna z paměti. .SH PŘÍKLADY .EX #include #include #include void bye(void) { printf("That was all, folks\en"); } int main(void) { long a; int i; a = sysconf(_SC_ATEXIT_MAX); printf("ATEXIT_MAX = %ld\en", a); i = atexit(bye); if (i != 0) { fprintf(stderr, "cannot set exit function\en"); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } .EE .SH "DALŠÍ INFORMACE" \fB_exit\fP(2), \fBdlopen\fP(3), \fBexit\fP(3), \fBon_exit\fP(3) .SH TIRÁŽ Tato stránka je součástí projektu Linux \fIman\-pages\fP v5.10. Popis projektu a informace o hlášení chyb najdete na \%https://www.kernel.org/doc/man\-pages/. .PP .SH PŘEKLAD Překlad této příručky do španělštiny vytvořili Pavel Heimlich . .PP Tento překlad je bezplatná dokumentace; Přečtěte si .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE nebo novější ohledně podmínek autorských práv. Neexistuje ŽÁDNÁ ODPOVĚDNOST. .PP Pokud narazíte na nějaké chyby v překladu této příručky, pošlete e-mail na adresu .MT translation-team-cs@lists.sourceforge.net .ME .