]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/um/sys-i386/unmap.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / arch / um / sys-i386 / unmap.c
1 /*
2  * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #include <linux/mman.h>
7 #include <asm/unistd.h>
8 #include <sys/syscall.h>
9
10 int switcheroo(int fd, int prot, void *from, void *to, int size)
11 {
12         if (syscall(__NR_munmap, to, size) < 0){
13                 return(-1);
14         }
15         if (syscall(__NR_mmap2, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
16                 return(-1);
17         }
18         if (syscall(__NR_munmap, from, size) < 0){
19                 return(-1);
20         }
21         return(0);
22 }