1570af302Sopenharmony_ci/** 2570af302Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3570af302Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4570af302Sopenharmony_ci * you may not use this file except in compliance with the License. 5570af302Sopenharmony_ci * You may obtain a copy of the License at 6570af302Sopenharmony_ci * 7570af302Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8570af302Sopenharmony_ci * 9570af302Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10570af302Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11570af302Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12570af302Sopenharmony_ci * See the License for the specific language governing permissions and 13570af302Sopenharmony_ci * limitations under the License. 14570af302Sopenharmony_ci */ 15570af302Sopenharmony_ci 16570af302Sopenharmony_ci#ifndef LIBC_H 17570af302Sopenharmony_ci#define LIBC_H 18570af302Sopenharmony_ci 19570af302Sopenharmony_ci#include <stdlib.h> 20570af302Sopenharmony_ci#include <stdio.h> 21570af302Sopenharmony_ci#include <limits.h> 22570af302Sopenharmony_ci#include <link.h> 23570af302Sopenharmony_ci#include <locale.h> 24570af302Sopenharmony_cistruct __locale_map; 25570af302Sopenharmony_ci 26570af302Sopenharmony_cistruct __locale_struct { 27570af302Sopenharmony_ci const struct __locale_map *cat[LC_ALL]; 28570af302Sopenharmony_ci}; 29570af302Sopenharmony_ci 30570af302Sopenharmony_cistruct tls_module { 31570af302Sopenharmony_ci struct tls_module *next; 32570af302Sopenharmony_ci void *image; 33570af302Sopenharmony_ci size_t len, size, align, offset; 34570af302Sopenharmony_ci}; 35570af302Sopenharmony_ci 36570af302Sopenharmony_cistruct __libc { 37570af302Sopenharmony_ci char can_do_threads; 38570af302Sopenharmony_ci char threaded; 39570af302Sopenharmony_ci char secure; 40570af302Sopenharmony_ci volatile signed char need_locks; 41570af302Sopenharmony_ci int threads_minus_1; 42570af302Sopenharmony_ci size_t *auxv; 43570af302Sopenharmony_ci struct tls_module *tls_head; 44570af302Sopenharmony_ci size_t tls_size, tls_align, tls_cnt; 45570af302Sopenharmony_ci size_t page_size; 46570af302Sopenharmony_ci struct __locale_struct global_locale; 47570af302Sopenharmony_ci#ifdef ENABLE_HWASAN 48570af302Sopenharmony_ci void (*load_hook)(unsigned long int base, const Elf64_Phdr* phdr, int phnum); 49570af302Sopenharmony_ci void (*unload_hook)(unsigned long int base, const Elf64_Phdr* phdr, int phnum); 50570af302Sopenharmony_ci#endif 51570af302Sopenharmony_ci}; 52570af302Sopenharmony_ci 53570af302Sopenharmony_ci#ifndef PAGE_SIZE 54570af302Sopenharmony_ci#define PAGE_SIZE libc.page_size 55570af302Sopenharmony_ci#endif 56570af302Sopenharmony_ci 57570af302Sopenharmony_ciextern hidden struct __libc __libc; 58570af302Sopenharmony_ci#define libc __libc 59570af302Sopenharmony_ci 60570af302Sopenharmony_cihidden void __init_libc(char **, char *); 61570af302Sopenharmony_cihidden void __init_tls(size_t *); 62570af302Sopenharmony_cihidden void __init_ssp(void *); 63570af302Sopenharmony_cihidden void __libc_start_init(void); 64570af302Sopenharmony_cihidden void __funcs_on_exit(void); 65570af302Sopenharmony_cihidden void __funcs_on_quick_exit(void); 66570af302Sopenharmony_cihidden void __libc_exit_fini(void); 67570af302Sopenharmony_cihidden void __fork_handler(int); 68570af302Sopenharmony_ci 69570af302Sopenharmony_ciextern hidden size_t __hwcap; 70570af302Sopenharmony_ciextern hidden size_t __sysinfo; 71570af302Sopenharmony_ciextern char *__progname, *__progname_full; 72570af302Sopenharmony_ci 73570af302Sopenharmony_ciextern hidden const char __libc_version[]; 74570af302Sopenharmony_ci 75570af302Sopenharmony_cihidden void __synccall(void (*)(void *), void *); 76570af302Sopenharmony_cihidden int __setxid(int, int, int, int); 77570af302Sopenharmony_ci 78570af302Sopenharmony_ci#endif 79