示例#1
0
void
initialize_before(image_id imageID)
{
	char *programPath = __gRuntimeLoader->program_args->args[0];
	if (programPath) {
		if ((__progname = strrchr(programPath, '/')) == NULL)
			__progname = programPath;
		else
			__progname++;
	}

	__libc_argc = __gRuntimeLoader->program_args->arg_count;
	__libc_argv = __gRuntimeLoader->program_args->args;

	__gRuntimeLoader->call_atexit_hooks_for_range
		= _call_atexit_hooks_for_range;

	__init_exit_stack_lock();
	__init_time();
	__init_fork();
	__init_heap();
	__init_env(__gRuntimeLoader->program_args);
	__init_pwd_backend();
}
示例#2
0
void
initialize_before(image_id imageID)
{
	system_info info;
	char *programPath = __gRuntimeLoader->program_args->args[0];
	__gCommPageAddress = __gRuntimeLoader->commpage_address;
	__gABIVersion = __gRuntimeLoader->abi_version;

	if (programPath) {
		if ((__progname = strrchr(programPath, '/')) == NULL)
			__progname = programPath;
		else
			__progname++;
	}

	__libc_argc = __gRuntimeLoader->program_args->arg_count;
	__libc_argv = __gRuntimeLoader->program_args->args;

	__gRuntimeLoader->call_atexit_hooks_for_range
		= _call_atexit_hooks_for_range;

	if (__gRuntimeLoader->program_args->umask != (mode_t)-1)
		umask(__gRuntimeLoader->program_args->umask);

	pthread_self()->id = find_thread(NULL);

	get_system_info(&info);
	__gCPUCount = info.cpu_count;

	__init_time((addr_t)__gCommPageAddress);
	__init_heap();
	__init_env(__gRuntimeLoader->program_args);
	__init_heap_post_env();
	__init_pwd_backend();
	__set_stack_protection();
}