2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2020-01-09 00:36:32 -07:00
|
|
|
#include <AK/Types.h>
|
|
|
|
|
#include <assert.h>
|
2020-08-12 01:58:50 +02:00
|
|
|
#include <sys/internals.h>
|
|
|
|
|
#include <unistd.h>
|
2020-01-09 00:36:32 -07:00
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
2020-10-10 17:48:27 +03:00
|
|
|
#ifdef NO_TLS
|
|
|
|
|
int errno;
|
|
|
|
|
#else
|
2020-01-09 00:36:32 -07:00
|
|
|
__thread int errno;
|
2020-10-10 17:48:27 +03:00
|
|
|
#endif
|
2020-01-09 00:36:32 -07:00
|
|
|
char** environ;
|
|
|
|
|
bool __environ_is_malloced;
|
2020-10-10 17:47:21 +03:00
|
|
|
bool __stdio_is_initialized;
|
2021-09-20 12:13:05 +03:00
|
|
|
void* __auxiliary_vector;
|
|
|
|
|
|
|
|
|
|
static void __auxiliary_vector_init();
|
2020-01-09 00:36:32 -07:00
|
|
|
|
|
|
|
|
void __libc_init()
|
|
|
|
|
{
|
2021-09-20 12:13:05 +03:00
|
|
|
__auxiliary_vector_init();
|
2020-01-09 00:36:32 -07:00
|
|
|
__malloc_init();
|
|
|
|
|
__stdio_init();
|
|
|
|
|
}
|
2021-09-20 12:13:05 +03:00
|
|
|
|
|
|
|
|
static void __auxiliary_vector_init()
|
|
|
|
|
{
|
|
|
|
|
char** env;
|
|
|
|
|
for (env = environ; *env; ++env) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__auxiliary_vector = (void*)++env;
|
|
|
|
|
}
|
2020-01-09 00:36:32 -07:00
|
|
|
}
|