Removed team::_aspace_id since it already has a direct pointer to it.

Changed the way a vm_address_space is deleted: instead of having to explicitly
call vm_delete_aspace(), the last vm_put_aspace() will remove it.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9255 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-10-07 17:17:04 +00:00
parent 1a705b91b7
commit da504d877d
3 changed files with 14 additions and 16 deletions
+3 -3
View File
@@ -1090,7 +1090,7 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry)
sprintf(regionName, "%s_seg%drw", baseName, i);
id = vm_map_file(p->_aspace_id, regionName,
id = vm_map_file(p->aspace->id, regionName,
(void **)&regionAddress,
B_EXACT_ADDRESS,
fileUpperBound,
@@ -1137,7 +1137,7 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry)
*/
sprintf(regionName, "%s_seg%dro", baseName, i);
id = vm_map_file(p->_aspace_id, regionName,
id = vm_map_file(p->aspace->id, regionName,
(void **)&regionAddress,
B_EXACT_ADDRESS,
ROUNDUP(pheaders[i].p_memsz + (pheaders[i].p_vaddr % PAGE_SIZE), PAGE_SIZE),
@@ -1375,7 +1375,7 @@ load_kernel_add_on(const char *path)
done:
mutex_unlock(&sImageLoadMutex);
return image->id;
error5:
+10 -12
View File
@@ -1,5 +1,3 @@
/* Team functions */
/*
** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the Haiku License.
@@ -8,6 +6,8 @@
** Distributed under the terms of the NewOS License.
*/
/* Team functions */
#include <OS.h>
#include <team.h>
@@ -76,8 +76,7 @@ _dump_team_info(struct team *p)
dprintf("pending_signals: 0x%x\n", p->pending_signals);
dprintf("io_context: %p\n", p->io_context);
// dprintf("path: '%s'\n", p->path);
dprintf("aspace_id: 0x%lx\n", p->_aspace_id);
dprintf("aspace: %p\n", p->aspace);
dprintf("aspace: %p (id = %ld)\n", p->aspace, p->aspace->id);
dprintf("kaspace: %p\n", p->kaspace);
dprintf("main_thread: %p\n", p->main_thread);
dprintf("thread_list: %p\n", p->thread_list);
@@ -374,7 +373,6 @@ create_team_struct(const char *name, bool kernel)
strlcpy(team->name, name, B_OS_NAME_LENGTH);
team->num_threads = 0;
team->io_context = NULL;
team->_aspace_id = -1;
team->aspace = NULL;
team->kaspace = vm_get_kernel_aspace();
vm_put_aspace(team->kaspace);
@@ -454,8 +452,9 @@ team_delete_team(struct team *team)
}
// free team resources
ASSERT(team->aspace->ref_count == 1);
vm_put_aspace(team->aspace);
vm_delete_aspace(team->_aspace_id);
delete_owned_ports(team->id);
sem_delete_owned_sems(team->id);
remove_images(team);
@@ -668,12 +667,9 @@ team_create_team(const char *path, const char *name, char **args, int argc, char
}
// create an address space for this team
team->_aspace_id = vm_create_aspace(team->name, USER_BASE, USER_SIZE, false);
if (team->_aspace_id < 0) {
err = team->_aspace_id;
err = vm_create_aspace(team->name, USER_BASE, USER_SIZE, false, &team->aspace);
if (err < B_OK)
goto err3;
}
team->aspace = vm_get_aspace_by_id(team->_aspace_id);
// cut the path from the main thread name
threadName = strrchr(name, '/');
@@ -695,7 +691,6 @@ team_create_team(const char *path, const char *name, char **args, int argc, char
err4:
vm_put_aspace(team->aspace);
vm_delete_aspace(team->_aspace_id);
err3:
vfs_free_io_context(team->io_context);
err2:
@@ -756,6 +751,9 @@ exec_team(const char *path, int32 argCount, char **args, int32 envCount, char **
// sorry, we have to kill us, there is no way out anymore (without any areas left and all that)
exit_thread(status);
// we'll never make it here
return B_ERROR;
}
+1 -1
View File
@@ -738,7 +738,7 @@ thread_exit(void)
cancel_timer(&t->alarm);
// delete the user stack region first
if (team->_aspace_id >= 0 && t->user_stack_region_id >= 0) {
if (team->aspace != NULL && t->user_stack_region_id >= 0) {
region_id rid = t->user_stack_region_id;
t->user_stack_region_id = -1;
delete_area_etc(team, rid);