Now uses the file name to build the area name, and not the full path anymore.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9707 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-11-01 15:24:39 +00:00
parent e4211d820c
commit de0807a907
1 changed files with 11 additions and 3 deletions

View File

@ -1173,6 +1173,7 @@ load_kernel_add_on(const char *path)
struct Elf32_Ehdr *eheader; struct Elf32_Ehdr *eheader;
struct Elf32_Phdr *pheaders; struct Elf32_Phdr *pheaders;
struct elf_image_info *image; struct elf_image_info *image;
const char *fileName;
void *vnode = NULL; void *vnode = NULL;
void *reservedAddress; void *reservedAddress;
addr_t start; addr_t start;
@ -1192,6 +1193,13 @@ load_kernel_add_on(const char *path)
if (err < 0) if (err < 0)
goto error0; goto error0;
// get the file name
fileName = strrchr(path, '/');
if (fileName == NULL)
fileName = path;
else
fileName++;
// XXX awful hack to keep someone else from trying to load this image // XXX awful hack to keep someone else from trying to load this image
// probably not a bad thing, shouldn't be too many races // probably not a bad thing, shouldn't be too many races
mutex_lock(&sImageLoadMutex); mutex_lock(&sImageLoadMutex);
@ -1298,7 +1306,7 @@ load_kernel_add_on(const char *path)
rw_segment_handled = true; rw_segment_handled = true;
region = &image->data_region; region = &image->data_region;
snprintf(regionName, B_OS_NAME_LENGTH, "%s_data", path); snprintf(regionName, B_OS_NAME_LENGTH, "%s_data", fileName);
} else if ((pheaders[i].p_flags & (PF_PROTECTION_MASK)) == (PF_READ | PF_EXECUTE)) { } else if ((pheaders[i].p_flags & (PF_PROTECTION_MASK)) == (PF_READ | PF_EXECUTE)) {
// this is the non-writable segment // this is the non-writable segment
if (ro_segment_handled) { if (ro_segment_handled) {
@ -1308,7 +1316,7 @@ load_kernel_add_on(const char *path)
ro_segment_handled = true; ro_segment_handled = true;
region = &image->text_region; region = &image->text_region;
snprintf(regionName, B_OS_NAME_LENGTH, "%s_text", path); snprintf(regionName, B_OS_NAME_LENGTH, "%s_text", fileName);
} else { } else {
dprintf("weird program header flags 0x%lx\n", pheaders[i].p_flags); dprintf("weird program header flags 0x%lx\n", pheaders[i].p_flags);
continue; continue;
@ -1328,7 +1336,7 @@ load_kernel_add_on(const char *path)
region->delta = region->start - ROUNDOWN(pheaders[i].p_vaddr, B_PAGE_SIZE); region->delta = region->start - ROUNDOWN(pheaders[i].p_vaddr, B_PAGE_SIZE);
start += region->size; start += region->size;
TRACE(("elf_load_kspace: created a region at %p\n", (void *)region->start)); TRACE(("elf_load_kspace: created a region \"%s\" at %p\n", regionName, (void *)region->start));
len = _kern_read(fd, pheaders[i].p_offset, len = _kern_read(fd, pheaders[i].p_offset,
(void *)(region->start + (pheaders[i].p_vaddr % B_PAGE_SIZE)), (void *)(region->start + (pheaders[i].p_vaddr % B_PAGE_SIZE)),