/* * Will be called from the library startup code, * which always happens on the application's main thread. */ void __pthread_initialize(void) { __pthread_initialize_minimal(TDB_SIZE); struct nc_combined_tdb *tdb = (struct nc_combined_tdb *) nc_get_tdb(); nc_tdb_init(&tdb->tdb, &tdb->basic_data); __nc_initial_thread_id = &tdb->basic_data; __nc_initialize_globals(); }
void __uClibc_init(void) { /* Don't recurse */ if (__pagesize) return; /* Setup an initial value. This may not be perfect, but is * better than malloc using __pagesize=0 for atexit, ctors, etc. */ __pagesize = PAGE_SIZE; #ifdef __UCLIBC_HAS_THREADS__ /* Before we start initializing uClibc we have to call * __pthread_initialize_minimal so we can use pthread_locks * whenever they are needed. */ if (likely(__pthread_initialize_minimal!=NULL)) __pthread_initialize_minimal(); #endif #ifndef SHARED # ifdef __UCLIBC_HAS_SSP__ /* Set up the stack checker's canary. */ stack_chk_guard = _dl_setup_stack_chk_guard(); # ifdef THREAD_SET_STACK_GUARD THREAD_SET_STACK_GUARD (stack_chk_guard); # ifdef __UCLIBC_HAS_SSP_COMPAT__ __guard = stack_chk_guard; # endif # else __stack_chk_guard = stack_chk_guard; # if !defined __HAVE_SHARED__ && defined __UCLIBC_HAS_SSP_COMPAT__ __guard = stack_chk_guard; # endif # endif # endif #endif #ifdef __UCLIBC_HAS_LOCALE__ /* Initialize the global locale structure. */ if (likely(_locale_init!=NULL)) _locale_init(); #endif /* * Initialize stdio here. In the static library case, this will * be bypassed if not needed because of the weak alias above. * Thus we get a nice size savings because the stdio functions * won't be pulled into the final static binary unless used. */ if (likely(_stdio_init != NULL)) _stdio_init(); }
int __pthread_initialize() { /* all we need is to have the self pointer in the TDB */ return __pthread_initialize_minimal(sizeof(void*)); }