Serenity Operating System
1/*
2 * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include <AK/Types.h>
8#include <assert.h>
9#include <errno.h>
10#include <sys/internals.h>
11#include <unistd.h>
12
13extern "C" {
14
15#ifdef NO_TLS
16int errno_storage;
17#else
18__thread int errno_storage;
19#endif
20char** environ;
21bool __environ_is_malloced;
22bool __stdio_is_initialized;
23bool s_global_initializers_ran;
24void* __auxiliary_vector;
25
26static void __auxiliary_vector_init();
27
28int* __errno_location()
29{
30 return &errno_storage;
31}
32
33void __libc_init()
34{
35 __auxiliary_vector_init();
36 __malloc_init();
37 __stdio_init();
38}
39
40static void __auxiliary_vector_init()
41{
42 char** env;
43 for (env = environ; *env; ++env) {
44 }
45
46 __auxiliary_vector = (void*)++env;
47}
48}