team_create_team2() no longer panics if it couldn't create the userland
stack - it just fails now (since create_area() currently panics when it fails, this is a cosmetic change anyway :-)). Now correctly cleans up in case elf_load_user_image() fails. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -511,8 +511,7 @@ team_create_team2(void *args)
|
|||||||
// create an initial primary stack region
|
// create an initial primary stack region
|
||||||
|
|
||||||
// ToDo: make ENV_SIZE variable?
|
// ToDo: make ENV_SIZE variable?
|
||||||
// ToDo: when B_BASE_ADDRESS is implemented, we could just allocate the stack from
|
// ToDo: we could reserve the whole USER_STACK_REGION upfront...
|
||||||
// the bottom of the USER_STACK_REGION.
|
|
||||||
|
|
||||||
totalSize = PAGE_ALIGN(MAIN_THREAD_STACK_SIZE + TLS_SIZE + ENV_SIZE +
|
totalSize = PAGE_ALIGN(MAIN_THREAD_STACK_SIZE + TLS_SIZE + ENV_SIZE +
|
||||||
get_arguments_data_size(teamArgs->args, teamArgs->argc));
|
get_arguments_data_size(teamArgs->args, teamArgs->argc));
|
||||||
@@ -523,7 +522,7 @@ team_create_team2(void *args)
|
|||||||
t->user_stack_region_id = create_area_etc(team, ustack_name, (void **)&t->user_stack_base,
|
t->user_stack_region_id = create_area_etc(team, ustack_name, (void **)&t->user_stack_base,
|
||||||
B_EXACT_ADDRESS, totalSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
B_EXACT_ADDRESS, totalSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (t->user_stack_region_id < 0) {
|
if (t->user_stack_region_id < 0) {
|
||||||
panic("team_create_team2: could not create default user stack region\n");
|
dprintf("team_create_team2: could not create default user stack region\n");
|
||||||
return t->user_stack_region_id;
|
return t->user_stack_region_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,16 +569,19 @@ team_create_team2(void *args)
|
|||||||
path = teamArgs->path;
|
path = teamArgs->path;
|
||||||
TRACE(("team_create_team2: loading elf binary '%s'\n", 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);
|
err = elf_load_user_image("/boot/beos/system/lib/rld.so", team, 0, &entry);
|
||||||
if (err < 0) {
|
|
||||||
// XXX clean up team
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// free the args
|
// free the args
|
||||||
free(teamArgs->path);
|
free(teamArgs->path);
|
||||||
free(teamArgs);
|
free(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));
|
TRACE(("team_create_team2: loaded elf. entry = 0x%lx\n", entry));
|
||||||
|
|
||||||
team->state = TEAM_STATE_NORMAL;
|
team->state = TEAM_STATE_NORMAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user