initfini.c revision 1.7
11.7Stron/* 	$NetBSD: initfini.c,v 1.7 2010/11/14 18:11:42 tron Exp $	 */
21.1Sad
31.1Sad/*-
41.1Sad * Copyright (c) 2007 The NetBSD Foundation, Inc.
51.1Sad * All rights reserved.
61.1Sad *
71.1Sad * This code is derived from software contributed to The NetBSD Foundation
81.1Sad * by Andrew Doran.
91.1Sad *
101.1Sad * Redistribution and use in source and binary forms, with or without
111.1Sad * modification, are permitted provided that the following conditions
121.1Sad * are met:
131.1Sad * 1. Redistributions of source code must retain the above copyright
141.1Sad *    notice, this list of conditions and the following disclaimer.
151.1Sad * 2. Redistributions in binary form must reproduce the above copyright
161.1Sad *    notice, this list of conditions and the following disclaimer in the
171.1Sad *    documentation and/or other materials provided with the distribution.
181.1Sad *
191.1Sad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Sad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Sad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Sad * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Sad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Sad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Sad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Sad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Sad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Sad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Sad * POSSIBILITY OF SUCH DAMAGE.
301.1Sad */
311.1Sad
321.2Sad#include <sys/cdefs.h>
331.7Stron__RCSID("$NetBSD: initfini.c,v 1.7 2010/11/14 18:11:42 tron Exp $");
341.2Sad
351.2Sad#ifdef _LIBC
361.2Sad#include "namespace.h"
371.2Sad#endif
381.2Sad
391.6Sjoergvoid	__libc_init(void) __attribute__((__constructor__, __used__));
401.1Sad
411.1Sadvoid	__guard_setup(void);
421.1Sadvoid	__libc_thr_init(void);
431.3Sadvoid	__libc_atomic_init(void);
441.4Sxtraemevoid	__libc_atexit_init(void);
451.7Stronvoid	__libc_env_init(void);
461.1Sad
471.2Sad/* LINTED used */
481.6Sjoergvoid
491.1Sad__libc_init(void)
501.1Sad{
511.1Sad
521.1Sad	/* For -fstack-protector */
531.1Sad	__guard_setup();
541.1Sad
551.3Sad	/* Atomic operations */
561.3Sad	__libc_atomic_init();
571.3Sad
581.1Sad	/* Threads */
591.1Sad	__libc_thr_init();
601.4Sxtraeme
611.4Sxtraeme	/* Initialize the atexit mutexes */
621.4Sxtraeme	__libc_atexit_init();
631.7Stron
641.7Stron	/* Initialize environment memory RB tree. */
651.7Stron	__libc_env_init();
661.1Sad}
67