master
1#ifndef LIBC_H
2#define LIBC_H
3
4#include <stdlib.h>
5#include <stdio.h>
6#include <limits.h>
7
8struct __locale_map;
9
10struct __locale_struct {
11 const struct __locale_map *cat[6];
12};
13
14struct tls_module {
15 struct tls_module *next;
16 void *image;
17 size_t len, size, align, offset;
18};
19
20struct __libc {
21#ifdef __wasilibc_unmodified_upstream
22 char can_do_threads;
23#endif
24#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
25 char threaded;
26#endif
27#ifdef __wasilibc_unmodified_upstream // WASI doesn't currently use any code that needs "secure" mode
28 char secure;
29#endif
30#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
31 volatile signed char need_locks;
32 int threads_minus_1;
33#endif
34#ifdef __wasilibc_unmodified_upstream // WASI has no auxv
35 size_t *auxv;
36#endif
37#ifdef __wasilibc_unmodified_upstream // WASI use different TLS implement
38 struct tls_module *tls_head;
39 size_t tls_size, tls_align, tls_cnt;
40#endif
41#ifdef __wasilibc_unmodified_upstream // WASI doesn't get the page size from auxv
42 size_t page_size;
43#endif
44 struct __locale_struct global_locale;
45#if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
46#else
47 struct __locale_struct *current_locale;
48#endif
49};
50
51#ifndef PAGE_SIZE
52#define PAGE_SIZE libc.page_size
53#endif
54
55extern hidden struct __libc __libc;
56#define libc __libc
57
58hidden void __init_libc(char **, char *);
59hidden void __init_tls(size_t *);
60hidden void __init_ssp(void *);
61hidden void __libc_start_init(void);
62hidden void __funcs_on_exit(void);
63hidden void __funcs_on_quick_exit(void);
64hidden void __libc_exit_fini(void);
65hidden void __fork_handler(int);
66
67extern hidden size_t __hwcap;
68extern hidden size_t __sysinfo;
69extern char *__progname, *__progname_full;
70
71extern hidden const char __libc_version[];
72
73hidden void __synccall(void (*)(void *), void *);
74hidden int __setxid(int, int, int, int);
75
76#endif