Fixed libposix munmap call where we used the MMAP tag.

This commit is contained in:
Bahadir Balban
2008-11-07 15:18:43 +02:00
parent f0348cc356
commit f87f3cd5d2
2 changed files with 5 additions and 2 deletions

View File

@@ -78,7 +78,7 @@ int l4_munmap(void *start, size_t length)
write_mr(L4SYS_ARG1, length);
/* Call pager with MMAP request. */
if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_MMAP)) < 0) {
if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_MUNMAP)) < 0) {
printf("%s: IPC Error: %d.\n", __FUNCTION__, err);
return err;
}
@@ -116,7 +116,7 @@ int l4_msync(void *start, size_t length, int flags)
}
/* Check if syscall itself was successful */
if ((errno = l4_get_retval()) < 0) {
printf("%s: MUNMAP Error: %d.\n", __FUNCTION__, errno);
printf("%s: MSYNC Error: %d.\n", __FUNCTION__, errno);
return -1;
}
return 0;

View File

@@ -38,17 +38,20 @@ int mmaptest(void)
else
printf("write: Success.\n");
printf("%s: Calling mmap()\n", __TASKNAME__);
if ((int)(base = mmap(0, PAGE_SIZE*16, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) < 0)
perror("mmap");
else
printf("mmap: Success: %p\n", base);
*(unsigned int *)(base + PAGE_SIZE*2) = 0x1000;
printf("%s: Calling msync()\n", __TASKNAME__);
if (msync(base + PAGE_SIZE*2, PAGE_SIZE, MS_SYNC) < 0)
perror("msync");
else
printf("msync: Success: %p\n", base);
printf("%s: Calling munmap()\n", __TASKNAME__);
if (munmap(base + PAGE_SIZE*2, PAGE_SIZE) < 0)
perror("munmap");
else