summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdike <jdike>2003-12-19 20:42:55 +0000
committerjdike <jdike>2003-12-19 20:42:55 +0000
commita7ad850a22b9c5cff1a858979b06c3a080d53f96 (patch)
treecdf24bf858cc7cb758b8375dbc315cc152a162ec
parent1cbc3105740ec0ab9fc59cbc237935d9b58ced61 (diff)
downloaduml-history-a7ad850a22b9c5cff1a858979b06c3a080d53f96.tar.gz
Fixed the ubd-mmap file corruption bug by making sure that 64 bit offsets make
it to the kernel.
-rw-r--r--arch/um/include/os.h2
-rw-r--r--arch/um/os-Linux/process.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 5d5a5ad..7d6b4a8 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -159,7 +159,7 @@ extern void os_kill_process(int pid, int reap_child);
extern void os_usr1_process(int pid);
extern int os_getpid(void);
-extern int os_map_memory(void *virt, int fd, unsigned long off,
+extern int os_map_memory(void *virt, int fd, unsigned long long off,
unsigned long len, int r, int w, int x);
extern int os_protect_memory(void *addr, unsigned long len,
int r, int w, int x);
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index d5f99fa..a4e0071 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -100,7 +100,7 @@ int os_getpid(void)
return(getpid());
}
-int os_map_memory(void *virt, int fd, unsigned long off, unsigned long len,
+int os_map_memory(void *virt, int fd, unsigned long long off, unsigned long len,
int r, int w, int x)
{
void *loc;
@@ -109,8 +109,8 @@ int os_map_memory(void *virt, int fd, unsigned long off, unsigned long len,
prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
(x ? PROT_EXEC : 0);
- loc = mmap((void *) virt, len, prot, MAP_SHARED | MAP_FIXED,
- fd, off);
+ loc = mmap64((void *) virt, len, prot, MAP_SHARED | MAP_FIXED,
+ fd, off);
if(loc == MAP_FAILED)
return(-errno);
return(0);
@@ -131,7 +131,8 @@ int os_unmap_memory(void *addr, int len)
int err;
err = munmap(addr, len);
- if(err < 0) return(-errno);
+ if(err < 0)
+ return(-errno);
return(0);
}