* commit '67026112a00b94f9d13c3adea2ffbb4fb83d55c5': bionic: call stdio cleanup on exit
This commit is contained in:
commit
7a7429b4f7
@ -50,7 +50,6 @@ libc_common_src_files := \
|
||||
stdio/wbuf.c \
|
||||
stdlib/atexit.c \
|
||||
stdlib/ctype_.c \
|
||||
stdlib/exit.c \
|
||||
stdlib/getenv.c \
|
||||
stdlib/putenv.c \
|
||||
stdlib/setenv.c \
|
||||
@ -400,6 +399,7 @@ libc_upstream_netbsd_src_files := \
|
||||
upstream-netbsd/libc/stdlib/div.c \
|
||||
upstream-netbsd/libc/stdlib/drand48.c \
|
||||
upstream-netbsd/libc/stdlib/erand48.c \
|
||||
upstream-netbsd/libc/stdlib/exit.c \
|
||||
upstream-netbsd/libc/stdlib/jrand48.c \
|
||||
upstream-netbsd/libc/stdlib/ldiv.c \
|
||||
upstream-netbsd/libc/stdlib/lldiv.c \
|
||||
@ -416,6 +416,7 @@ libc_upstream_netbsd_src_files := \
|
||||
upstream-netbsd/libc/string/strcasestr.c \
|
||||
upstream-netbsd/libc/string/strcoll.c \
|
||||
upstream-netbsd/libc/string/strxfrm.c \
|
||||
upstream-netbsd/libc/thread-stub/__isthreaded.c \
|
||||
upstream-netbsd/libc/unistd/killpg.c \
|
||||
|
||||
# Architecture specific source files go here
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $OpenBSD: exit.c,v 1.12 2007/09/03 14:40:16 millert Exp $ */
|
||||
/* $NetBSD: exit.c,v 1.15 2011/05/18 19:36:36 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -28,21 +29,23 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)exit.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: exit.c,v 1.15 2011/05/18 19:36:36 dsl Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef _LIBC
|
||||
#include "reentrant.h"
|
||||
#include "atexit.h"
|
||||
#include "private/thread_private.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This variable is zero until a process has created a thread.
|
||||
* It is used to avoid calling locking functions in libc when they
|
||||
* are not required. By default, libc is intended to be(come)
|
||||
* thread-safe, but without a (significant) penalty to non-threaded
|
||||
* processes.
|
||||
*/
|
||||
int __isthreaded = 0;
|
||||
void (*__cleanup)(void);
|
||||
|
||||
/*
|
||||
* Exit, flushing stdio buffers if necessary.
|
||||
@ -50,10 +53,11 @@ int __isthreaded = 0;
|
||||
void
|
||||
exit(int status)
|
||||
{
|
||||
/*
|
||||
* Call functions registered by atexit() or _cxa_atexit()
|
||||
* (including the stdio cleanup routine) and then _exit().
|
||||
*/
|
||||
|
||||
#ifdef _LIBC
|
||||
__cxa_finalize(NULL);
|
||||
#endif
|
||||
if (__cleanup)
|
||||
(*__cleanup)();
|
||||
_exit(status);
|
||||
}
|
37
libc/upstream-netbsd/libc/thread-stub/__isthreaded.c
Normal file
37
libc/upstream-netbsd/libc/thread-stub/__isthreaded.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* $NetBSD: __isthreaded.c,v 1.3 2009/12/01 01:33:25 explorer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Michael Graff.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: __isthreaded.c,v 1.3 2009/12/01 01:33:25 explorer Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
int __isthreaded = 0;
|
Loading…
Reference in New Issue
Block a user