xref: /third_party/musl/src/internal/libc.h (revision 570af302)
1#ifndef LIBC_H
2#define LIBC_H
3
4#include <stdlib.h>
5#include <stdio.h>
6#include <limits.h>
7#include <link.h>
8#include <locale.h>
9
10struct __locale_map;
11
12struct __locale_struct {
13	const struct __locale_map *cat[LC_ALL];
14};
15
16struct tls_module {
17	struct tls_module *next;
18	void *image;
19	size_t len, size, align, offset;
20};
21
22struct __libc {
23	char can_do_threads;
24	char threaded;
25	char secure;
26	volatile signed char need_locks;
27	int threads_minus_1;
28	size_t *auxv;
29	struct tls_module *tls_head;
30	size_t tls_size, tls_align, tls_cnt;
31	size_t page_size;
32	struct __locale_struct global_locale;
33#ifdef ENABLE_HWASAN
34	void (*load_hook)(unsigned long int base, const Elf64_Phdr* phdr, int phnum);
35	void (*unload_hook)(unsigned long int base, const Elf64_Phdr* phdr, int phnum);
36#endif
37#ifdef __LITEOS_A__
38	int exit;
39#endif
40};
41
42#ifndef PAGE_SIZE
43#define PAGE_SIZE libc.page_size
44#endif
45
46extern hidden struct __libc __libc;
47#define libc __libc
48
49hidden void __init_libc(char **, char *);
50hidden void __init_tls(size_t *);
51hidden void __init_ssp(void *);
52hidden void __libc_start_init(void);
53hidden void __funcs_on_exit(void);
54hidden void __funcs_on_quick_exit(void);
55hidden void __libc_exit_fini(void);
56hidden void __fork_handler(int);
57#ifdef __LITEOS_A__
58hidden void __sig_init(void);
59hidden void arm_do_signal(int);
60#endif
61
62extern hidden size_t __hwcap;
63extern hidden size_t __sysinfo;
64extern char *__progname, *__progname_full;
65
66extern hidden const char __libc_version[];
67
68hidden void __synccall(void (*)(void *), void *);
69hidden int __setxid(int, int, int, int);
70
71#endif
72