Utcbs of exiting children are successfully unmapped from vfs via sys_shmdt

The shared memory addresses are returned back to their pools via the
deletion function of such objects. They don't get released via do_munmap().
This commit is contained in:
Bahadir Balban
2008-11-08 13:19:15 +02:00
parent 94daebd0c5
commit 5468c1833d
4 changed files with 11 additions and 9 deletions

View File

@@ -51,7 +51,7 @@ int sys_unmap(syscall_context_t *regs)
unsigned long npages = regs->r1;
unsigned int tid = regs->r2;
struct ktcb *target;
int ret, retval;
int ret = 0, retval = 0;
if (tid == current->tid)
target = current;

View File

@@ -83,6 +83,7 @@ int sys_fork(struct tcb *parent)
/* Create and prefault a utcb for child and map it to vfs task */
utcb_map_to_task(child, find_task(VFS_TID),
UTCB_NEW_ADDRESS | UTCB_NEW_SHM | UTCB_PREFAULT);
// printf("Mapped 0x%p to vfs as utcb of %d\n", child->utcb, child->tid);
/* We can now notify vfs about forked process */
vfs_notify_fork(child, parent);

View File

@@ -182,13 +182,13 @@ void shm_destroy_priv_data(struct vm_file *shm_file)
/* Release the shared memory address */
if ((unsigned long)shm_desc->shm_addr >= UTCB_AREA_START &&
(unsigned long)shm_desc->shm_addr < UTCB_AREA_END)
utcb_delete_address(shm_desc->shm_addr);
else if ((unsigned long)shm_desc->shm_addr >= SHM_AREA_START &&
(unsigned long)shm_desc->shm_addr < SHM_AREA_END)
shm_delete_address(shm_desc->shm_addr,
shm_file->vm_obj.npages);
else
(unsigned long)shm_desc->shm_addr < UTCB_AREA_END) {
BUG_ON(utcb_delete_address(shm_desc->shm_addr) < 0);
} else if ((unsigned long)shm_desc->shm_addr >= SHM_AREA_START &&
(unsigned long)shm_desc->shm_addr < SHM_AREA_END) {
BUG_ON(shm_delete_address(shm_desc->shm_addr,
shm_file->vm_obj.npages) < 0);
} else
BUG();
/* Release the shared memory id */

View File

@@ -12,6 +12,7 @@
#include <task.h>
#include <shm.h>
#include <vm_area.h>
#include <syscalls.h>
#include INC_GLUE(memlayout.h)
static struct address_pool utcb_vaddr_pool;
@@ -102,5 +103,5 @@ int utcb_map_to_task(struct tcb *owner, struct tcb *mapper, unsigned int flags)
int utcb_unmap_from_task(struct tcb *owner, struct tcb *mapper)
{
return 0;
return sys_shmdt(mapper, owner->utcb);
}