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:
@@ -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);
|
sprintf(regionName, "%s_seg%drw", baseName, i);
|
||||||
|
|
||||||
id = vm_map_file(p->_aspace_id, regionName,
|
id = vm_map_file(p->aspace->id, regionName,
|
||||||
(void **)®ionAddress,
|
(void **)®ionAddress,
|
||||||
B_EXACT_ADDRESS,
|
B_EXACT_ADDRESS,
|
||||||
fileUpperBound,
|
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);
|
sprintf(regionName, "%s_seg%dro", baseName, i);
|
||||||
|
|
||||||
id = vm_map_file(p->_aspace_id, regionName,
|
id = vm_map_file(p->aspace->id, regionName,
|
||||||
(void **)®ionAddress,
|
(void **)®ionAddress,
|
||||||
B_EXACT_ADDRESS,
|
B_EXACT_ADDRESS,
|
||||||
ROUNDUP(pheaders[i].p_memsz + (pheaders[i].p_vaddr % PAGE_SIZE), PAGE_SIZE),
|
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:
|
done:
|
||||||
mutex_unlock(&sImageLoadMutex);
|
mutex_unlock(&sImageLoadMutex);
|
||||||
|
|
||||||
return image->id;
|
return image->id;
|
||||||
|
|
||||||
error5:
|
error5:
|
||||||
|
|||||||
+10
-12
@@ -1,5 +1,3 @@
|
|||||||
/* Team functions */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Copyright 2002-2004, The Haiku Team. All rights reserved.
|
** Copyright 2002-2004, The Haiku Team. All rights reserved.
|
||||||
** Distributed under the terms of the Haiku License.
|
** Distributed under the terms of the Haiku License.
|
||||||
@@ -8,6 +6,8 @@
|
|||||||
** Distributed under the terms of the NewOS License.
|
** Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Team functions */
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
#include <team.h>
|
#include <team.h>
|
||||||
@@ -76,8 +76,7 @@ _dump_team_info(struct team *p)
|
|||||||
dprintf("pending_signals: 0x%x\n", p->pending_signals);
|
dprintf("pending_signals: 0x%x\n", p->pending_signals);
|
||||||
dprintf("io_context: %p\n", p->io_context);
|
dprintf("io_context: %p\n", p->io_context);
|
||||||
// dprintf("path: '%s'\n", p->path);
|
// dprintf("path: '%s'\n", p->path);
|
||||||
dprintf("aspace_id: 0x%lx\n", p->_aspace_id);
|
dprintf("aspace: %p (id = %ld)\n", p->aspace, p->aspace->id);
|
||||||
dprintf("aspace: %p\n", p->aspace);
|
|
||||||
dprintf("kaspace: %p\n", p->kaspace);
|
dprintf("kaspace: %p\n", p->kaspace);
|
||||||
dprintf("main_thread: %p\n", p->main_thread);
|
dprintf("main_thread: %p\n", p->main_thread);
|
||||||
dprintf("thread_list: %p\n", p->thread_list);
|
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);
|
strlcpy(team->name, name, B_OS_NAME_LENGTH);
|
||||||
team->num_threads = 0;
|
team->num_threads = 0;
|
||||||
team->io_context = NULL;
|
team->io_context = NULL;
|
||||||
team->_aspace_id = -1;
|
|
||||||
team->aspace = NULL;
|
team->aspace = NULL;
|
||||||
team->kaspace = vm_get_kernel_aspace();
|
team->kaspace = vm_get_kernel_aspace();
|
||||||
vm_put_aspace(team->kaspace);
|
vm_put_aspace(team->kaspace);
|
||||||
@@ -454,8 +452,9 @@ team_delete_team(struct team *team)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// free team resources
|
// free team resources
|
||||||
|
|
||||||
|
ASSERT(team->aspace->ref_count == 1);
|
||||||
vm_put_aspace(team->aspace);
|
vm_put_aspace(team->aspace);
|
||||||
vm_delete_aspace(team->_aspace_id);
|
|
||||||
delete_owned_ports(team->id);
|
delete_owned_ports(team->id);
|
||||||
sem_delete_owned_sems(team->id);
|
sem_delete_owned_sems(team->id);
|
||||||
remove_images(team);
|
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
|
// create an address space for this team
|
||||||
team->_aspace_id = vm_create_aspace(team->name, USER_BASE, USER_SIZE, false);
|
err = vm_create_aspace(team->name, USER_BASE, USER_SIZE, false, &team->aspace);
|
||||||
if (team->_aspace_id < 0) {
|
if (err < B_OK)
|
||||||
err = team->_aspace_id;
|
|
||||||
goto err3;
|
goto err3;
|
||||||
}
|
|
||||||
team->aspace = vm_get_aspace_by_id(team->_aspace_id);
|
|
||||||
|
|
||||||
// cut the path from the main thread name
|
// cut the path from the main thread name
|
||||||
threadName = strrchr(name, '/');
|
threadName = strrchr(name, '/');
|
||||||
@@ -695,7 +691,6 @@ team_create_team(const char *path, const char *name, char **args, int argc, char
|
|||||||
|
|
||||||
err4:
|
err4:
|
||||||
vm_put_aspace(team->aspace);
|
vm_put_aspace(team->aspace);
|
||||||
vm_delete_aspace(team->_aspace_id);
|
|
||||||
err3:
|
err3:
|
||||||
vfs_free_io_context(team->io_context);
|
vfs_free_io_context(team->io_context);
|
||||||
err2:
|
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)
|
// sorry, we have to kill us, there is no way out anymore (without any areas left and all that)
|
||||||
exit_thread(status);
|
exit_thread(status);
|
||||||
|
|
||||||
|
// we'll never make it here
|
||||||
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -738,7 +738,7 @@ thread_exit(void)
|
|||||||
cancel_timer(&t->alarm);
|
cancel_timer(&t->alarm);
|
||||||
|
|
||||||
// delete the user stack region first
|
// 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;
|
region_id rid = t->user_stack_region_id;
|
||||||
t->user_stack_region_id = -1;
|
t->user_stack_region_id = -1;
|
||||||
delete_area_etc(team, rid);
|
delete_area_etc(team, rid);
|
||||||
|
|||||||
Reference in New Issue
Block a user