rem: free_strings_array(teamArgs->args, teamArgs->arg_count); free_strings_array(teamArgs->env, teamArgs->env_count);
add: TRACE(("team_create_thread_start: loading elf binary '%s'\n", path));
context: team_create_thread_start(void *args){	int err;	struct thread *t;	struct team *team;	struct team_arg *teamArgs = args;	char *path;	addr entry;	char ustack_name[128];	uint32 sizeLeft;	char **uargs;	char **uenv;	char *udest;	struct uspace_program_args *uspa;	uint32 argCount, envCount, i;	t = thread_get_current_thread();	team = t->team;	TRACE(("team_create_team2: entry thread %ld\n", t->id));	// create an initial primary stack region	// ToDo: make ENV_SIZE variable and put it on the heap?	// ToDo: we could reserve the whole USER_STACK_REGION upfront...	sizeLeft = PAGE_ALIGN(MAIN_THREAD_STACK_SIZE + TLS_SIZE + ENV_SIZE +		get_arguments_data_size(teamArgs->args, teamArgs->arg_count));	t->user_stack_base = USER_STACK_REGION + USER_STACK_REGION_SIZE - sizeLeft;	t->user_stack_size = MAIN_THREAD_STACK_SIZE;		// the exact location at the end of the user stack region	sprintf(ustack_name, "%s_main_stack", team->name);	t->user_stack_region_id = create_area_etc(team, ustack_name, (void **)&t->user_stack_base,		B_EXACT_ADDRESS, sizeLeft, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);	if (t->user_stack_region_id < 0) {		dprintf("team_create_team2: could not create default user stack region\n");		return t->user_stack_region_id;	}	// now that the TLS area is allocated, initialize TLS	arch_thread_init_tls(t);	argCount = teamArgs->arg_count;	envCount = teamArgs->env_count;	uspa = (struct uspace_program_args *)(t->user_stack_base + STACK_SIZE + TLS_SIZE + ENV_SIZE);	uargs = (char **)(uspa + 1);	udest = (char  *)(uargs + argCount + 1);	TRACE(("addr: stack base = 0x%lx, uargs = %p, udest = %p, sizeLeft = %lu\n",		t->user_stack_base, uargs, udest, sizeLeft));	for (i = 0; i < argCount; i++) {		ssize_t length = user_strlcpy(udest, teamArgs->args[i], sizeLeft) + 1;		uargs[i] = udest;		udest += length;		sizeLeft -= length;	}	uargs[argCount] = NULL;	team->user_env_base = t->user_stack_base + t->user_stack_size + TLS_SIZE;	uenv = (char **)team->user_env_base;	udest = (char *)team->user_env_base + ENV_SIZE - 1;	TRACE(("team_create_team2: envc: %d, envp: 0x%p\n", teamArgs->env_count, (void *)teamArgs->env));	for (i = 0; i < envCount; i++) {		ssize_t length = user_strlcpy(udest, teamArgs->env[i], sizeLeft) + 1;		uenv[i] = udest;		udest += length;		sizeLeft -= length;	}	uenv[envCount] = NULL;	user_memcpy(uspa->program_name, team->name, sizeof(uspa->program_name));	user_memcpy(uspa->program_path, teamArgs->path, sizeof(uspa->program_path));	uspa->argc = argCount;	uspa->argv = uargs;	uspa->envc = envCount;	uspa->envp = uenv;	free_strings_array(teamArgs->args, teamArgs->arg_count);	free_strings_array(teamArgs->env, teamArgs->env_count);	path = teamArgs->path;	TRACE(("team_create_team2: loading elf binary '%s'\n", path));	// ToDo: don't use fixed paths!	err = elf_load_user_image("/boot/beos/system/lib/rld.so", team, 0, &entry);	// free the args	free_team_arg(teamArgs);	if (err < 0) {		// Luckily, we don't have to clean up the mess we created - that's		// done for us by the normal team deletion process		return err;	}	TRACE(("team_create_team2: loaded elf. entry = 0x%lx\n", entry));	team->state = TEAM_STATE_NORMAL;	// jump to the entry point in user space	arch_thread_enter_uspace(t, entry, uspa, NULL);	// never gets here	return 0;}