atexit(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

atexit(3c)

Standard C Library Functions                                        atexit(3C)



NAME
       atexit,  at_quick_exit - register a function to run at process termina‐
       tion or object unloading

SYNOPSIS
       #include <stdlib.h>

       int atexit(void (*func)(void));


       int at_quick_exit(void (*func)(void));

DESCRIPTION
       The atexit() function registers the function pointed to by func  to  be
       called  without  arguments on normal termination of the program or when
       the object defining the function is unloaded.


       Normal termination occurs by either a call to the exit(3C) function  or
       a   return  from  main().  Object  unloading  occurs  when  a  call  to
       dlclose(3C) results in the object becoming unreferenced.


       The at_quick_exit() function registers the function pointed to by func.
       That  function  is  then  called  without arguments if the quick_exit()
       function is called.


       An at_quick_exit() registered function is not called  when  the  object
       defining  the  function  is unloaded. Rather, it is simply removed from
       the at_quick_exit() registration list.


       The  at_quick_exit()  function  registrations  are  distinct  from  the
       atexit() registrations, so applications may need to call both registra‐
       tion functions with the same argument.


       The number of  functions  that  may  be  registered  with  atexit()  or
       at_quick_exit()  is  limited  only  by  available  memory (refer to the
       _SC_ATEXIT_MAX argument of sysconf(3C)).


       After a successful call to any of the exec(2) functions, any  functions
       previously registered by atexit() or at_quick_exit() are no longer reg‐
       istered.


       On process exit, functions are called in the  reverse  order  of  their
       registration.  On object unloading, any atexit() functions belonging to
       an unloadable object are called in the reverse order of their registra‐
       tion.

RETURN VALUES
       Upon  successful completion, the atexit() and at_quick_exit() functions
       return 0. Otherwise, they return a non-zero  value  and  set  errno  to
       indicate the reason.

ERRORS
       The atexit() and at_quick_exit() functions may fail if:

       ENOMEM    Insufficient storage space is available.


USAGE
       The  functions registered by a call to atexit() or at_quick_exit() must
       return to ensure that all registered functions are called.


       There is no way for an application to  tell  how  many  functions  have
       already been registered with atexit() or at_quick_exit().

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSafe _ Standard‐
       See standards(7).


NOTES
       The   at_quick_exit()   function  is  specified  in  the  C11  standard
       (INCITS/ISO/IEC 9899:2011).

SEE ALSO
       exec(2), dlclose(3C), exit(3C), sysconf(3C), attributes(7)



Oracle Solaris 11.4               11 Jun 2018                       atexit(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3