void __libc_init_common(uintptr_t *elfdata) { int argc = *elfdata; char** argv = (char**)(elfdata + 1); char** envp = argv + argc + 1; pthread_attr_t thread_attr; static pthread_internal_t thread; static void* tls_area[BIONIC_TLS_SLOTS]; /* setup pthread runtime and maint thread descriptor */ unsigned stacktop = (__get_sp() & ~(PAGE_SIZE - 1)) + PAGE_SIZE; unsigned stacksize = 128 * 1024; unsigned stackbottom = stacktop - stacksize; pthread_attr_init(&thread_attr); pthread_attr_setstack(&thread_attr, (void*)stackbottom, stacksize); _init_thread(&thread, gettid(), &thread_attr, (void*)stackbottom); __init_tls(tls_area, &thread); /* clear errno - requires TLS area */ errno = 0; /* set program name */ __progname = argv[0] ? argv[0] : "<unknown>"; /* setup environment pointer */ environ = envp; /* setup system properties - requires environment */ __system_properties_init(); }
int property_init() { int rc; rc = __system_properties_init(); if (rc) return -1; load_properties_from_file(PROP_PATH_SYSTEM_BUILD); load_persistent_properties(); }
void __libc_init_common(KernelArgumentBlock& args) { // Initialize various globals. environ = args.envp; errno = 0; __progname = args.argv[0] ? args.argv[0] : "<unknown>"; __abort_message_ptr = args.abort_message_ptr; // Get the main thread from TLS and add it to the thread list. pthread_internal_t* main_thread = __get_thread(); __pthread_internal_add(main_thread); __system_properties_init(); // Requires 'environ'. }
void __libc_init_common(KernelArgumentBlock& args) { // Initialize various globals. environ = args.envp; errno = 0; __progname = args.argv[0] ? args.argv[0] : "<unknown>"; __abort_message_ptr = args.abort_message_ptr; // AT_RANDOM is a pointer to 16 bytes of randomness on the stack. __stack_chk_guard = *reinterpret_cast<uintptr_t*>(getauxval(AT_RANDOM)); // Get the main thread from TLS and add it to the thread list. pthread_internal_t* main_thread = __get_thread(); __pthread_internal_add(main_thread); __system_properties_init(); // Requires 'environ'. }
void __libc_init_common(uintptr_t* elf_data) { int argc = *elf_data; char** argv = (char**) (elf_data + 1); char** envp = argv + argc + 1; // Get the main thread from TLS and add it to the thread list. pthread_internal_t* main_thread = __get_thread(); main_thread->allocated_on_heap = false; _pthread_internal_add(main_thread); // Set various globals. errno = 0; __progname = argv[0] ? argv[0] : "<unknown>"; environ = envp; __system_properties_init(); // Requires 'environ'. }