1 /** 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef LIBC_H 17 #define LIBC_H 18 19 #include <stdlib.h> 20 #include <stdio.h> 21 #include <limits.h> 22 #include <locale.h> 23 struct __locale_map; 24 25 struct __locale_struct { 26 const struct __locale_map *cat[LC_ALL]; 27 }; 28 29 struct tls_module { 30 struct tls_module *next; 31 void *image; 32 size_t len, size, align, offset; 33 }; 34 35 struct __libc { 36 int can_do_threads; 37 int threaded; 38 int secure; 39 volatile int threads_minus_1; 40 size_t *auxv; 41 struct tls_module *tls_head; 42 size_t tls_size, tls_align, tls_cnt; 43 size_t page_size; 44 struct __locale_struct global_locale; 45 }; 46 47 #ifndef PAGE_SIZE 48 #define PAGE_SIZE libc.page_size 49 #endif 50 51 extern hidden struct __libc __libc; 52 #define libc __libc 53 54 hidden void __init_libc(char **, char *); 55 hidden void __init_tls(size_t *); 56 hidden void __init_ssp(void *); 57 hidden void __libc_start_init(void); 58 hidden void __funcs_on_exit(void); 59 hidden void __funcs_on_quick_exit(void); 60 hidden void __libc_exit_fini(void); 61 hidden void __fork_handler(int); 62 63 extern hidden size_t __hwcap; 64 extern hidden size_t __sysinfo; 65 extern char *__progname, *__progname_full; 66 67 extern hidden const char __libc_version[]; 68 69 hidden void __synccall(void (*)(void *), void *); 70 hidden int __setxid(int, int, int, int); 71 72 #endif 73