From 7e0e6a2581ab1d1bca602865b8e38dfa2f54424a Mon Sep 17 00:00:00 2001 From: millert <> Date: Mon, 3 Sep 2007 14:40:16 +0000 Subject: Add __cxa_atexit() support for gcc3. This provides support for shared object destructors called at dlclose() time. Inspired by similar changes in FreeBSD and NetBSD. --- src/lib/libc/stdlib/exit.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/lib/libc/stdlib/exit.c') diff --git a/src/lib/libc/stdlib/exit.c b/src/lib/libc/stdlib/exit.c index 90b7d5adc2..83fe3d2de5 100644 --- a/src/lib/libc/stdlib/exit.c +++ b/src/lib/libc/stdlib/exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exit.c,v 1.11 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: exit.c,v 1.12 2007/09/03 14:40:16 millert Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -50,20 +50,10 @@ int __isthreaded = 0; void exit(int status) { - struct atexit *p, *q; - int n, pgsize = getpagesize(); - - if (!__atexit_invalid) { - p = __atexit; - while (p != NULL) { - for (n = p->ind; --n >= 0;) - if (p->fns[n] != NULL) - (*p->fns[n])(); - q = p; - p = p->next; - munmap(q, pgsize); - } - } - /* cleanup, if registered, was called through fns[0] in the last page */ + /* + * Call functions registered by atexit() or _cxa_atexit() + * (including the stdio cleanup routine) and then _exit(). + */ + __cxa_finalize(NULL); _exit(status); } -- cgit v1.2.3-55-g6feb