Date: Sat, 10 Nov 2001 17:15:03 -0800 (PST) From: rfg@monkeys.com To: FreeBSD-gnats-submit@freebsd.org Subject: bin/31906: No method available to unwind atexit(3) stack without exiting Message-ID: <20011111011503.862796399@segfault.monkeys.com>
next in thread | raw e-mail | index | archive | help
>Number: 31906 >Category: bin >Synopsis: No method available to unwind atexit(3) stack without exiting >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Nov 10 17:20:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Ronald F. Guilmette >Release: FreeBSD 4.3-RELEASE i386 >Organization: Infinite Monkeys & Co. >Environment: System: FreeBSD segfault.monkeys.com 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Wed Aug 1 16:51:35 PDT 2001 root@:/usr/src/sys/compile/rfg20010801 i386 >Description: C programs are typically exited via a call to exit(3) however it it frequently useful to replace a running program image via a call to one of the exec*() family functions, rather than exiting the program via a call to exit(3). Unfortunately, when exiting a program via a call to one of the exec* functions, there is no obvious way to `unwind' the stack of program finalization actions that have been built up, during program execution, via successive calls to the atexit(3) function. Likewise there is no easy way to insure that all open streams are properly flushed (as would happen if exit(3) were called) prior to a call to one of the exec* functions. Ideally, there should be some standard C library function available that could be called, prior to a call to one of the exec* functions, that would invoke the set of pending atexit(3) finalization actions, and that would also flush all open streams. In effect, what I am requesting is a C library entry point that would invoke the following code, copied from the current exit(3) implementation: for (p = __atexit; p; p = p->next) for (n = p->ind; --n >= 0;) (*p->fns[n])(); if (__cleanup) (*__cleanup)(); >How-To-Repeat: This is a C library enhancement request. There is nothing to repeat. >Fix: Move the code shown above (from the exit(3) implementation) into its own function, make that function accessible via the standard C library interface, and make the implementation of exit(3) call the new function rather than having the code inline. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011111011503.862796399>